balsa r7854 - in branches/mailbox-gsequence: . src



Author: PeterB
Date: Fri Feb 15 02:02:24 2008
New Revision: 7854
URL: http://svn.gnome.org/viewvc/balsa?rev=7854&view=rev

Log:
block the correct action

Modified:
   branches/mailbox-gsequence/ChangeLog
   branches/mailbox-gsequence/src/main-window.c

Modified: branches/mailbox-gsequence/src/main-window.c
==============================================================================
--- branches/mailbox-gsequence/src/main-window.c	(original)
+++ branches/mailbox-gsequence/src/main-window.c	Fri Feb 15 02:02:24 2008
@@ -1255,28 +1255,29 @@
     gtk_action_set_sensitive(action, sensitive);
 }
 
-/* Set the state of a GtkToggleAction; if block_action_name != NULL,
- * block the handling of signals emitted on that action.
- * Note: if action_name is a GtkRadioAction, block_action_name must be
- * the name of the first action in the group; otherwise it must be the
- * same as action_name.
+/* Set the state of a GtkToggleAction; if block == TRUE,
+ * block the handling of signals emitted on the action.
+ * Note: if action_name is a GtkRadioAction, and we are connected to the
+ * "toggled" signal, we must block the first action in the group, since
+ * that is the only action in the group that is connected to the signal;
+ * as of now (2008-02-14), we do not use the "toggled" signal, as it is
+ * not emitted when the user clicks on the currently active member of
+ * the group; instead, we connect to the "activate" signal for all
+ * members of the group, so the correct action to block is the one in
+ * the call.
  */
 static void
 bw_set_active(BalsaWindow * window, const gchar * action_name,
-              gboolean active, const gchar * block_action_name)
+              gboolean active, gboolean block)
 {
     GtkAction *action = bw_get_action(window, action_name);
-    GtkAction *block_action = block_action_name ?
-        bw_get_action(window, block_action_name) : NULL;
 
-    if (block_action)
-        g_signal_handlers_block_matched(block_action,
-                                        G_SIGNAL_MATCH_DATA, 0,
+    if (block)
+        g_signal_handlers_block_matched(action, G_SIGNAL_MATCH_DATA, 0,
                                         (GQuark) 0, NULL, NULL, window);
     gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), active);
-    if (block_action)
-        g_signal_handlers_unblock_matched(block_action,
-                                          G_SIGNAL_MATCH_DATA, 0,
+    if (block)
+        g_signal_handlers_unblock_matched(action, G_SIGNAL_MATCH_DATA, 0,
                                           (GQuark) 0, NULL, NULL, window);
 }
 
@@ -1617,7 +1618,7 @@
 
     /*PKGW: do it this way, without the usizes. */
 #if !defined(ENABLE_TOUCH_UI)
-    bw_set_active(window, "ShowMailboxTree", balsa_app.show_mblist, NULL);
+    bw_set_active(window, "ShowMailboxTree", balsa_app.show_mblist, FALSE);
 #endif                          /* !defined(ENABLE_TOUCH_UI) */
 
     gtk_paned_set_position(GTK_PANED(window->hpaned), 
@@ -1656,8 +1657,8 @@
     }
 
     bw_set_active(window, "ShowMailboxTabs", balsa_app.show_notebook_tabs,
-                  "ShowMailboxTabs");
-    bw_set_active(window, "Wrap", balsa_app.browse_wrap, NULL);
+                  TRUE);
+    bw_set_active(window, "Wrap", balsa_app.browse_wrap, FALSE);
 #else
     bw_set_sensitive(window, "ViewFilter", balsa_app.enable_view_filter);
     g_signal_connect_after(G_OBJECT(window), "key_press_event",
@@ -1677,8 +1678,7 @@
 #endif /*ENABLE_TOUCH_UI */
 
     /* set initial state of toggle preview pane button */
-    bw_set_active(window, "ShowPreviewPane", balsa_app.previewpane,
-                  "ShowPreviewPane");
+    bw_set_active(window, "ShowPreviewPane", balsa_app.previewpane, TRUE);
 
     /* set initial state of next-unread controls */
     bw_enable_next_unread(window, FALSE);
@@ -1966,11 +1966,11 @@
 
     switch(option) {
     case LB_MAILBOX_THREADING_FLAT:
-    bw_set_active(window, "FlatIndex", TRUE, "FlatIndex"); break;
+    bw_set_active(window, "FlatIndex", TRUE, TRUE); break;
     case LB_MAILBOX_THREADING_SIMPLE:
-    bw_set_active(window, "SimpleThreading", TRUE, "FlatIndex"); break;
+    bw_set_active(window, "SimpleThreading", TRUE, TRUE); break;
     case LB_MAILBOX_THREADING_JWZ:
-    bw_set_active(window, "JWZThreading", TRUE, "FlatIndex"); break;
+    bw_set_active(window, "JWZThreading", TRUE, TRUE); break;
     default: return;
     }
 
@@ -4359,7 +4359,7 @@
             if (hide_states[states_idx].flag == hide_states[curr_idx].flag
                 && hide_states[states_idx].set !=
                 hide_states[curr_idx].set) {
-                bw_set_active(bw, hide_states[i].action_name, FALSE, NULL);
+                bw_set_active(bw, hide_states[i].action_name, FALSE, FALSE);
                 return; /* triggered menu change will do the job */
             }
         }
@@ -5017,7 +5017,7 @@
 bw_reset_show_all_headers(BalsaWindow * window)
 {
     if (balsa_app.show_all_headers) {
-        bw_set_active(window, "ShowAllHeaders", FALSE, "ShowAllHeaders");
+        bw_set_active(window, "ShowAllHeaders", FALSE, TRUE);
         balsa_app.show_all_headers = FALSE;
     }
 }
@@ -5037,7 +5037,7 @@
 update_view_menu(BalsaWindow * window)
 {
 #if !defined(ENABLE_TOUCH_UI)
-    bw_set_active(window, "Wrap", balsa_app.browse_wrap, "Wrap");
+    bw_set_active(window, "Wrap", balsa_app.browse_wrap, TRUE);
     balsa_message_set_wrap(BALSA_MESSAGE(window->preview),
                            balsa_app.browse_wrap);
 #endif /* ENABLE_TOUCH_UI */



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