* Some aesthetic changes
authorSergio Villar Senin <svillar@igalia.com>
Tue, 25 Sep 2007 17:16:23 +0000 (17:16 +0000)
committerSergio Villar Senin <svillar@igalia.com>
Tue, 25 Sep 2007 17:16:23 +0000 (17:16 +0000)
* Removed unused #includes
* Removed invalid code related to send queues
* Fixed the problem of GConf notifications when the default window is changed in the account view window
--This line, and those below, will be ignored- -

M    src/modest-main.c
M    src/widgets/modest-folder-view.c
M    src/widgets/modest-account-view.c
M    src/modest-tny-folder.c
M    src/maemo/modest-account-view-window.c
M    src/modest-conf.c
M    src/modest-conf.h
M    src/modest-widget-memory.c

pmo-trunk-r3412

src/maemo/modest-account-view-window.c
src/modest-conf.c
src/modest-conf.h
src/modest-main.c
src/modest-tny-folder.c
src/modest-widget-memory.c
src/widgets/modest-account-view.c
src/widgets/modest-folder-view.c

index f343aaa..3e90c4b 100644 (file)
@@ -128,23 +128,15 @@ on_selection_changed (GtkTreeSelection *sel, ModestAccountViewWindow *self)
        GtkTreeModel                   *model;
        GtkTreeIter                     iter;
        gboolean                        has_selection;
-       gchar                          *account_name;
-       gchar                          *default_account_name;
        
        priv = MODEST_ACCOUNT_VIEW_WINDOW_GET_PRIVATE(self);
 
        has_selection =
                gtk_tree_selection_get_selected (sel, &model, &iter);
 
+       /* Set the status of the buttons */
        gtk_widget_set_sensitive (priv->edit_button, has_selection);
        gtk_widget_set_sensitive (priv->delete_button, has_selection);  
-
-       account_name = modest_account_view_get_selected_account (priv->account_view);
-       default_account_name = modest_account_mgr_get_default_account(
-               modest_runtime_get_account_mgr());
-
-       g_free (account_name);
-       g_free (default_account_name);
 }
 
 /** Check whether any connections are active, and cancel them if 
@@ -384,7 +376,6 @@ button_box_new (ModestAccountViewWindow *self)
        return button_box;
 }
 
-
 static GtkWidget*
 window_vbox_new (ModestAccountViewWindow *self)
 {
@@ -394,6 +385,7 @@ window_vbox_new (ModestAccountViewWindow *self)
        GtkWidget *main_hbox     = gtk_hbox_new (FALSE, 6);
        
        priv->account_view = modest_account_view_new (modest_runtime_get_account_mgr());
+
        gtk_widget_set_size_request (GTK_WIDGET(priv->account_view), 300, 400);
        gtk_widget_show (GTK_WIDGET (priv->account_view));
 
@@ -421,9 +413,6 @@ window_vbox_new (ModestAccountViewWindow *self)
 static void
 modest_account_view_window_init (ModestAccountViewWindow *obj)
 {
-/*
-       ModestAccountViewWindowPrivate *priv = MODEST_ACCOUNT_VIEW_WINDOW_GET_PRIVATE(obj);
-*/             
        gtk_box_pack_start (GTK_BOX((GTK_DIALOG (obj)->vbox)), GTK_WIDGET (window_vbox_new (obj)), 
                TRUE, TRUE, 2);
        
@@ -433,7 +422,6 @@ modest_account_view_window_init (ModestAccountViewWindow *obj)
        gtk_window_set_title (GTK_WINDOW (obj), _("mcen_ti_emailsetup_accounts"));
 }
 
-
 GtkWidget*
 modest_account_view_window_new (void)
 {
index b6d82b3..55452f4 100644 (file)
@@ -427,7 +427,6 @@ modest_conf_on_change (GConfClient *client,
                       key, event, conn_id);
 }
 
