* src/maemo/modest-maemo-utils.[ch]:
authorJose Dapena Paz <jdapena@igalia.com>
Fri, 20 Jul 2007 09:48:31 +0000 (09:48 +0000)
committerJose Dapena Paz <jdapena@igalia.com>
Fri, 20 Jul 2007 09:48:31 +0000 (09:48 +0000)
* New method modest_maemo_gtk_toggle_action_set_active_block_notify
  that disables handlers on changing the current status of a
  toggle action. This was duplicated in msg view and editor, so
  it's been refactored to make them share the implementation.
  Using this in msg edit implementation change is pending on
  other changes in wpeditor.
* src/maemo/modest-msg-view-window.c:
* Now we use the new modest-maemo-utils refactored toggle action
  notify block method.

pmo-trunk-r2761

src/maemo/modest-maemo-utils.c
src/maemo/modest-maemo-utils.h
src/maemo/modest-msg-view-window.c

index 9e09a79..5c36574 100644 (file)
@@ -557,3 +557,25 @@ modest_maemo_set_thumbable_scrollbar (GtkScrolledWindow *win, gboolean thumbable
 #endif /* MODEST_HAVE_HILDON1_WIDGETS */
 }
 
+void
+modest_maemo_toggle_action_set_active_block_notify (GtkToggleAction *action, gboolean value)
+{
+       GSList *proxies = NULL;
+
+       g_return_if_fail (GTK_IS_TOGGLE_ACTION (action));
+
+       for (proxies = gtk_action_get_proxies (GTK_ACTION (action));
+            proxies != NULL; proxies = g_slist_next (proxies)) {
+               GtkWidget *widget = (GtkWidget *) proxies->data;
+               gtk_action_block_activate_from (GTK_ACTION (action), widget);
+       }
+
+       gtk_toggle_action_set_active (action, value);
+
+       for (proxies = gtk_action_get_proxies (GTK_ACTION (action));
+            proxies != NULL; proxies = g_slist_next (proxies)) {
+               GtkWidget *widget = (GtkWidget *) proxies->data;
+               gtk_action_unblock_activate_from (GTK_ACTION (action), widget);
+       }
+
+}
index ec99530..3fa9ef3 100644 (file)
@@ -145,4 +145,13 @@ void modest_maemo_show_dialog_and_forget (GtkWindow *parent_window, GtkDialog *d
 
 void modest_maemo_set_thumbable_scrollbar (GtkScrolledWindow *win, gboolean thumbable);
 
+/**
+ * modest_maemo_toggle_action_set_active_block_notify:
+ * @action: a #GtkToggleAction
+ * @value: a #gboolean
+ *
+ * updates the toggle action active status, but blocking the notification of the changes.
+ */
+void modest_maemo_toggle_action_set_active_block_notify (GtkToggleAction *action, gboolean value);
+
 #endif /*__MODEST_MAEMO_UTILS_H__*/
index 5328c54..de4a45a 100644 (file)
@@ -755,28 +755,6 @@ modest_msg_view_window_get_message_uid (ModestMsgViewWindow *self)
        return (const gchar*) priv->msg_uid;
 }
 
-static void
-toggle_action_set_active_block_notify (GtkToggleAction *action,
-                                      gboolean value)
-{
-       GSList *proxies = NULL;
-
-       for (proxies = gtk_action_get_proxies (GTK_ACTION (action));
-            proxies != NULL; proxies = g_slist_next (proxies)) {
-               GtkWidget *widget = (GtkWidget *) proxies->data;
-               gtk_action_block_activate_from (GTK_ACTION (action), widget);
-       }
-
-       gtk_toggle_action_set_active (action, value);
-
-       for (proxies = gtk_action_get_proxies (GTK_ACTION (action));
-            proxies != NULL; proxies = g_slist_next (proxies)) {
-               GtkWidget *widget = (GtkWidget *) proxies->data;
-               gtk_action_unblock_activate_from (GTK_ACTION (action), widget);
-       }
-}
-
-
 static void 
 modest_msg_view_window_toggle_find_toolbar (GtkToggleAction *toggle,
                                            gpointer data)
@@ -798,9 +776,9 @@ modest_msg_view_window_toggle_find_toolbar (GtkToggleAction *toggle,
 
        /* update the toggle buttons status */
        action = gtk_ui_manager_get_action (parent_priv->ui_manager, "/ToolBar/FindInMessage");
-       toggle_action_set_active_block_notify (GTK_TOGGLE_ACTION (action), is_active);
+       modest_maemo_toggle_action_set_active_block_notify (GTK_TOGGLE_ACTION (action), is_active);
        action = gtk_ui_manager_get_action (parent_priv->ui_manager, "/MenuBar/ToolsMenu/ToolsFindInMessageMenu");
-       toggle_action_set_active_block_notify (GTK_TOGGLE_ACTION (action), is_active);
+       modest_maemo_toggle_action_set_active_block_notify (GTK_TOGGLE_ACTION (action), is_active);
        
 }