2007-07-30 Murray Cumming <murrayc@murrayc.com>
authorMurray Cumming <murrayc@murrayc.com>
Mon, 30 Jul 2007 14:55:58 +0000 (14:55 +0000)
committerMurray Cumming <murrayc@murrayc.com>
Mon, 30 Jul 2007 14:55:58 +0000 (14:55 +0000)
* src/modest-tny-account-store.c: (on_account_removed),
(on_account_changed): Emit the ACCOUNT_UPDATE signal so that the
account is removed from the View menu. We have TnyAccountStore
and ModestTnyAccountStore signals that seem very similar, but this
seems to work for now.

* src/maemo/modest-main-window.c:
(on_show_account_action_activated): Prevent dereference
of a NULL if the accoutn does not really exist, though that
should not happen anymore.

This fixes projects.maemo.org bug NB#64606.

pmo-trunk-r2855

ChangeLog
ChangeLog2
src/maemo/modest-main-window.c
src/modest-tny-account-store.c

index 48f7a59..acb6b92 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1 +1 @@
- please check the svn log instead
+* please check the svn log instead
index 63f70a5..2c04fc1 100644 (file)
@@ -1,5 +1,20 @@
 2007-07-30  Murray Cumming  <murrayc@murrayc.com>
 
 2007-07-30  Murray Cumming  <murrayc@murrayc.com>
 
+       * src/modest-tny-account-store.c: (on_account_removed),
+       (on_account_changed): Emit the ACCOUNT_UPDATE signal so that the 
+       account is removed from the View menu. We have TnyAccountStore 
+       and ModestTnyAccountStore signals that seem very similar, but this 
+       seems to work for now.
+
+       * src/maemo/modest-main-window.c:
+       (on_show_account_action_activated): Prevent dereference 
+       of a NULL if the accoutn does not really exist, though that 
+       should not happen anymore.
+
+       This fixes projects.maemo.org bug NB#64606.
+
+2007-07-30  Murray Cumming  <murrayc@murrayc.com>
+
        * src/modest-ui-actions.c: (run_account_setup_wizard),
        (modest_ui_actions_on_accounts): Revert a change that set these 
        to modal dialogs, freezing the UI when they show secondary dialogs.
        * src/modest-ui-actions.c: (run_account_setup_wizard),
        (modest_ui_actions_on_accounts): Revert a change that set these 
        to modal dialogs, freezing the UI when they show secondary dialogs.
