properly building gobject

svn path=/trunk/; revision=7640
This commit is contained in:
Sergey V. Udaltsov 2007-05-19 13:36:22 +00:00
parent 251deaaff8
commit f8aa7cb87b
4 changed files with 21 additions and 12 deletions

View file

@ -2,6 +2,9 @@
* gnome-keyboard-properties-xkbmc.c: make things buildable with * gnome-keyboard-properties-xkbmc.c: make things buildable with
libxklavier 3.2 libxklavier 3.2
* gnome-keyboard-properties-xkb.c,
gnome-keyboard-properties-xkbltadd.c: XklConfigItem is a GObject, so
it has to be properly built (not on the stack but in heap)
2007-05-17 Sergey Udaltsov <svu@gnome.org> 2007-05-17 Sergey Udaltsov <svu@gnome.org>

View file

@ -55,7 +55,7 @@ xci_desc_to_utf8 (XklConfigItem * ci)
static void static void
set_model_text (GtkWidget * entry, GConfValue * value) set_model_text (GtkWidget * entry, GConfValue * value)
{ {
XklConfigItem ci; XklConfigItem *ci = xkl_config_item_new ();
const char *model = NULL; const char *model = NULL;
if (value != NULL && value->type == GCONF_VALUE_STRING) { if (value != NULL && value->type == GCONF_VALUE_STRING) {
@ -70,17 +70,18 @@ set_model_text (GtkWidget * entry, GConfValue * value)
model = ""; model = "";
} }
g_snprintf (ci.name, sizeof (ci.name), "%s", model); g_snprintf (ci->name, sizeof (ci->name), "%s", model);
if (xkl_config_registry_find_model (config_registry, &ci)) { if (xkl_config_registry_find_model (config_registry, ci)) {
char *d; char *d;
d = xci_desc_to_utf8 (&ci); d = xci_desc_to_utf8 (ci);
gtk_entry_set_text (GTK_ENTRY (entry), d); gtk_entry_set_text (GTK_ENTRY (entry), d);
g_free (d); g_free (d);
} else { } else {
gtk_entry_set_text (GTK_ENTRY (entry), _("Unknown")); gtk_entry_set_text (GTK_ENTRY (entry), _("Unknown"));
} }
g_object_unref (G_OBJECT (ci));
} }
static void static void
@ -166,8 +167,7 @@ setup_xkb_tabs (GladeXML * dialog, GConfChangeSet * changeset)
(changeset, (gchar *) GKBD_DESKTOP_CONFIG_KEY_GROUP_PER_WINDOW, (changeset, (gchar *) GKBD_DESKTOP_CONFIG_KEY_GROUP_PER_WINDOW,
WID ("chk_separate_group_per_window"), NULL); WID ("chk_separate_group_per_window"), NULL);
g_signal_connect (peditor, "value-changed", g_signal_connect (peditor, "value-changed", (GCallback)
(GCallback)
chk_separate_group_per_window_toggled, dialog); chk_separate_group_per_window_toggled, dialog);
/* tab 2 */ /* tab 2 */

View file

@ -294,13 +294,12 @@ xkl_layout_chooser_add_default_switcher_if_necessary (GSList *
option = option->next; option = option->next;
} }
if (!any_switcher) { if (!any_switcher) {
XklConfigItem ci; XklConfigItem *ci = xkl_config_item_new ();
g_snprintf (ci.name, g_snprintf (ci->name,
XKL_MAX_CI_NAME_LENGTH, XKL_MAX_CI_NAME_LENGTH,
DEFAULT_GROUP_SWITCH); DEFAULT_GROUP_SWITCH);
if (xkl_config_registry_find_option if (xkl_config_registry_find_option
(config_registry, (config_registry, GROUP_SWITCHERS_GROUP, ci)) {
GROUP_SWITCHERS_GROUP, &ci)) {
const gchar *id = const gchar *id =
gkbd_keyboard_config_merge_items gkbd_keyboard_config_merge_items
(GROUP_SWITCHERS_GROUP, (GROUP_SWITCHERS_GROUP,
@ -311,6 +310,7 @@ xkl_layout_chooser_add_default_switcher_if_necessary (GSList *
xkb_options_set_selected_list xkb_options_set_selected_list
(options_list); (options_list);
} }
g_object_unref (G_OBJECT (ci));
} }
clear_xkb_elements_list (options_list); clear_xkb_elements_list (options_list);
} }

View file

@ -41,6 +41,11 @@ static void fill_models_list (GladeXML * chooser_dialog);
static gboolean fill_vendors_list (GladeXML * chooser_dialog); static gboolean fill_vendors_list (GladeXML * chooser_dialog);
/* hack, till libxklavier 3.3 is released */
#ifndef XCI_PROP_VENDOR
#define XCI_PROP_VENDOR "vendor"
#endif
static GtkTreePath * static GtkTreePath *
gtk_list_store_find_entry (GtkListStore * list_store, gtk_list_store_find_entry (GtkListStore * list_store,
GtkTreeIter * iter, gchar * name, int column_id) GtkTreeIter * iter, gchar * name, int column_id)
@ -77,7 +82,8 @@ add_vendor_to_list (XklConfigRegistry * config_registry,
gchar *vendor_name = gchar *vendor_name =
(gchar *) g_object_get_data (G_OBJECT (config_item), (gchar *) g_object_get_data (G_OBJECT (config_item),
"vendor"); XCI_PROP_VENDOR);
if (vendor_name == NULL) if (vendor_name == NULL)
return; return;
@ -111,7 +117,7 @@ add_model_to_list (XklConfigRegistry * config_registry,
if (current_vendor_name != NULL) { if (current_vendor_name != NULL) {
gchar *vendor_name = gchar *vendor_name =
(gchar *) g_object_get_data (G_OBJECT (config_item), (gchar *) g_object_get_data (G_OBJECT (config_item),
"vendor"); XCI_PROP_VENDOR);
if (vendor_name == NULL) if (vendor_name == NULL)
return; return;