-
 static GConfValueType
 modest_conf_type_to_gconf_type (ModestConfValueType value_type, GError **err)
 {
@@ -470,12 +469,14 @@ modest_conf_listen_to_namespace (ModestConf *self,
 
        /* Add the namespace to the list of the namespaces that will
           be observed */
-       gconf_client_add_dir (priv->gconf_client, namespace,
+       gconf_client_add_dir (priv->gconf_client,
+                             namespace,
                              GCONF_CLIENT_PRELOAD_NONE,
                              &error);
 
-       if (error)
+       if (error) {
                return 0;
+       }
 
        /* Notify every change under namespace */
        notification_id = gconf_client_notify_add (priv->gconf_client,
@@ -484,10 +485,12 @@ modest_conf_listen_to_namespace (ModestConf *self,
                                                   self,
                                                   NULL,
                                                   &error);
-       if (error)
+
+       if (error) {
                return 0;
-       else
+       } else {
                return notification_id;
+       }
 }
 
 void 
index e2bf25a..b3ac8c9 100644 (file)
@@ -306,7 +306,6 @@ ModestConfNotificationId modest_conf_listen_to_namespace (ModestConf *self,
 void modest_conf_forget_namespace (ModestConf *self,
                                   const gchar *namespace,
                                   ModestConfNotificationId id);
-
 G_END_DECLS
 
 #endif /* __MODEST_CONF_H__ */
index 498fc4d..9bb9588 100644 (file)
@@ -56,9 +56,9 @@ main (int argc, char *argv[])
                g_thread_init (NULL);
 
        gdk_threads_init ();
-       gdk_threads_enter (); /* CHECKED */
+       gdk_threads_enter ();
 
-       if (!gtk_init_check(&argc, &argv)) {
+       if (!gtk_init_check (&argc, &argv)) {
                g_printerr ("modest: failed to initialize gtk\n");
                retval = 1;
                goto cleanup;
@@ -79,7 +79,7 @@ main (int argc, char *argv[])
        }
        
        /* Usually, we only show the UI when we get the "top_application" D-Bus method.
-        * This allows modest to start via D-Bus activation to provide a service, 
+        * This allows modest to start via D-Bus activation to provide a service,
         * without showing the UI.
         * The UI will be shown later (or just after starting if no otehr D-Bus method was used),
         * when we receive the "top_application" D-Bus method.
@@ -87,12 +87,10 @@ main (int argc, char *argv[])
        if (show_ui_without_top_application_method)
                gtk_widget_show_all (GTK_WIDGET(win));
        
-       
-       gtk_main ();    
-       retval = 0;
+       gtk_main ();
 
 cleanup:
-       gdk_threads_leave (); /* CHECKED */
+       gdk_threads_leave ();
 
        if (!modest_init_uninit ()) {
                g_printerr ("modest: modest_init_uninit failed\n");
@@ -101,4 +99,3 @@ cleanup:
 
        return retval;
 }
-
index 7d4db52..cea0d09 100644 (file)
@@ -35,7 +35,6 @@
 #include <tny-simple-list.h>
 #include <tny-camel-folder.h>
 #include <tny-merge-folder.h>
-#include <camel/camel-folder.h>
 #include <modest-protocol-info.h>
 #include <modest-runtime.h>
 #include <modest-tny-account-store.h>
index 4c1a25e..fc894b9 100644 (file)
@@ -478,19 +478,6 @@ static gboolean
 save_settings_folder_view (ModestConf *conf, ModestFolderView *folder_view,
                           const gchar *name)
 {
-       gchar *key;
-       const gchar* account_id;
-
-       /* Save the visible account */
-       key = _modest_widget_memory_get_keyname (name, "visible_server_account_id");
-
-       account_id = modest_folder_view_get_account_id_of_visible_server_account (folder_view);
-       if (account_id)
-               modest_conf_set_string (conf, key, account_id, NULL);
-       else
-               modest_conf_remove_key (conf, key, NULL);
-       g_free (key);
-
        return TRUE;
 }
 
@@ -499,32 +486,23 @@ restore_settings_folder_view (ModestConf *conf,
                              ModestFolderView *folder_view,
                              const gchar *name)
 {
-       /* Don't restore the visible account but always show the default account
-        * as specified in section 4.1 of the email UI specification */
        ModestAccountMgr *mgr;
        gchar *default_acc;
 
-       /* If there is no visible account id in the
-          configuration then pick the default account as
-          visible account */
+       /* Always show the default account as visible server account */
        mgr = modest_runtime_get_account_mgr ();
        default_acc = modest_account_mgr_get_default_account (mgr);
        if (default_acc) {
                ModestAccountData *acc_data;
                const gchar *server_acc_id;
-               gchar *key = NULL;
 
                acc_data = modest_account_mgr_get_account_data (mgr, (const gchar*) default_acc);
                server_acc_id = (const gchar *) acc_data->store_account->account_name;
-               key = _modest_widget_memory_get_keyname (name, "visible_server_account_id");
 
-               modest_conf_set_string (conf, key, server_acc_id, NULL);
                modest_folder_view_set_account_id_of_visible_server_account (folder_view, server_acc_id);
 
-               g_free (key);
                g_free (default_acc);
        }
-
        return TRUE;
 }
 
index b178409..40bc5bf 100644 (file)
@@ -186,7 +186,7 @@ update_account_view (ModestAccountMgr *account_mgr, ModestAccountView *view)
                
        model = GTK_LIST_STORE(gtk_tree_view_get_model (GTK_TREE_VIEW(view)));
        
-       /* Get the ID of the currently-selected account, 
+       /* Get the ID of the currently-selected account,
         * so we can select it again after rebuilding the list.
         * Note that the name doesn't change even when the display name changes.
         */
@@ -195,11 +195,11 @@ update_account_view (ModestAccountMgr *account_mgr, ModestAccountView *view)
        gtk_list_store_clear (model);
 
        /* Note: We do not show disabled accounts.
-        * Of course, this means that there is no UI to enable or disable 
-        * accounts. That is OK for maemo where no such feature or UI is 
-        * specified, so the "enabled" property is used internally to avoid 
-        * showing unfinished accounts. If a user-visible "enabled" is 
-        * needed in the future, we must use a second property for the 
+        * Of course, this means that there is no UI to enable or disable
+        * accounts. That is OK for maemo where no such feature or UI is
+        * specified, so the "enabled" property is used internally to avoid
+        * showing unfinished accounts. If a user-visible "enabled" is
+        * needed in the future, we must use a second property for the
         * current use instead */
        cursor = account_names = modest_account_mgr_account_names (account_mgr,
                TRUE /* only enabled accounts. */);
@@ -330,8 +330,6 @@ on_account_changed (TnyAccountStore *account_store,
 {
        ModestAccountView *self = NULL;
        ModestAccountViewPrivate *priv = NULL;
-       TnyTransportAccount *transport_account = NULL;
-       ModestTnySendQueue *send_queue = NULL;
 
        g_return_if_fail (MODEST_IS_ACCOUNT_VIEW (user_data));
        g_return_if_fail (account);
@@ -343,26 +341,7 @@ on_account_changed (TnyAccountStore *account_store,
        g_warning ("account changed: %s", tny_account_get_id(account));
        
        /* Update account view */
-       update_account_view (priv->account_mgr, self);
-
-       /* Get transport account */
-       const gchar *modest_account_name = 
-                       modest_tny_account_get_parent_modest_account_name_for_server_account (account);
-       g_return_if_fail (modest_account_name);
-               
-       transport_account = (TnyTransportAccount*)
-               modest_tny_account_store_get_transport_account_for_open_connection (modest_runtime_get_account_store(),
-                                                                                   modest_account_name);
-
-       /* Restart send queue */
-       if (transport_account) {        
-               g_return_if_fail (TNY_IS_TRANSPORT_ACCOUNT(transport_account));
-               send_queue = modest_runtime_get_send_queue (transport_account);
-               g_return_if_fail (MODEST_IS_TNY_SEND_QUEUE(send_queue));
-               modest_tny_send_queue_try_to_send (send_queue);
-               
-               g_object_unref (transport_account);
-       }
+/*     update_account_view (priv->account_mgr, self); */
 }
 
 
@@ -385,49 +364,41 @@ find_default_account(ModestAccountView *self, GtkTreeIter *iter)
 }
 
 static void
-on_account_default_toggled (GtkCellRendererToggle *cell_renderer, gchar *path,
-                          ModestAccountView *self)
+on_account_default_toggled (GtkCellRendererToggle *cell_renderer, 
+                           gchar *path,
+                           ModestAccountView *self)
 {
+       ModestAccountViewPrivate *priv;
+       GtkTreeModel *model;
+       GtkTreeIter iter;
+       gchar *account_name = NULL;
 
        g_return_if_fail (MODEST_IS_ACCOUNT_VIEW (self));
 
-       gboolean is_default = gtk_cell_renderer_toggle_get_active (cell_renderer);
-       if (is_default) {
-               /* Do not allow an account to be marked non-default.
-                * Only allow this to be changed by setting another account to default: */
-               gtk_cell_renderer_toggle_set_active (cell_renderer, TRUE);
+       /* If it's active then do nothing, no need to reenable it as
+          default account */
+       if (gtk_cell_renderer_toggle_get_active (cell_renderer))
                return;
-       }
 
-       ModestAccountViewPrivate *priv = MODEST_ACCOUNT_VIEW_GET_PRIVATE(self);
-       GtkTreeModel *model = gtk_tree_view_get_model (GTK_TREE_VIEW(self));
-       
-       GtkTreeIter iter;
-       if (!gtk_tree_model_get_iter_from_string (model, &iter, path)) {
-               g_printerr ("modest: cannot find iterator\n");
-               return;
-       }
+       priv = MODEST_ACCOUNT_VIEW_GET_PRIVATE(self);
+       model = gtk_tree_view_get_model (GTK_TREE_VIEW(self));  
+       gtk_tree_model_get_iter_from_string (model, &iter, path);
        
-       gchar *account_name = NULL;
        gtk_tree_model_get (model, &iter, 
                            MODEST_ACCOUNT_VIEW_NAME_COLUMN, 
                            &account_name, -1);
-       
-       /* Set this previously-non-default account as the default: */
+
+       /* Set this previously-non-default account as the default */
        if (modest_account_mgr_set_default_account (priv->account_mgr, account_name)) {
-               /* Explicitely set default column because we are ignoring gconf changes */
                GtkTreeIter old_default_iter;
-               if (find_default_account (self, &old_default_iter)) {
-                       gtk_list_store_set (GTK_LIST_STORE (model), &old_default_iter,
-                                           MODEST_ACCOUNT_VIEW_IS_DEFAULT_COLUMN, FALSE, -1);
-               } else {
-                       g_warning ("%s: Did not find old default account in view", __FUNCTION__);
-               }
+
+               find_default_account (self, &old_default_iter);
+               gtk_list_store_set (GTK_LIST_STORE (model), &old_default_iter,
+                                   MODEST_ACCOUNT_VIEW_IS_DEFAULT_COLUMN, FALSE, -1);
 
                gtk_list_store_set (GTK_LIST_STORE (model), &iter,
                                    MODEST_ACCOUNT_VIEW_IS_DEFAULT_COLUMN, TRUE, -1);
        }
-
        g_free (account_name);
 }
 
@@ -492,7 +463,8 @@ init_view (ModestAccountView *self)
        g_object_set(G_OBJECT(toggle_renderer), "checkbox-mode", FALSE, NULL);
 #endif /* MODEST_HAVE_HILDON0_WIDGETS */
 
-       g_signal_connect (G_OBJECT(toggle_renderer), "toggled", G_CALLBACK(on_account_default_toggled),
+       g_signal_connect (G_OBJECT(toggle_renderer), "toggled", 
+                         G_CALLBACK(on_account_default_toggled),
                          self);
        
        /* account name */
index 2c82630..b476479 100644 (file)
@@ -675,6 +675,7 @@ modest_folder_view_init (ModestFolderView *obj)
         */
        priv->notification_id = modest_conf_listen_to_namespace (conf,
                                                                 MODEST_CONF_NAMESPACE);
+
        priv->conf_key_signal = g_signal_connect (G_OBJECT(conf), 
                                                  "key_changed",
                                                  G_CALLBACK(on_configuration_key_changed), 
@@ -1124,10 +1125,8 @@ filter_row (GtkTreeModel *model,
        
        /* If this is a move to dialog, hide Sent, Outbox and Drafts
        folder as no message can be move there according to UI specs */
-       if (!priv->show_non_move)
-       {
-               switch (type)
-               {
+       if (!priv->show_non_move) {
+               switch (type) {
                        case TNY_FOLDER_TYPE_OUTBOX:
                        case TNY_FOLDER_TYPE_SENT:
                        case TNY_FOLDER_TYPE_DRAFTS:
@@ -1136,15 +1135,14 @@ filter_row (GtkTreeModel *model,
                        case TNY_FOLDER_TYPE_UNKNOWN:
                        case TNY_FOLDER_TYPE_NORMAL:
                                type = modest_tny_folder_guess_folder_type(TNY_FOLDER(instance));
-                               if (type == TNY_FOLDER_TYPE_OUTBOX || type == TNY_FOLDER_TYPE_SENT
-                                               || type == TNY_FOLDER_TYPE_DRAFTS)
-                               {
+                               if (type == TNY_FOLDER_TYPE_OUTBOX || 
+                                   type == TNY_FOLDER_TYPE_SENT
+                                   || type == TNY_FOLDER_TYPE_DRAFTS)
                                        retval = FALSE;
-                               }
                                break;
                        default:
-                               break;  
-               }       
+                               break;
+               }
        }
        
        /* Free */