2007-05-17 Murray Cumming <murrayc@murrayc.com>
authorMurray Cumming <murrayc@murrayc.com>
Thu, 17 May 2007 09:56:12 +0000 (09:56 +0000)
committerMurray Cumming <murrayc@murrayc.com>
Thu, 17 May 2007 09:56:12 +0000 (09:56 +0000)
* src/maemo/modest-main-window-ui.h:
        * src/modest-ui-actions.c:
        * src/modest-ui-actions.h:
        Connect the Tools/SMTP Servers menu item to
        modest_ui_actions_on_smtp_servers(), which shows the connection-specific
        SMTP servers dialog, as in the UI specification and saves changes when it
        is closed. This fixed  projects.maemo.org bug NB#56305 .

pmo-trunk-r1896

ChangeLog2
src/maemo/modest-connection-specific-smtp-window.c
src/maemo/modest-main-window-ui.h
src/modest-ui-actions.c
src/modest-ui-actions.h

index d44cc84..1493527 100644 (file)
@@ -1,5 +1,15 @@
 2007-05-17  Murray Cumming  <murrayc@murrayc.com>
 
+       * src/maemo/modest-main-window-ui.h:
+       * src/modest-ui-actions.c:
+       * src/modest-ui-actions.h:
+       Connect the Tools/SMTP Servers menu item to 
+       modest_ui_actions_on_smtp_servers(), which shows the connection-specific 
+       SMTP servers dialog, as in the UI specification and saves changes when it 
+       is closed. This fixed  projects.maemo.org bug NB#56305 .
+
+2007-05-17  Murray Cumming  <murrayc@murrayc.com>
+
        * src/maemo/modest-connection-specific-smtp-window.c:
        (modest_connection_specific_smtp_window_init):
        Use gtk_window_set_default_size() to make this window big enough, so 
index 91767b4..ebbfe08 100644 (file)
@@ -247,8 +247,10 @@ on_button_edit (GtkButton *button, gpointer user_data)
                                                MODEST_CONNECTION_SPECIFIC_SMTP_EDIT_WINDOW (window), 
                                                priv->account_manager);
                        
+                       const gchar* server_name = data ? data->hostname : NULL;
                        gtk_list_store_set (GTK_LIST_STORE (priv->model), &iter, 
                                        MODEL_COL_SERVER_ACCOUNT_DATA, data,
+                                       MODEL_COL_SERVER_NAME, server_name,
                                        -1);
                }
        }
