Added the function that quotes emails
[modest] / src / widgets / modest-hildon1-window-mgr.c
index 2a56f3b..629b7c8 100644 (file)
@@ -83,6 +83,9 @@ 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);
@@ -155,6 +158,7 @@ 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;
@@ -336,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)
 {
@@ -644,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;
        }
 
@@ -968,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;
        }