X-Git-Url: http://git.maemo.org/git/?p=modest;a=blobdiff_plain;f=src%2Fdbus_api%2Fmodest-dbus-callbacks.c;h=f0a50bd65416bbc16d28c648fc77d072f92e4a20;hp=adf3f5a8e2f9ff4e3184651ef2d6ff2da2247194;hb=3c12fc77bb22e81dcb3d3b20926ebc7a5dee4f42;hpb=24316ebf63212f185e7f6bf70a0e04f3f52e0fa4 diff --git a/src/dbus_api/modest-dbus-callbacks.c b/src/dbus_api/modest-dbus-callbacks.c index adf3f5a..f0a50bd 100644 --- a/src/dbus_api/modest-dbus-callbacks.c +++ b/src/dbus_api/modest-dbus-callbacks.c @@ -38,6 +38,7 @@ #include "modest-debug.h" #include "modest-search.h" #include "widgets/modest-msg-edit-window.h" +#include "widgets/modest-window-mgr.h" #include "modest-tny-msg.h" #include "modest-platform.h" #include "modest-defs.h" @@ -627,7 +628,8 @@ on_open_message_performer (gboolean canceled, gtk_widget_show_all (GTK_WIDGET (msg_view)); } } - g_object_unref (account); + if (account) + g_object_unref (account); } on_find_msg_async_destroy (info); @@ -923,9 +925,6 @@ static gboolean on_idle_send_receive(gpointer user_data) { gboolean auto_update; - ModestWindow *top_win = NULL; - - top_win = modest_window_mgr_get_current_top (modest_runtime_get_window_mgr ()); gdk_threads_enter (); /* CHECKED */ @@ -934,8 +933,10 @@ on_idle_send_receive(gpointer user_data) MODEST_CONF_AUTO_UPDATE, NULL); if (auto_update) - /* Do send receive */ - modest_ui_actions_do_send_receive_all (top_win, FALSE, FALSE, FALSE); + /* Do send receive. Never set the current top window + as we always assume that DBus send/receive requests + are not user driven */ + modest_ui_actions_do_send_receive_all (NULL, FALSE, FALSE, FALSE); else /* Disable auto update */ modest_platform_set_update_interval (0); @@ -1207,32 +1208,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)) { @@ -1371,18 +1370,38 @@ on_idle_show_memory_low (gpointer user_data) return FALSE; } +static gboolean +on_idle_present_modal (gpointer user_data) +{ + gdk_threads_enter (); + gtk_window_present (user_data); + gdk_threads_leave (); + + return FALSE; +} + + /* Callback for normal D-BUS messages */ gint modest_dbus_req_handler(const gchar * interface, const gchar * method, GArray * arguments, gpointer data, osso_rpc_t * retval) { + GtkWindow *dialog; + /* Check memory low conditions */ if (modest_platform_check_memory_low (NULL, FALSE)) { g_idle_add (on_idle_show_memory_low, NULL); goto param_error; } + /* Check if there is already a dialog or note open */ + dialog = modest_window_mgr_get_modal (modest_runtime_get_window_mgr()); + if (dialog) { + g_idle_add (on_idle_present_modal, dialog); + return OSSO_OK; + } + if (g_ascii_strcasecmp (method, MODEST_DBUS_METHOD_MAIL_TO) == 0) { if (arguments->len != MODEST_DBUS_MAIL_TO_ARGS_COUNT) goto param_error; @@ -1433,7 +1452,7 @@ modest_dbus_req_handler(const gchar * interface, const gchar * method, g_idle_add (notify_error_in_dbus_callback, NULL); return OSSO_ERROR; } - + /* A complex D-Bus type (like a struct), * used to return various information about a search hit. */