@@ -308,6 +310,11 @@ modest_connection_specific_smtp_window_init (ModestConnectionSpecificSmtpWindow
        /* Setup the tree view: */
        priv->treeview = GTK_TREE_VIEW (gtk_tree_view_new_with_model (priv->model));
 
+       /* Show the column headers,
+        * which does not seem to be the default on Maemo.
+        */                     
+       gtk_tree_view_set_headers_visible (GTK_TREE_VIEW(priv->treeview), TRUE);
+       
        /* name column:
         * The ID model column in not shown in the view. */
        GtkTreeViewColumn *view_column = gtk_tree_view_column_new ();
index 87069ce..83af01a 100644 (file)
@@ -92,7 +92,7 @@ static const GtkActionEntry modest_action_entries [] = {
        /* Tools */
        { "ToolsSettings",        NULL,      N_("mcen_me_inbox_options"),                     NULL, NULL, G_CALLBACK (modest_ui_actions_on_settings) },
        { "ToolsAccounts",        NULL,      N_("mcen_me_inbox_accounts"),                NULL, NULL,  G_CALLBACK(modest_ui_actions_on_accounts) },
-       { "ToolsSMTPServers",     NULL,      N_("mcen_me_inbox_globalsmtpservers"),                NULL, NULL,  NULL },
+       { "ToolsSMTPServers",     NULL,      N_("mcen_me_inbox_globalsmtpservers"),                NULL, NULL,  G_CALLBACK(modest_ui_actions_on_smtp_servers) },
        { "ToolsSendReceive", NULL, N_("mcen_me_inbox_sendandreceive") }, /* submenu */
        { "ToolsSendReceiveAll",    NULL,      N_("mcen_me_inbox_sendandreceive_all"),          NULL, NULL, G_CALLBACK (modest_ui_actions_on_send_receive) },
        { "ToolsSendReceiveCancelSending",  NULL,      N_("mcen_me_outbox_cancelsend"),        NULL, NULL,  NULL },
index 9e4b934..3692775 100644 (file)
@@ -55,6 +55,7 @@
 #include <widgets/modest-details-dialog.h>
 #include <widgets/modest-attachments-view.h>
 #include "widgets/modest-global-settings-dialog.h"
+#include "modest-connection-specific-smtp-window.h"
 #include "modest-account-mgr-helpers.h"
 #include "modest-mail-operation.h"
 #include "modest-text-utils.h"
@@ -314,7 +315,6 @@ modest_ui_actions_on_add_to_contacts (GtkAction *action, ModestWindow *win)
 void
 modest_ui_actions_on_accounts (GtkAction *action, ModestWindow *win)
 {
-       
        /* This is currently only implemented for Maemo,
         * because it requires a providers preset file which is not publically available.
         */
@@ -364,6 +364,45 @@ modest_ui_actions_on_accounts (GtkAction *action, ModestWindow *win)
 #endif /* MODEST_PLATFORM_MAEMO */
 }
 
+static void
+on_smtp_servers_window_hide (GtkWindow* window, gpointer user_data)
+{
+       ModestWindow *main_window = MODEST_WINDOW (user_data);
+       
+       /* Save any changes. */
+       modest_connection_specific_smtp_window_save_server_accounts (
+                       MODEST_CONNECTION_SPECIFIC_SMTP_WINDOW (window), 
+                       modest_window_get_active_account (main_window));
+       gtk_widget_destroy (GTK_WIDGET (window));
+}
+
+void
+modest_ui_actions_on_smtp_servers (GtkAction *action, ModestWindow *win)
+{
+       /* This is currently only implemented for Maemo,
+        * because it requires an API (libconic) to detect different connection 
+        * possiblities.
+        */
+#ifdef MODEST_PLATFORM_MAEMO /* Defined in config.h */
+       
+       /* Create the window if necessary: */
+       GtkWidget *specific_window = GTK_WIDGET (modest_connection_specific_smtp_window_new ());
+       modest_connection_specific_smtp_window_fill_with_connections (
+               MODEST_CONNECTION_SPECIFIC_SMTP_WINDOW (specific_window), 
+               modest_runtime_get_account_mgr(), 
+               modest_window_get_active_account (win));
+
+       /* Show the window: */  
+       gtk_window_set_transient_for (GTK_WINDOW (specific_window), GTK_WINDOW (win));
+       gtk_window_set_modal (GTK_WINDOW (specific_window), TRUE);
+    gtk_widget_show (specific_window);
+    
+    /* Save changes when the window is hidden: */
+       g_signal_connect (specific_window, "hide", 
+               G_CALLBACK (on_smtp_servers_window_hide), win);
+#endif /* MODEST_PLATFORM_MAEMO */
+}
+
 void
 modest_ui_actions_on_new_msg (GtkAction *action, ModestWindow *win)
 {
index 469c700..aca1757 100644 (file)
@@ -49,6 +49,8 @@ void     modest_ui_actions_on_new_account      (GtkAction *action, ModestWindow
 
 void     modest_ui_actions_on_accounts      (GtkAction *action, ModestWindow *win);
 
+void     modest_ui_actions_on_smtp_servers  (GtkAction *action, ModestWindow *win);
+
 void     modest_ui_actions_on_add_to_contacts   (GtkAction *action, ModestWindow *win);
 
 void     modest_ui_actions_on_select_contacts (GtkAction *action, ModestMsgEditWindow *win);