* Dim the "Move to" icon and menu entry when a message is
[modest] / src / gnome / modest-msg-view-window.c
index c7a0bc6..68fe792 100644 (file)
@@ -57,6 +57,8 @@ struct _ModestMsgViewWindowPrivate {
        GtkWidget   *toolbar;
        GtkWidget   *menubar;
        GtkWidget   *msg_view;
+
+       gchar *msg_uid;
 };
 
 #define MODEST_MSG_VIEW_WINDOW_GET_PRIVATE(o)      (G_TYPE_INSTANCE_GET_PRIVATE((o), \
@@ -160,9 +162,10 @@ modest_msg_view_window_init (ModestMsgViewWindow *obj)
        ModestMsgViewWindowPrivate *priv;
        priv = MODEST_MSG_VIEW_WINDOW_GET_PRIVATE(obj);
 
-       priv->toolbar       = NULL;
-       priv->menubar       = NULL;
-       priv->msg_view      = NULL;
+       priv->toolbar  = NULL;
+       priv->menubar  = NULL;
+       priv->msg_view = NULL;
+       priv->msg_uid  = NULL;
 }
 
 
@@ -195,7 +198,16 @@ init_window (ModestMsgViewWindow *obj, TnyMsg *msg)
 
 static void
 modest_msg_view_window_finalize (GObject *obj)
-{      
+{
+       ModestMsgViewWindowPrivate *priv;
+
+       priv = MODEST_MSG_VIEW_WINDOW_GET_PRIVATE(obj);
+
+       if (priv->msg_uid) {
+               g_free (priv->msg_uid);
+               msg_uid = NULL;
+       }
+
        G_OBJECT_CLASS(parent_class)->finalize (obj);
 }
 
@@ -210,7 +222,9 @@ on_delete_event (GtkWidget *widget, GdkEvent *event, ModestMsgViewWindow *self)
 
 
 ModestWindow *
-modest_msg_view_window_new (TnyMsg *msg, const gchar *account)
+modest_msg_view_window_new_for_attachment (TnyMsg *msg, 
+                           const gchar *modest_account_name, 
+                           const gchar *msg_uid)
 {
        GObject *obj;
        ModestMsgViewWindowPrivate *priv;
@@ -226,6 +240,8 @@ modest_msg_view_window_new (TnyMsg *msg, const gchar *account)
        priv = MODEST_MSG_VIEW_WINDOW_GET_PRIVATE(obj);
        parent_priv = MODEST_WINDOW_GET_PRIVATE(obj);
 
+       priv->msg_uid = g_strdup (msg_uid);
+
        modest_window_set_active_account (MODEST_WINDOW(obj), account);
        
        parent_priv->ui_manager = gtk_ui_manager_new();
@@ -313,12 +329,15 @@ modest_msg_view_window_get_message_uid (ModestMsgViewWindow *self)
                retval = tny_header_get_uid (header);
                g_object_unref (header);
        }
+       g_object_unref (msg);
+
        return retval;
 }
 
 ModestWindow*   
 modest_msg_view_window_new_with_header_model (TnyMsg *msg, 
-                                             const gchar *account, 
+                                             const gchar *modest_account_name, 
+                                             const gchar *msg_uid,
                                              GtkTreeModel *model, 
                                              GtkTreeRowReference *row_reference)
 {
@@ -327,7 +346,7 @@ modest_msg_view_window_new_with_header_model (TnyMsg *msg,
           actions */
        g_message ("partially implemented %s", __FUNCTION__);
 
-       return modest_msg_view_window_new (msg, account);
+       return modest_msg_view_window_new_for_attachment (msg, account);
 }