#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"
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
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);
}
const gchar *uid = modest_msg_view_window_get_message_uid
(MODEST_MSG_VIEW_WINDOW (window));
- if (!has_uid (priv->preregistered_uids, uid))
- g_debug ("weird: no uid for window (%s)", uid);
-
MODEST_DEBUG_BLOCK(g_debug ("registering window for %s", uid ? uid : "<none>"););
- priv->preregistered_uids =
- remove_uid (priv->preregistered_uids,
- modest_msg_view_window_get_message_uid
- (MODEST_MSG_VIEW_WINDOW (window)));
+ if (has_uid (priv->preregistered_uids, uid)) {
+ priv->preregistered_uids =
+ remove_uid (priv->preregistered_uids,
+ modest_msg_view_window_get_message_uid
+ (MODEST_MSG_VIEW_WINDOW (window)));
+ }
} else if (MODEST_IS_MSG_EDIT_WINDOW(window)) {
const gchar *uid = modest_msg_edit_window_get_message_uid
(MODEST_MSG_EDIT_WINDOW (window));