Re: [Nautilus-list] [PATCH] Make EelTextCaption behave properly in preferences



Please ignore my previous patch, it works fine, but it can be done much simpler...
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/eel/ChangeLog,v
retrieving revision 1.95
diff -p -u -r1.95 ChangeLog
--- ChangeLog	2001/05/17 23:00:38	1.95
+++ ChangeLog	2001/05/19 23:45:14
@@ -1,3 +1,10 @@
+2001-05-20  Miguel Rodríguez Pérez  <migras atlas uvigo es>
+
+	* eel/eel-preferences-item.c 
+	(preferences_item_update_editable_string): 
+	(preferences_item_update_editable_integer): Only update
+	text if it changed.
+
 2001-05-17  Darin Adler  <darin eazel com>
 
 	* eel/eel-gtk-extensions.c:
Index: eel/eel-preferences-item.c
===================================================================
RCS file: /cvs/gnome/eel/eel/eel-preferences-item.c,v
retrieving revision 1.2
diff -p -u -r1.2 eel-preferences-item.c
--- eel/eel-preferences-item.c	2001/05/04 13:00:14	1.2
+++ eel/eel-preferences-item.c	2001/05/19 23:45:17
@@ -556,6 +556,7 @@ static void
 preferences_item_update_editable_string (EelPreferencesItem *item)
 {
 	char *current_value;
+	gboolean same_text;
 
 	g_return_if_fail (EEL_IS_PREFERENCES_ITEM (item));
 	g_return_if_fail (item->details->item_type == EEL_PREFERENCE_ITEM_EDITABLE_STRING);
@@ -563,7 +564,11 @@ preferences_item_update_editable_string 
 	current_value = eel_preferences_get (item->details->preference_name);
 
 	g_assert (current_value != NULL);
-	eel_text_caption_set_text (EEL_TEXT_CAPTION (item->details->main_child), current_value);
+	same_text = !strcmp(eel_text_caption_get_text (EEL_TEXT_CAPTION (item->details->main_child)),
+			      current_value);
+	if (!same_text)
+		eel_text_caption_set_text (EEL_TEXT_CAPTION (item->details->main_child), current_value);
+
 	g_free (current_value);
 }
 
@@ -605,6 +610,7 @@ static void
 preferences_item_update_editable_integer (EelPreferencesItem *item)
 {
 	char *current_value;
+	gboolean same_text;
 
 	g_return_if_fail (EEL_IS_PREFERENCES_ITEM (item));
 	g_return_if_fail (item->details->item_type == EEL_PREFERENCE_ITEM_EDITABLE_INTEGER);
@@ -612,7 +618,12 @@ preferences_item_update_editable_integer
 	current_value = g_strdup_printf ("%d", eel_preferences_get_integer (item->details->preference_name));
 
 	g_assert (current_value != NULL);
-	eel_text_caption_set_text (EEL_TEXT_CAPTION (item->details->main_child), current_value);
+
+	same_text = !strcmp(eel_text_caption_get_text (EEL_TEXT_CAPTION (item->details->main_child)),
+			      current_value);
+	if (!same_text)
+		eel_text_caption_set_text (EEL_TEXT_CAPTION (item->details->main_child), current_value);
+
 	g_free (current_value);
 }
 


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