X-Git-Url: http://git.maemo.org/git/?a=blobdiff_plain;f=src%2Fwidgets%2Fmodest-hildon1-window-mgr.c;h=629b7c8c237ea399b2be94ebfeb11d024d0786d0;hb=85b45045c6b46f9a8e3f2e4b5d5500be17892e42;hp=01a2434117a813fde98390d1dcd3b50decdfafbf;hpb=0665dc4b8ea24124da9764016328e2fb9efe11de;p=modest diff --git a/src/widgets/modest-hildon1-window-mgr.c b/src/widgets/modest-hildon1-window-mgr.c index 01a2434..629b7c8 100644 --- a/src/widgets/modest-hildon1-window-mgr.c +++ b/src/widgets/modest-hildon1-window-mgr.c @@ -83,9 +83,13 @@ static void modest_hildon1_window_mgr_set_modal (ModestWindowMgr *self, static gboolean modest_hildon1_window_mgr_find_registered_header (ModestWindowMgr *self, TnyHeader *header, ModestWindow **win); +static gboolean modest_hildon1_window_mgr_find_registered_message_uid (ModestWindowMgr *self, + const gchar *msg_uid, + ModestWindow **win); static GList *modest_hildon1_window_mgr_get_window_list (ModestWindowMgr *self); static gboolean modest_hildon1_window_mgr_close_all_windows (ModestWindowMgr *self); static ModestWindow *modest_hildon1_window_mgr_get_current_top (ModestWindowMgr *self); +static gboolean modest_hildon1_window_mgr_screen_is_on (ModestWindowMgr *self); typedef struct _ModestHildon1WindowMgrPrivate ModestHildon1WindowMgrPrivate; struct _ModestHildon1WindowMgrPrivate { @@ -154,9 +158,11 @@ modest_hildon1_window_mgr_class_init (ModestHildon1WindowMgrClass *klass) mgr_class->get_modal = modest_hildon1_window_mgr_get_modal; mgr_class->set_modal = modest_hildon1_window_mgr_set_modal; mgr_class->find_registered_header = modest_hildon1_window_mgr_find_registered_header; + mgr_class->find_registered_message_uid = modest_hildon1_window_mgr_find_registered_message_uid; mgr_class->get_window_list = modest_hildon1_window_mgr_get_window_list; mgr_class->close_all_windows = modest_hildon1_window_mgr_close_all_windows; mgr_class->get_current_top = modest_hildon1_window_mgr_get_current_top; + mgr_class->screen_is_on = modest_hildon1_window_mgr_screen_is_on; g_type_class_add_private (gobject_class, sizeof(ModestHildon1WindowMgrPrivate)); @@ -334,6 +340,38 @@ modest_hildon1_window_mgr_find_registered_header (ModestWindowMgr *self, TnyHead return has_header || has_window; } +static gboolean +modest_hildon1_window_mgr_find_registered_message_uid (ModestWindowMgr *self, const gchar *msg_uid, + ModestWindow **win) +{ + ModestHildon1WindowMgrPrivate *priv = NULL; + gboolean has_header, has_window = FALSE; + GList *item = NULL; + + g_return_val_if_fail (MODEST_IS_HILDON1_WINDOW_MGR (self), FALSE); + g_return_val_if_fail (msg_uid && msg_uid[0] != '\0', FALSE); + + priv = MODEST_HILDON1_WINDOW_MGR_GET_PRIVATE (self); + + has_header = MODEST_WINDOW_MGR_CLASS (parent_class)->find_registered_message_uid (self, msg_uid, win); + + item = g_list_find_custom (priv->window_list, msg_uid, (GCompareFunc) compare_msguids); + if (item) { + has_window = TRUE; + if (win) { + if ((!MODEST_IS_MSG_VIEW_WINDOW(item->data)) && + (!MODEST_IS_MSG_EDIT_WINDOW (item->data))) + g_debug ("not a valid window!"); + else { + g_debug ("found a window"); + *win = MODEST_WINDOW (item->data); + } + } + } + + return has_header || has_window; +} + static GList * modest_hildon1_window_mgr_get_window_list (ModestWindowMgr *self) { @@ -642,7 +680,7 @@ modest_hildon1_window_mgr_unregister_window (ModestWindowMgr *self, win = g_list_find (priv->window_list, window); if (!win) { - g_warning ("Trying to unregister a window that has not being registered yet"); + g_debug ("Trying to unregister a window that has not being registered yet"); return; } @@ -966,7 +1004,7 @@ remove_modal_from_queue (GtkWidget *widget, g_mutex_lock (priv->queue_lock); item = g_queue_find (priv->modal_windows, widget); if (!item) { - g_warning ("Trying to remove a modal window that is not registered"); + g_debug ("Trying to remove a modal window that is not registered"); g_mutex_unlock (priv->queue_lock); return; } @@ -1036,3 +1074,19 @@ modest_hildon1_window_mgr_get_current_top (ModestWindowMgr *self) return priv->current_top; } + +static gboolean +modest_hildon1_window_mgr_screen_is_on (ModestWindowMgr *self) +{ + ModestHildon1WindowMgrPrivate *priv; + ModestWindow *main_window; + + priv = MODEST_HILDON1_WINDOW_MGR_GET_PRIVATE (self); + + main_window = modest_window_mgr_get_main_window (self, FALSE); + if (main_window && MODEST_IS_MAIN_WINDOW (main_window)) { + return modest_main_window_screen_is_on (MODEST_MAIN_WINDOW (main_window)); + } else { + return TRUE; + } +}