From: Jose Dapena Paz Date: Mon, 2 Mar 2009 15:42:07 +0000 (+0000) Subject: Launch mailboxes window on multimailboxes accounts X-Git-Tag: git_migration_finished~452 X-Git-Url: http://git.maemo.org/git/?p=modest;a=commitdiff_plain;h=498f4ad7afce6a5320beadf565a67547381d04e6 Launch mailboxes window on multimailboxes accounts pmo-trunk-r7753 --- diff --git a/src/hildon2/modest-accounts-window.c b/src/hildon2/modest-accounts-window.c index 765bf84..9a96dda 100644 --- a/src/hildon2/modest-accounts-window.c +++ b/src/hildon2/modest-accounts-window.c @@ -47,6 +47,8 @@ #include #include #include +#include +#include /* 'private'/'protected' functions */ @@ -377,8 +379,10 @@ on_account_activated (GtkTreeView *account_view, { ModestAccountsWindowPrivate *priv; gchar* account_name; - GtkWidget *folder_window; + GtkWidget *new_window; gboolean registered; + ModestProtocolType store_protocol; + gboolean mailboxes_protocol; priv = MODEST_ACCOUNTS_WINDOW_GET_PRIVATE (self); @@ -386,17 +390,32 @@ on_account_activated (GtkTreeView *account_view, if (!account_name) return; - folder_window = GTK_WIDGET (modest_folder_window_new (NULL)); + /* If it's a multimailbox container, we have to show the mailboxes window */ + store_protocol = modest_account_mgr_get_store_protocol (modest_runtime_get_account_mgr (), + account_name); + mailboxes_protocol = + modest_protocol_registry_protocol_type_has_tag (modest_runtime_get_protocol_registry (), + store_protocol, + MODEST_PROTOCOL_REGISTRY_MULTI_MAILBOX_PROVIDER_PROTOCOLS); + if (mailboxes_protocol) { + new_window = GTK_WIDGET (modest_mailboxes_window_new (account_name)); + } else { + + new_window = GTK_WIDGET (modest_folder_window_new (NULL)); + } + registered = modest_window_mgr_register_window (modest_runtime_get_window_mgr (), - MODEST_WINDOW (folder_window), + MODEST_WINDOW (new_window), MODEST_WINDOW (self)); if (!registered) { - gtk_widget_destroy (folder_window); - folder_window = NULL; + gtk_widget_destroy (new_window); + new_window = NULL; } else { - modest_folder_window_set_account (MODEST_FOLDER_WINDOW (folder_window), account_name); - gtk_widget_show (folder_window); + if (!mailboxes_protocol) { + modest_folder_window_set_account (MODEST_FOLDER_WINDOW (new_window), account_name); + } + gtk_widget_show (new_window); } g_free (account_name); } diff --git a/src/hildon2/modest-mailboxes-window.c b/src/hildon2/modest-mailboxes-window.c index d0df4a9..dbf8fa4 100644 --- a/src/hildon2/modest-mailboxes-window.c +++ b/src/hildon2/modest-mailboxes-window.c @@ -307,6 +307,8 @@ modest_mailboxes_window_new (const gchar *account) accel_key, accel_mods, 0); gtk_window_add_accel_group (GTK_WINDOW (self), accel_group); + modest_mailboxes_window_set_account (MODEST_MAILBOXES_WINDOW (self), account); + return MODEST_WINDOW(self); }