[ekiga] Tried to trigger less signals in gtk_radio_menu_select_with_widget



commit 4cc878bed36ca5657dfa7d75736ebc99a9d21550
Author: Julien Puydt <jpuydt gnome org>
Date:   Thu Oct 7 15:14:38 2010 +0200

    Tried to trigger less signals in gtk_radio_menu_select_with_widget
    
    In the loop, we check and only call set_active on the two items concerned
    by the change, instead of all of them (!).

 lib/gui/gmmenuaddon.c |   18 ++++++++++++++++--
 1 files changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/lib/gui/gmmenuaddon.c b/lib/gui/gmmenuaddon.c
index d796eaa..571becd 100644
--- a/lib/gui/gmmenuaddon.c
+++ b/lib/gui/gmmenuaddon.c
@@ -531,8 +531,22 @@ gtk_radio_menu_select_with_widget (GtkWidget *widget,
   group_last_pos = g_slist_length (group) - 1; /* If length 1, last pos is 0 */
   while (group) {
 
-    gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (group->data), (i == group_last_pos - active));
-    gtk_widget_queue_draw (GTK_WIDGET (group->data));
+    GtkCheckMenuItem* item = GTK_CHECK_MENU_ITEM (group->data);
+    if (gtk_check_menu_item_get_active (item)) {
+
+      if (i != group_last_pos - active) {
+
+	gtk_check_menu_item_set_active (item, FALSE);
+	gtk_widget_queue_draw (GTK_WIDGET (item));
+      }
+    } else {
+
+      if (i == group_last_pos - active) {
+
+	gtk_check_menu_item_set_active (item, TRUE);
+	gtk_widget_queue_draw (GTK_WIDGET (item));
+      }
+    }
 
     group = g_slist_next (group);
     i++;



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