X-Git-Url: http://git.maemo.org/git/?a=blobdiff_plain;f=src%2Fwidgets%2Fmodest-window-mgr.c;h=e750488965e205960aad5f4eed99d7c57c8f370f;hb=1582b0d179634d2e877641f8bd7e18ce1698ef52;hp=56ddbf92b94504faa4396494230794d23b8e7e1d;hpb=15653b82b80a0905f45315e241e525b1b6524a4a;p=modest diff --git a/src/widgets/modest-window-mgr.c b/src/widgets/modest-window-mgr.c index 56ddbf9..e750488 100644 --- a/src/widgets/modest-window-mgr.c +++ b/src/widgets/modest-window-mgr.c @@ -33,6 +33,7 @@ #include "modest-tny-folder.h" #include "modest-ui-actions.h" #include "modest-platform.h" +#include "modest-defs.h" #include "widgets/modest-main-window.h" #include "widgets/modest-msg-edit-window.h" #include "widgets/modest-msg-view-window.h" @@ -483,7 +484,10 @@ modest_window_mgr_find_registered_header_default (ModestWindowMgr *self, TnyHead uid = modest_tny_folder_get_header_unique_id (header); - return modest_window_mgr_find_registered_message_uid (self, uid, win); + if (uid) + return modest_window_mgr_find_registered_message_uid (self, uid, win); + else + return FALSE; } gboolean @@ -532,6 +536,19 @@ modest_window_mgr_register_window (ModestWindowMgr *self, ModestWindow *window, ModestWindow *parent) { + /* If this is the first registered window then reset the + status of the TnyDevice as it might be forced to be offline + when modest is running in the background (see + modest_tny_account_store_new() and automatic updates are + disabled*/ + if (modest_window_mgr_get_num_windows (self) == 0) { + gboolean auto_update; + auto_update = modest_conf_get_bool (modest_runtime_get_conf (), + MODEST_CONF_AUTO_UPDATE, NULL); + if (!auto_update) + tny_device_reset (modest_runtime_get_device ()); + } + return MODEST_WINDOW_MGR_GET_CLASS (self)->register_window (self, window, parent); }