guint queue_change_handler;
guint progress_bar_timeout;
+
+ gchar *msg_uid;
};
#define MODEST_MSG_VIEW_WINDOW_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), \
priv->optimized_view = FALSE;
priv->progress_bar_timeout = 0;
+ priv->msg_uid = NULL;
}
priv->row_reference = NULL;
}
+ if (priv->msg_uid) {
+ g_free (priv->msg_uid);
+ priv->msg_uid = NULL;
+ }
+
G_OBJECT_CLASS(parent_class)->finalize (obj);
}
}
ModestWindow *
-modest_msg_view_window_new_with_header_model (TnyMsg *msg, const gchar *account_name,
- GtkTreeModel *model, GtkTreeRowReference *row_reference)
+modest_msg_view_window_new_with_header_model (TnyMsg *msg,
+ const gchar *account_name,
+ const gchar *msg_uid,
+ GtkTreeModel *model,
+ GtkTreeRowReference *row_reference)
{
ModestMsgViewWindow *window = NULL;
ModestMsgViewWindowPrivate *priv = NULL;
- window = MODEST_MSG_VIEW_WINDOW(modest_msg_view_window_new (msg, account_name));
+ window = MODEST_MSG_VIEW_WINDOW(modest_msg_view_window_new (msg, account_name, msg_uid));
g_return_val_if_fail (MODEST_IS_MSG_VIEW_WINDOW (window), NULL);
priv = MODEST_MSG_VIEW_WINDOW_GET_PRIVATE (window);
ModestWindow *
-modest_msg_view_window_new (TnyMsg *msg, const gchar *account_name)
+modest_msg_view_window_new (TnyMsg *msg,
+ const gchar *account_name,
+ const gchar *msg_uid)
{
ModestMsgViewWindow *self = NULL;
GObject *obj = NULL;
parent_priv = MODEST_WINDOW_GET_PRIVATE(obj);
self = MODEST_MSG_VIEW_WINDOW (obj);
+ priv->msg_uid = g_strdup (msg_uid);
+
parent_priv->ui_manager = gtk_ui_manager_new();
parent_priv->ui_dimming_manager = modest_ui_dimming_manager_new();
const gchar*
modest_msg_view_window_get_message_uid (ModestMsgViewWindow *self)
{
- TnyMsg *msg;
- TnyHeader *header;
- const gchar *retval = NULL;
-
- msg = modest_msg_view_window_get_message (self);
-
- if (!msg)
- return NULL;
-
- header = tny_msg_get_header (msg);
- if (header) {
- retval = tny_header_get_uid (header);
- g_object_unref (header);
- }
- g_object_unref (msg);
-
- return retval;
+ ModestMsgViewWindowPrivate *priv = MODEST_MSG_VIEW_WINDOW_GET_PRIVATE (self);
+ return (const gchar*) priv->msg_uid;
}
static void
/* message attachment */
TnyHeader *header = NULL;
ModestWindowMgr *mgr;
- ModestWindow *msg_win;
+ ModestWindow *msg_win = NULL;
header = tny_msg_get_header (TNY_MSG (mime_part));
mgr = modest_runtime_get_window_mgr ();
- /* TODO: this is not getting any uid */
- msg_win = modest_window_mgr_find_window_by_msguid (mgr, tny_header_get_uid (header));
+ msg_win = modest_window_mgr_find_window_by_header (mgr, header);
if (!msg_win) {
gchar *account = g_strdup (modest_window_get_active_account (MODEST_WINDOW (window)));
if (!account)
account = modest_account_mgr_get_default_account (modest_runtime_get_account_mgr ());
- msg_win = modest_msg_view_window_new (TNY_MSG (mime_part), account);
+ msg_win = modest_msg_view_window_new (TNY_MSG (mime_part), account, NULL);
modest_window_mgr_register_window (mgr, msg_win);
gtk_window_set_transient_for (GTK_WINDOW (msg_win), GTK_WINDOW (window));
}