index 045e76b..4484343 100644 (file)
@@ -1335,9 +1335,9 @@ on_account_update (TnyAccountStore *account_store,
                /* Create action and add it to the action group. The
                   action name must be the account name, this way we
                   could know in the handlers the account to show */
                /* Create action and add it to the action group. The
                   action name must be the account name, this way we
                   could know in the handlers the account to show */
-               if(account_data->account_name) {
+               if(account_data && account_data->account_name) {
                        gchar* item_name, *refresh_action_name;
                        gchar* item_name, *refresh_action_name;
-                       guint8 merge_id;
+                       guint8 merge_id = 0;
                        GtkAction *view_account_action, *refresh_account_action;
 
                        view_account_action = gtk_action_new (account_data->account_name,
                        GtkAction *view_account_action, *refresh_account_action;
 
                        view_account_action = gtk_action_new (account_data->account_name,
@@ -1369,6 +1369,7 @@ on_account_update (TnyAccountStore *account_store,
                        refresh_action_name = g_strconcat ("SendReceive", account_data->account_name, NULL);
                        refresh_account_action = gtk_action_new ((const gchar*) refresh_action_name, 
                                                                 display_name, NULL, NULL);
                        refresh_action_name = g_strconcat ("SendReceive", account_data->account_name, NULL);
                        refresh_account_action = gtk_action_new ((const gchar*) refresh_action_name, 
                                                                 display_name, NULL, NULL);
+                       printf("DEBUG: %s: menu display_name=%s\n", __FUNCTION__, display_name);
                        gtk_action_group_add_action (action_group, refresh_account_action);
 
                        merge_id = (guint8) gtk_ui_manager_new_merge_id (parent_priv->ui_manager);
                        gtk_action_group_add_action (action_group, refresh_account_action);
 
                        merge_id = (guint8) gtk_ui_manager_new_merge_id (parent_priv->ui_manager);
@@ -2140,7 +2141,7 @@ on_show_account_action_activated  (GtkAction *action,
        acc_data = modest_account_mgr_get_account_data (mgr, acc_name);
 
        /* Set the new visible & active account */
        acc_data = modest_account_mgr_get_account_data (mgr, acc_name);
 
        /* Set the new visible & active account */
-       if (acc_data->store_account) { 
+       if (acc_data && acc_data->store_account) { 
                modest_folder_view_set_account_id_of_visible_server_account (priv->folder_view,
                                                                             acc_data->store_account->account_name);
                modest_window_set_active_account (MODEST_WINDOW (self), acc_data->account_name);
                modest_folder_view_set_account_id_of_visible_server_account (priv->folder_view,
                                                                             acc_data->store_account->account_name);
                modest_window_set_active_account (MODEST_WINDOW (self), acc_data->account_name);
@@ -2149,7 +2150,8 @@ on_show_account_action_activated  (GtkAction *action,
        modest_folder_view_select_first_inbox_or_local (priv->folder_view);
 
        /* Free */
        modest_folder_view_select_first_inbox_or_local (priv->folder_view);
 
        /* Free */
-       modest_account_mgr_free_account_data (mgr, acc_data);
+       if (acc_data)
+               modest_account_mgr_free_account_data (mgr, acc_data);
 }
 
 static void
 }
 
 static void
index fdd51cf..9426354 100644 (file)
@@ -370,6 +370,10 @@ on_account_removed (ModestAccountMgr *acc_mgr,
        g_signal_emit (G_OBJECT (self),
                       tny_account_store_signals [TNY_ACCOUNT_STORE_ACCOUNT_REMOVED],
                       0, transport_account);
        g_signal_emit (G_OBJECT (self),
                       tny_account_store_signals [TNY_ACCOUNT_STORE_ACCOUNT_REMOVED],
                       0, transport_account);
+                      
+       /* Make sure that the account is reviewed from the View menu, etc: */
+       g_signal_emit (G_OBJECT(self), signals[ACCOUNT_UPDATE_SIGNAL], 0,
+                              NULL);
 
        /* Frees */
        g_object_unref (store_account);
 
        /* Frees */
        g_object_unref (store_account);
@@ -400,6 +404,8 @@ on_account_changed (ModestAccountMgr *acc_mgr, const gchar *account,
                    const GSList *keys, gboolean server_account, gpointer user_data)
 
 {
                    const GSList *keys, gboolean server_account, gpointer user_data)
 
 {
+       printf ("DEBUG: modest: %s\n", __FUNCTION__);
+       
        ModestTnyAccountStore *self = MODEST_TNY_ACCOUNT_STORE(user_data);
        
        /*
        ModestTnyAccountStore *self = MODEST_TNY_ACCOUNT_STORE(user_data);
        
        /*
@@ -410,6 +416,7 @@ on_account_changed (ModestAccountMgr *acc_mgr, const gchar *account,
        }
        */
        
        }
        */
        
+       
        /* Ignore the change if it's a change in the last_updated value */
        if (g_slist_length ((GSList *)keys) == 1 &&
                g_str_has_suffix ((const gchar *) keys->data, MODEST_ACCOUNT_LAST_UPDATED)) {
        /* Ignore the change if it's a change in the last_updated value */
        if (g_slist_length ((GSList *)keys) == 1 &&
                g_str_has_suffix ((const gchar *) keys->data, MODEST_ACCOUNT_LAST_UPDATED)) {