[patch] fix int-enum preference update in eel



Hi,

Here is a fix for a bug in eel-preferences-glade.c.

Regards
	Jan Arne
-- 
Jan Arne Petersen <jpetersen gnome-de org>
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/eel/ChangeLog,v
retrieving revision 1.493
diff -u -r1.493 ChangeLog
--- ChangeLog	13 Jan 2003 19:50:20 -0000	1.493
+++ ChangeLog	16 Jan 2003 23:06:36 -0000
@@ -1,3 +1,9 @@
+2003-01-17  Jan Arne Petersen  <jpetersen uni-bonn de>
+
+	* eel/eel_preferences_glade.c: (eel_preferences_glade_connect_int_enum):
+	Fix a bug which prevents int-enum optionmenus to be updated (Because 
+	of wrong contents in the value<->history map).
+
 === eel 2.1.91 ===
 
 2003-01-13  Alexander Larsson  <alexl redhat com>
Index: eel/eel-preferences-glade.c
===================================================================
RCS file: /cvs/gnome/eel/eel/eel-preferences-glade.c,v
retrieving revision 1.1
diff -u -r1.1 eel-preferences-glade.c
--- eel/eel-preferences-glade.c	31 Oct 2002 19:00:49 -0000	1.1
+++ eel/eel-preferences-glade.c	16 Jan 2003 23:06:37 -0000
@@ -238,7 +237,7 @@
 {
 	GHashTable *map;
 	int i;
-	int value;
+	int *value;
 	GtkOptionMenu *option_menu;
 	GSList *value_list;
 
@@ -249,13 +248,17 @@
 	
 	option_menu = GTK_OPTION_MENU (glade_xml_get_widget (dialog, component));
 
-	map = g_hash_table_new (g_int_hash, g_int_equal);
+	map = g_hash_table_new_full(g_int_hash, g_int_equal, (GDestroyNotify) g_free, NULL);
 	value_list = NULL;
 
 	for (i = 0; values[i] != -1; i++) {
-		value = values[i];
-		value_list = g_slist_append (value_list, GINT_TO_POINTER (value));
-		g_hash_table_insert (map, &value, GINT_TO_POINTER (i));
+		value = g_malloc (sizeof (int));
+		if (value == NULL) {
+			return;
+		}
+		*value = values[i];
+		value_list = g_slist_append (value_list, GINT_TO_POINTER (*value));
+		g_hash_table_insert (map, value, GINT_TO_POINTER (i));
 	}
 
 	g_object_set_data_full (G_OBJECT (option_menu), EEL_PREFERENCES_GLADE_DATA_MAP, map,

Attachment: signature.asc
Description: This is a digitally signed message part



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]