From e53ed3f6657ffee69d5b5f64692518a63c6df3b4 Mon Sep 17 00:00:00 2001 From: Sergio Villar Senin Date: Thu, 29 Jan 2009 11:14:39 +0000 Subject: [PATCH] Removed some dependencies with main window pmo-trunk-r7344 --- src/dbus_api/modest-dbus-callbacks.c | 29 ++++++++++++++--------------- src/hildon2/modest-folder-window.c | 1 + src/hildon2/modest-msg-view-window.c | 6 +++--- src/modest-tny-account-store.c | 19 ++++++++----------- src/modest-ui-actions.c | 12 ++++++++---- src/modest-ui-dimming-rules.c | 6 +++--- 6 files changed, 37 insertions(+), 36 deletions(-) diff --git a/src/dbus_api/modest-dbus-callbacks.c b/src/dbus_api/modest-dbus-callbacks.c index d8d2abb..8f037cc 100644 --- a/src/dbus_api/modest-dbus-callbacks.c +++ b/src/dbus_api/modest-dbus-callbacks.c @@ -611,19 +611,20 @@ on_open_message_performer (gboolean canceled, static gboolean on_idle_open_message_performer (gpointer user_data) { - ModestWindow *main_win = NULL; + ModestWindow *top_win = NULL; OpenMsgPerformerInfo *info = (OpenMsgPerformerInfo *) user_data; - main_win = modest_window_mgr_get_main_window (modest_runtime_get_window_mgr(), - FALSE); /* don't create */ + top_win = modest_window_mgr_get_current_top (modest_runtime_get_window_mgr()); /* Lock before the call as we're in an idle handler */ gdk_threads_enter (); if (info->connect) { - modest_platform_connect_and_perform (GTK_WINDOW (main_win), TRUE, info->account, + modest_platform_connect_and_perform (GTK_WINDOW (top_win), TRUE, + info->account, on_open_message_performer, info); } else { - on_open_message_performer (FALSE, NULL, GTK_WINDOW (main_win), info->account, info); + on_open_message_performer (FALSE, NULL, GTK_WINDOW (top_win), + info->account, info); } gdk_threads_leave (); @@ -718,14 +719,13 @@ on_remove_msgs_finished (ModestMailOperation *mail_op, gpointer user_data) { TnyHeader *header; - ModestWindow *main_win = NULL, *msg_view = NULL; + ModestWindow *top_win = NULL, *msg_view = NULL; header = (TnyHeader *) user_data; /* Get the main window if exists */ - main_win = modest_window_mgr_get_main_window (modest_runtime_get_window_mgr(), - FALSE); /* don't create */ - if (!main_win) { + top_win = modest_window_mgr_get_current_top (modest_runtime_get_window_mgr()); + if (!top_win) { g_object_unref (header); return; } @@ -755,7 +755,7 @@ thread_prepare_delete_message (gpointer userdata) char *uri; gchar *uid = NULL; ModestMailOperation *mail_op = NULL; - ModestWindow *main_win = NULL; + ModestWindow *top_win = NULL; uri = (char *) userdata; @@ -769,10 +769,9 @@ thread_prepare_delete_message (gpointer userdata) g_free (uri); return FALSE; } - - main_win = modest_window_mgr_get_main_window (modest_runtime_get_window_mgr(), - FALSE); /* don't create */ - + + top_win = modest_window_mgr_get_current_top (modest_runtime_get_window_mgr()); + folder = tny_msg_get_folder (msg); if (!folder) { g_warning ("%s: Could not find folder (uri:'%s')", __FUNCTION__, uri); @@ -829,7 +828,7 @@ thread_prepare_delete_message (gpointer userdata) * the code below is or does Gtk+ code */ gdk_threads_enter (); /* CHECKED */ - mail_op = modest_mail_operation_new (main_win ? G_OBJECT(main_win) : NULL); + mail_op = modest_mail_operation_new (top_win ? G_OBJECT(top_win) : NULL); modest_mail_operation_queue_add (modest_runtime_get_mail_operation_queue (), mail_op); g_signal_connect (G_OBJECT (mail_op), diff --git a/src/hildon2/modest-folder-window.c b/src/hildon2/modest-folder-window.c index 1e02185..05be38f 100644 --- a/src/hildon2/modest-folder-window.c +++ b/src/hildon2/modest-folder-window.c @@ -380,6 +380,7 @@ static void setup_menu (ModestFolderWindow *self) NULL, APP_MENU_CALLBACK (modest_ui_actions_on_send_receive), MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_send_receive)); + modest_hildon2_window_add_to_menu (MODEST_HILDON2_WINDOW (self), _("mcen_me_outbox_cancelsend"), NULL, APP_MENU_CALLBACK (modest_ui_actions_cancel_send), MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_cancel_sending_all)); diff --git a/src/hildon2/modest-msg-view-window.c b/src/hildon2/modest-msg-view-window.c index 66df0c9..b2468ba 100644 --- a/src/hildon2/modest-msg-view-window.c +++ b/src/hildon2/modest-msg-view-window.c @@ -3129,21 +3129,21 @@ setup_menu (ModestMsgViewWindow *self) modest_hildon2_window_add_to_menu (MODEST_HILDON2_WINDOW (self), _("mcen_me_inbox_forward"), "d", APP_MENU_CALLBACK (modest_ui_actions_on_forward), MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_reply_msg)); - + modest_hildon2_window_add_to_menu (MODEST_HILDON2_WINDOW (self), _("mcen_me_inbox_mark_as_read"), NULL, APP_MENU_CALLBACK (modest_ui_actions_on_mark_as_read), MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_mark_as_read_msg_in_view)); modest_hildon2_window_add_to_menu (MODEST_HILDON2_WINDOW (self), _("mcen_me_inbox_mark_as_unread"), NULL, APP_MENU_CALLBACK (modest_ui_actions_on_mark_as_unread), MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_mark_as_unread_msg_in_view)); - + modest_hildon2_window_add_to_menu (MODEST_HILDON2_WINDOW (self), _("mcen_me_viewer_save_attachments"), NULL, APP_MENU_CALLBACK (modest_ui_actions_save_attachments), MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_save_attachments)); modest_hildon2_window_add_to_menu (MODEST_HILDON2_WINDOW (self), _("mcen_me_inbox_remove_attachments"), NULL, APP_MENU_CALLBACK (modest_ui_actions_remove_attachments), MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_remove_attachments)); - + modest_hildon2_window_add_to_menu (MODEST_HILDON2_WINDOW (self), _("mcen_me_new_message"), "n", APP_MENU_CALLBACK (modest_ui_actions_on_new_msg), MODEST_DIMMING_CALLBACK (modest_ui_dimming_rules_on_new_msg)); diff --git a/src/modest-tny-account-store.c b/src/modest-tny-account-store.c index af2598f..47e6b81 100644 --- a/src/modest-tny-account-store.c +++ b/src/modest-tny-account-store.c @@ -493,11 +493,8 @@ on_account_changed (ModestAccountMgr *acc_mgr, static void show_password_warning_only (const gchar *msg) { - ModestWindow *main_window = - modest_window_mgr_get_main_window (modest_runtime_get_window_mgr (), FALSE); /* don't create */ - /* Show an explanatory temporary banner: */ - if (main_window) + if (modest_window_mgr_get_num_windows (modest_runtime_get_window_mgr ())) modest_platform_information_banner (NULL, NULL, msg); } @@ -584,10 +581,10 @@ get_password (TnyAccount *account, const gchar * prompt_not_used, gboolean *canc __FUNCTION__, server_account_name ? server_account_name : ""); if (cancel) *cancel = TRUE; - + return NULL; } - + /* This hash map stores passwords, including passwords that are not stored in gconf. */ /* Is it in the hash? if it's already there, it must be wrong... */ pwd_ptr = (gpointer)&pwd; /* pwd_ptr so the compiler does not complained about @@ -600,7 +597,7 @@ get_password (TnyAccount *account, const gchar * prompt_not_used, gboolean *canc MODEST_DEBUG_BLOCK( g_debug ("%s: Already asked = %d\n", __FUNCTION__, already_asked); ); - + /* If the password is not already there, try ModestConf */ if (!already_asked) { pwd = modest_account_mgr_get_server_account_password (priv->account_mgr, @@ -657,18 +654,18 @@ get_password (TnyAccount *account, const gchar * prompt_not_used, gboolean *canc if (settings_have_password) { /* The password must be wrong, so show the account settings dialog so it can be corrected: */ show_wrong_password_dialog (account); - + if (cancel) *cancel = TRUE; - + return NULL; } - + /* we don't have it yet. Get the password from the user */ const gchar* account_id = tny_account_get_id (account); gboolean remember = FALSE; pwd = NULL; - + if (already_asked) { const gchar *msg; gboolean username_known = diff --git a/src/modest-ui-actions.c b/src/modest-ui-actions.c index b998952..aae883c 100644 --- a/src/modest-ui-actions.c +++ b/src/modest-ui-actions.c @@ -5805,14 +5805,15 @@ modest_ui_actions_on_move_to (GtkAction *action, gboolean modest_ui_actions_on_edit_mode_move_to (ModestWindow *win) { - GtkWidget *dialog = NULL, *folder_view = NULL; - ModestMainWindow *main_window; + GtkWidget *dialog = NULL; MoveToInfo *helper = NULL; TnyList *list_to_move; g_return_val_if_fail (MODEST_IS_WINDOW (win), FALSE); +#ifndef MODEST_TOOLKIT_HILDON2 /* Get the main window if exists */ + ModestMainWindow *main_window; if (MODEST_IS_MAIN_WINDOW (win)) main_window = MODEST_MAIN_WINDOW (win); else @@ -5826,6 +5827,7 @@ modest_ui_actions_on_edit_mode_move_to (ModestWindow *win) MODEST_MAIN_WINDOW_WIDGET_TYPE_FOLDER_VIEW); else folder_view = NULL; +#endif list_to_move = modest_platform_get_list_to_move (MODEST_WINDOW (win)); @@ -5838,14 +5840,14 @@ modest_ui_actions_on_edit_mode_move_to (ModestWindow *win) } /* Create and run the dialog */ - dialog = create_move_to_dialog (GTK_WINDOW (win), folder_view); + dialog = create_move_to_dialog (GTK_WINDOW (win), NULL); modest_window_mgr_set_modal (modest_runtime_get_window_mgr (), GTK_WINDOW (dialog), (GtkWindow *) win); /* Create helper */ helper = g_slice_new0 (MoveToInfo); - helper->list = modest_platform_get_list_to_move (MODEST_WINDOW (win)); + helper->list = list_to_move; helper->win = win; /* Listen to response signal */ @@ -6359,6 +6361,8 @@ modest_ui_actions_on_send_queue_status_changed (ModestTnySendQueue *send_queue, TnyFolderStore *selected_folder = NULL; TnyFolderType folder_type; + + /* TODO: this does not work in Fremantle */ mgr = modest_runtime_get_window_mgr (); main_window = MODEST_MAIN_WINDOW (modest_window_mgr_get_main_window (mgr, FALSE));/* don't create */ diff --git a/src/modest-ui-dimming-rules.c b/src/modest-ui-dimming-rules.c index 2857cf7..143a6f9 100644 --- a/src/modest-ui-dimming-rules.c +++ b/src/modest-ui-dimming-rules.c @@ -2903,12 +2903,12 @@ _msgs_send_in_progress (void) cache_mgr = modest_runtime_get_cache_mgr (); send_queue_cache = modest_cache_mgr_get_cache (cache_mgr, MODEST_CACHE_MGR_CACHE_TYPE_SEND_QUEUE); - + g_hash_table_foreach (send_queue_cache, (GHFunc) fill_list_of_caches, &send_queues); - + for (node = send_queues; node != NULL && !found; node = g_slist_next (node)) { send_queue = MODEST_TNY_SEND_QUEUE (node->data); - + /* Check if msg uid is being processed inside send queue */ if (modest_tny_send_queue_sending_in_progress (send_queue)) { found = TRUE; -- 1.7.9.5