From 80c0cf4c55ca0c28f02c17ece8e5a6d3232c7d8a Mon Sep 17 00:00:00 2001 From: Murray Cumming Date: Thu, 26 Jul 2007 07:33:06 +0000 Subject: [PATCH] 2007-07-26 Murray Cumming * src/modest-ui-actions.h: * src/modest-ui-actions.c: Added modest_do_refresh_current_folder() containing some code from modest_ui_actions_on_send_receive(). * src/dbus_api/modest-dbus-callbacks.c: (on_idle_send_receive): Call modest_do_refresh_current_folder() before refreshing the requested account, as in modest_ui_actions_on_send_receive(). This is strange, but seems to be necessary to show new mails. Now new emails are finally visible in the UI when downloaded via the automatic update interval, fixing bug NB#57458. This also works because bug NB#57458 has been fixed somehow. pmo-trunk-r2798 --- ChangeLog2 | 14 ++++++++++++++ src/dbus_api/modest-dbus-callbacks.c | 9 +++++++-- src/modest-ui-actions.c | 35 ++++++++++++++++++++-------------- src/modest-ui-actions.h | 3 +++ 4 files changed, 45 insertions(+), 16 deletions(-) diff --git a/ChangeLog2 b/ChangeLog2 index e15da88..37b01ad 100644 --- a/ChangeLog2 +++ b/ChangeLog2 @@ -1,5 +1,19 @@ 2007-07-26 Murray Cumming + * src/modest-ui-actions.h: + * src/modest-ui-actions.c: Added + modest_do_refresh_current_folder() containing some code from + modest_ui_actions_on_send_receive(). + * src/dbus_api/modest-dbus-callbacks.c: (on_idle_send_receive): + Call modest_do_refresh_current_folder() before refreshing the + requested account, as in modest_ui_actions_on_send_receive(). + This is strange, but seems to be necessary to show new mails. + Now new emails are finally visible in the UI when downloaded + via the automatic update interval, fixing bug NB#57458. + This also works because bug NB#57458 has been fixed somehow. + +2007-07-26 Murray Cumming + * src/dbus_api/modest-dbus-callbacks.c: (modest_dbus_req_filter): printf more details when we get unhandled D-Bus methods, because it is interesting. diff --git a/src/dbus_api/modest-dbus-callbacks.c b/src/dbus_api/modest-dbus-callbacks.c index 5a977de..6ab191d 100644 --- a/src/dbus_api/modest-dbus-callbacks.c +++ b/src/dbus_api/modest-dbus-callbacks.c @@ -807,6 +807,11 @@ on_idle_send_receive(gpointer user_data) /* Pick the main window if it exists */ win = modest_window_mgr_get_main_window (modest_runtime_get_window_mgr ()); + /* This seems to be necessary to show new messages in the current window. + * I would expect this to be after the send_receive, but maybe + * this makes a connection too. murrayc. */ + modest_do_refresh_current_folder (win); + /* Send & receive all if "Update automatically" is set */ /* TODO: check the auto-update parameter in the configuration */ modest_ui_actions_do_send_receive_all (win); @@ -1391,7 +1396,6 @@ modest_dbus_req_filter (DBusConnection *con, DBusMessage *message, void *user_data) { - printf ("DEBUG: %s\n", __FUNCTION__); gboolean handled = FALSE; if (dbus_message_is_method_call (message, @@ -1408,7 +1412,8 @@ modest_dbus_req_filter (DBusConnection *con, handled = TRUE; } else { - g_debug (" debug: %s: Unexpected D-Bus method: Interface=%s, Member=%s\n", + /* Note that this mentions methods that were already handled in modest_dbus_req_handler(). */ + g_debug (" debug: %s: Unexpected (maybe already handled) D-Bus method:\n Interface=%s, Member=%s\n", __FUNCTION__, dbus_message_get_interface (message), dbus_message_get_member(message)); } diff --git a/src/modest-ui-actions.c b/src/modest-ui-actions.c index 46e99ef..e13fe00 100644 --- a/src/modest-ui-actions.c +++ b/src/modest-ui-actions.c @@ -1483,22 +1483,11 @@ modest_ui_actions_do_send_receive_all (ModestWindow *win) account_names = NULL; } -/* - * Handler of the click on Send&Receive button in the main toolbar - */ -void -modest_ui_actions_on_send_receive (GtkAction *action, ModestWindow *win) +void +modest_do_refresh_current_folder(ModestWindow *win) { - /* Check if accounts exist */ - gboolean accounts_exist = - modest_account_mgr_has_accounts(modest_runtime_get_account_mgr(), TRUE); - - /* If not, allow the user to create an account before trying to send/receive. */ - if (!accounts_exist) - modest_ui_actions_on_accounts (NULL, win); - /* Refresh currently selected folder. Note that if we only - want to retrive the headers, then the refresh only will + want to retreive the headers, then the refresh only will invoke a poke_status over all folders, i.e., only the total/unread count will be updated */ if (MODEST_IS_MAIN_WINDOW (win)) { @@ -1530,6 +1519,24 @@ modest_ui_actions_on_send_receive (GtkAction *action, ModestWindow *win) if (folder_store) g_object_unref (folder_store); } +} + + +/* + * Handler of the click on Send&Receive button in the main toolbar + */ +void +modest_ui_actions_on_send_receive (GtkAction *action, ModestWindow *win) +{ + /* Check if accounts exist */ + gboolean accounts_exist = + modest_account_mgr_has_accounts(modest_runtime_get_account_mgr(), TRUE); + + /* If not, allow the user to create an account before trying to send/receive. */ + if (!accounts_exist) + modest_ui_actions_on_accounts (NULL, win); + + modest_do_refresh_current_folder (win); /* Refresh the active account */ modest_ui_actions_do_send_receive (NULL, win); diff --git a/src/modest-ui-actions.h b/src/modest-ui-actions.h index e20b93a..d6af486 100644 --- a/src/modest-ui-actions.h +++ b/src/modest-ui-actions.h @@ -213,6 +213,9 @@ void modest_ui_actions_do_send_receive_all (ModestWindow *win); void modest_ui_actions_do_send_receive (const gchar *account_name, ModestWindow *win); +void +modest_do_refresh_current_folder(ModestWindow *win); + /** * modest_ui_actions_on_send_receive: * @action: a #GtkAction -- 1.7.9.5