Add methods to get and retrieve list of custom header pairs in editor
authorJosé Dapena Paz <jdapena@igalia.com>
Wed, 27 Jan 2010 15:04:54 +0000 (16:04 +0100)
committerJosé Dapena Paz <jdapena@igalia.com>
Wed, 27 Jan 2010 15:32:48 +0000 (16:32 +0100)
src/hildon2/modest-msg-edit-window.c
src/widgets/modest-msg-edit-window.h

index 9f9a6ec..e384845 100644 (file)
@@ -332,6 +332,8 @@ struct _ModestMsgEditWindowPrivate {
        GtkWidget   *brand_icon;
        GtkWidget   *brand_label;
        GtkWidget   *brand_container;
+
+       TnyList     *custom_header_pairs;
 };
 
 #define MODEST_MSG_EDIT_WINDOW_GET_PRIVATE(o)      (G_TYPE_INSTANCE_GET_PRIVATE((o), \
@@ -456,6 +458,7 @@ modest_msg_edit_window_init (ModestMsgEditWindow *obj)
        priv->references = NULL;
        priv->in_reply_to = NULL;
        priv->max_chars_banner = NULL;
+       priv->custom_header_pairs = TNY_LIST (tny_simple_list_new ());
 
        if (!is_wp_text_buffer_started) {
                is_wp_text_buffer_started = TRUE;
@@ -1064,6 +1067,8 @@ modest_msg_edit_window_finalize (GObject *obj)
 {
        ModestMsgEditWindowPrivate *priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE (obj);
 
+       g_object_unref (priv->custom_header_pairs);
+
        if (priv->max_chars_banner) {
                g_object_weak_unref (G_OBJECT (priv->max_chars_banner), (GWeakNotify) max_chars_banner_unref, obj);
                priv->max_chars_banner = FALSE;
@@ -1873,6 +1878,7 @@ modest_msg_edit_window_get_msg_data (ModestMsgEditWindow *edit_window)
        g_object_unref (att_iter);
        
        data->priority_flags = priv->priority_flags;
+       data->custom_header_pairs = tny_list_copy (priv->custom_header_pairs);
 
        return data;
 }
@@ -1905,6 +1911,8 @@ modest_msg_edit_window_free_msg_data (ModestMsgEditWindow *edit_window,
        g_free (data->account_name);
        g_free (data->references);
        g_free (data->in_reply_to);
+
+       g_object_unref (data->custom_header_pairs);
        
        if (data->draft_msg != NULL) {
                g_object_unref (data->draft_msg);
@@ -4589,3 +4597,17 @@ modest_msg_edit_window_has_pending_addresses (ModestMsgEditWindow *self)
        else
                return TRUE;
 }
+
+void
+modest_msg_edit_window_set_custom_header_pairs (ModestMsgEditWindow *self,
+                                               TnyList *header_pairs)
+{
+       ModestMsgEditWindowPrivate *priv = NULL;
+
+       g_return_if_fail (MODEST_IS_MSG_EDIT_WINDOW (self));
+       g_return_if_fail (TNY_IS_LIST (header_pairs));
+
+       priv = MODEST_MSG_EDIT_WINDOW_GET_PRIVATE (self);
+       g_object_unref (priv->custom_header_pairs);
+       priv->custom_header_pairs = tny_list_copy (header_pairs);
+}
index 14c113b..dd022aa 100644 (file)
@@ -103,6 +103,7 @@ typedef struct  {
        TnyHeaderFlags priority_flags;
        TnyMsg *draft_msg;
        gchar *account_name;
+       TnyList *custom_header_pairs;
 } MsgData;
 
 typedef struct {
@@ -489,6 +490,18 @@ modest_msg_edit_window_get_child_widget (ModestMsgEditWindow *win,
 const gchar *
 modest_msg_edit_window_get_clipboard_text (ModestMsgEditWindow *win);
 
+/**
+ * modest_msg_edit_window_set_custom_header_pairs:
+ * @win: a #ModestMsgEditWindow
+ * @header_pairs: a #TnyList of #TnyPair
+ *
+ * sets a list of custom header pairs that will be added to the created
+ * #TnyMsg.
+ */
+void
+modest_msg_edit_window_set_custom_header_pairs (ModestMsgEditWindow *self,
+                                               TnyList *header_pairs);
+
 G_END_DECLS
 
 #endif /* __MODEST_MSG_EDIT_WINDOW_H__ */