Added support to handle accounts-reloaded signal
authorSergio Villar Senin <svillar@igalia.com>
Mon, 29 Jan 2007 18:57:48 +0000 (18:57 +0000)
committerSergio Villar Senin <svillar@igalia.com>
Mon, 29 Jan 2007 18:57:48 +0000 (18:57 +0000)
pmo-trunk-r759

src/modest-mail-operation.c
src/modest-ui.c
src/widgets/modest-folder-view.c
src/widgets/modest-folder-view.h

index 3c17847..d67f7fb 100644 (file)
@@ -402,8 +402,7 @@ modest_mail_operation_create_reply_mail (TnyMsg *msg,
        new_header = tny_msg_get_header (new_msg);
        reply_to = tny_header_get_replyto (header);
 
-       /* TODO: tinymail returns Invalid and it should return NULL */
-       if (strcmp (reply_to, "Invalid"))
+       if (reply_to)
                tny_header_set_to (new_header, reply_to);
        else
                tny_header_set_to (new_header, tny_header_get_from (header));
index 084b781..7ffd699 100644 (file)
@@ -99,6 +99,9 @@ static void     reply_forward          (GtkWidget *widget,
 static gchar*   ask_for_folder_name    (GtkWindow *parent_window,
                                        const gchar *title);
 
+static void     _modest_ui_actions_on_accounts_reloaded (TnyAccountStore *store, 
+                                                        gpointer user_data);
+
 GType
 modest_ui_get_type (void)
 {
@@ -306,6 +309,7 @@ static void
 connect_signals (ModestUI *self)
 {
        TnyDevice *device;
+       TnyAccountStore *account_store;
        ModestUIPrivate *priv;
        ModestFolderView *folder_view;
        ModestHeaderView *header_view;
@@ -317,12 +321,12 @@ connect_signals (ModestUI *self)
 
        widget_factory = modest_runtime_get_widget_factory (); 
        
-       folder_view = modest_widget_factory_get_folder_view (widget_factory);
-       header_view = modest_widget_factory_get_header_view (widget_factory);
-       msg_view    = modest_widget_factory_get_msg_preview (widget_factory);
-       toggle      = modest_widget_factory_get_online_toggle (widget_factory);
-       device      = tny_account_store_get_device
-               (TNY_ACCOUNT_STORE(modest_runtime_get_account_store()));
+       folder_view   = modest_widget_factory_get_folder_view (widget_factory);
+       header_view   = modest_widget_factory_get_header_view (widget_factory);
+       msg_view      = modest_widget_factory_get_msg_preview (widget_factory);
+       toggle        = modest_widget_factory_get_online_toggle (widget_factory);
+       account_store = TNY_ACCOUNT_STORE(modest_runtime_get_account_store());
+       device        = tny_account_store_get_device (account_store);
 
        /* folder view */
        g_signal_connect (G_OBJECT(folder_view), "folder_selection_changed",
@@ -349,6 +353,11 @@ connect_signals (ModestUI *self)
                          G_CALLBACK(_modest_ui_actions_on_msg_attachment_clicked), 
                          priv->main_window);
 
+       /* Account store */
+       g_signal_connect (G_OBJECT (account_store), "accounts_reloaded",
+                         G_CALLBACK (_modest_ui_actions_on_accounts_reloaded),
+                         priv->main_window);
+
        /* Device */
        g_signal_connect (G_OBJECT(device), "connection_changed",
                          G_CALLBACK(_modest_ui_actions_on_connection_changed), 
@@ -363,7 +372,6 @@ connect_signals (ModestUI *self)
                          G_CALLBACK(on_main_window_destroy), 
                          NULL);
 
-
        /* Init toggle in correct state */
        _modest_ui_actions_on_connection_changed (device,
                                                 tny_device_is_online (device),
@@ -1254,3 +1262,14 @@ _modest_ui_actions_on_move_to_trash_folder (GtkWidget *widget,
 {
        delete_folder (main_window, TRUE);
 }
+
+static void
+_modest_ui_actions_on_accounts_reloaded (TnyAccountStore *store, gpointer user_data)
+{
+       ModestFolderView *folder_view;
+       ModestMailOperation *mail_op;
+       
+       folder_view = modest_widget_factory_get_folder_view (modest_runtime_get_widget_factory());
+
+       modest_folder_view_update_model (folder_view, store);
+}
index e6960c9..804c74d 100644 (file)
@@ -59,9 +59,6 @@ static void         on_selection_changed     (GtkTreeSelection *sel, gpointer da
 static void         on_subscription_changed  (TnyStoreAccount *store_account, TnyFolder *folder,
                                              ModestFolderView *self);
 
-static gboolean     modest_folder_view_update_model     (ModestFolderView *self,
-                                                        TnyAccountStore *account_store);
-
 static void         modest_folder_view_disconnect_store_account_handlers (GtkTreeView *self);
 
 static gint         cmp_rows (GtkTreeModel *tree_model, GtkTreeIter *iter1, GtkTreeIter *iter2,
@@ -581,7 +578,7 @@ on_subscription_changed  (TnyStoreAccount *store_account,
 }
 
 
-static gboolean
+gboolean
 modest_folder_view_update_model (ModestFolderView *self, TnyAccountStore *account_store)
 {
        g_return_val_if_fail (MODEST_IS_FOLDER_VIEW (self), FALSE);
index 32f5de7..3df70c4 100644 (file)
@@ -111,6 +111,10 @@ void          modest_folder_view_set_title       (ModestFolderView *self,
  **/
 TnyFolder*    modest_folder_view_get_selected    (ModestFolderView *self);
 
+
+gboolean      modest_folder_view_update_model    (ModestFolderView *self,
+                                                 TnyAccountStore *account_store);
+
 G_END_DECLS
 
 #endif /* __MODEST_FOLDER_VIEW_H__ */