* Added a new signal that notifies about changes in the visible account id
authorSergio Villar Senin <svillar@igalia.com>
Thu, 19 Feb 2009 19:18:19 +0000 (19:18 +0000)
committerSergio Villar Senin <svillar@igalia.com>
Thu, 19 Feb 2009 19:18:19 +0000 (19:18 +0000)
pmo-trunk-r7598

src/widgets/modest-folder-view.c
src/widgets/modest-folder-view.h

index 3b151e0..5775a80 100644 (file)
@@ -201,6 +201,7 @@ enum {
        FOLDER_SELECTION_CHANGED_SIGNAL,
        FOLDER_DISPLAY_NAME_CHANGED_SIGNAL,
        FOLDER_ACTIVATED_SIGNAL,
+       VISIBLE_ACCOUNT_CHANGED_SIGNAL,
        LAST_SIGNAL
 };
 
@@ -339,6 +340,19 @@ modest_folder_view_class_init (ModestFolderViewClass *klass)
                              g_cclosure_marshal_VOID__POINTER,
                              G_TYPE_NONE, 1, G_TYPE_POINTER);
 
+       /*
+        * Emitted whenever the visible account changes
+        */
+       signals[VISIBLE_ACCOUNT_CHANGED_SIGNAL] =
+               g_signal_new ("visible-account-changed",
+                             G_TYPE_FROM_CLASS (gobject_class),
+                             G_SIGNAL_RUN_FIRST,
+                             G_STRUCT_OFFSET (ModestFolderViewClass,
+                                              visible_account_changed),
+                             NULL, NULL,
+                             g_cclosure_marshal_VOID__STRING,
+                             G_TYPE_NONE, 1, G_TYPE_STRING);
+
        treeview_class->select_cursor_parent = NULL;
 
 #ifdef MODEST_TOOLKIT_HILDON2
@@ -3270,6 +3284,11 @@ modest_folder_view_set_account_id_of_visible_server_account (ModestFolderView *s
        /* Save settings to gconf */
        modest_widget_memory_save (modest_runtime_get_conf (), G_OBJECT(self),
                                   MODEST_CONF_FOLDER_VIEW_KEY);
+
+       /* Notify observers */
+       g_signal_emit (G_OBJECT(self),
+                      signals[VISIBLE_ACCOUNT_CHANGED_SIGNAL], 0,
+                      account_id);
 }
 
 const gchar *
index cada9fc..72d7318 100644 (file)
@@ -90,6 +90,10 @@ struct _ModestFolderViewClass {
        void     (*folder_activated) (ModestFolderView *self,
                                      TnyFolderStore *folder,
                                      gpointer userdata);
+
+       void     (*visible_account_changed) (ModestFolderView* self,
+                                            const gchar *account_id,
+                                            gpointer user_data);
 };
 
 /**