From aeb22882e19cf647762d2d59be8ae3a15e67c687 Mon Sep 17 00:00:00 2001 From: Sergio Villar Senin Date: Mon, 13 Jul 2009 12:55:29 +0200 Subject: [PATCH] Fixes NB#127102, open account DBus method is silently ignored if the current viewed window is not the accounts window --- src/dbus_api/modest-dbus-callbacks.c | 48 +++++++++++++++---------------- src/hildon2/modest-hildon2-window-mgr.c | 17 +++++++---- 2 files changed, 35 insertions(+), 30 deletions(-) diff --git a/src/dbus_api/modest-dbus-callbacks.c b/src/dbus_api/modest-dbus-callbacks.c index 61b7495..ffc0be7 100644 --- a/src/dbus_api/modest-dbus-callbacks.c +++ b/src/dbus_api/modest-dbus-callbacks.c @@ -1206,32 +1206,30 @@ on_idle_open_account (gpointer user_data) top = modest_window_mgr_show_initial_window (mgr); #ifdef MODEST_TOOLKIT_HILDON2 - if (MODEST_IS_ACCOUNTS_WINDOW (top)) { - GtkWidget *new_window; - ModestProtocolType store_protocol; - gboolean mailboxes_protocol; - - store_protocol = modest_account_mgr_get_store_protocol (modest_runtime_get_account_mgr (), - acc_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 (acc_name)); - } else { - new_window = GTK_WIDGET (modest_folder_window_new (NULL)); - modest_folder_window_set_account (MODEST_FOLDER_WINDOW (new_window), - acc_name); - } + GtkWidget *new_window; + ModestProtocolType store_protocol; + gboolean mailboxes_protocol; + + store_protocol = modest_account_mgr_get_store_protocol (modest_runtime_get_account_mgr (), + acc_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 (acc_name)); + } else { + new_window = GTK_WIDGET (modest_folder_window_new (NULL)); + modest_folder_window_set_account (MODEST_FOLDER_WINDOW (new_window), + acc_name); + } - if (modest_window_mgr_register_window (mgr, MODEST_WINDOW (new_window), NULL)) { - gtk_widget_show (new_window); - } else { - gtk_widget_destroy (new_window); - new_window = NULL; - } + if (modest_window_mgr_register_window (mgr, MODEST_WINDOW (new_window), NULL)) { + gtk_widget_show (new_window); + } else { + gtk_widget_destroy (new_window); + new_window = NULL; } #else if (MODEST_IS_MAIN_WINDOW (top)) { diff --git a/src/hildon2/modest-hildon2-window-mgr.c b/src/hildon2/modest-hildon2-window-mgr.c index 21f35e8..0e1d8d4 100644 --- a/src/hildon2/modest-hildon2-window-mgr.c +++ b/src/hildon2/modest-hildon2-window-mgr.c @@ -523,17 +523,24 @@ modest_hildon2_window_mgr_register_window (ModestWindowMgr *self, if ((MODEST_IS_MSG_VIEW_WINDOW (current_top) || MODEST_IS_MSG_EDIT_WINDOW (current_top)) && (MODEST_IS_FOLDER_WINDOW (window) || MODEST_IS_ACCOUNTS_WINDOW (window) || MODEST_IS_MAILBOXES_WINDOW (window))) { - gtk_window_present (GTK_WINDOW (window)); + gtk_window_present (GTK_WINDOW (current_top)); return FALSE; } if (MODEST_IS_FOLDER_WINDOW (current_top) && MODEST_IS_FOLDER_WINDOW (window)) { - gtk_window_present (GTK_WINDOW (window)); - return FALSE; + gboolean retval; + + g_signal_emit_by_name (G_OBJECT (current_top), "delete-event", NULL, &retval); + + if (retval) { + gtk_window_present (GTK_WINDOW (current_top)); + return FALSE; + } + current_top = (ModestWindow *) hildon_window_stack_peek (stack); } if (MODEST_IS_MAILBOXES_WINDOW (current_top) && MODEST_IS_MAILBOXES_WINDOW (window)) { - gtk_window_present (GTK_WINDOW (window)); + gtk_window_present (GTK_WINDOW (current_top)); return FALSE; } @@ -585,7 +592,7 @@ modest_hildon2_window_mgr_register_window (ModestWindowMgr *self, /* Close the current view */ g_signal_emit_by_name (G_OBJECT (current_top), "delete-event", NULL, &retval); - if (retval == TRUE) { + if (retval) { /* Cancelled closing top window, then we fail to register */ goto fail; } -- 1.7.9.5