diff options
Diffstat (limited to 'composer')
-rw-r--r-- | composer/e-composer-header-table.c | 54 | ||||
-rw-r--r-- | composer/e-composer-header-table.h | 7 | ||||
-rw-r--r-- | composer/e-composer-post-header.c | 63 | ||||
-rw-r--r-- | composer/e-composer-post-header.h | 12 | ||||
-rw-r--r-- | composer/e-composer-private.c | 10 | ||||
-rw-r--r-- | composer/e-msg-composer.c | 10 |
6 files changed, 144 insertions, 12 deletions
diff --git a/composer/e-composer-header-table.c b/composer/e-composer-header-table.c index d659e5290f..1954e92f47 100644 --- a/composer/e-composer-header-table.c +++ b/composer/e-composer-header-table.c @@ -80,6 +80,7 @@ enum { PROP_DESTINATIONS_BCC, PROP_DESTINATIONS_CC, PROP_DESTINATIONS_TO, + PROP_MODEL, PROP_POST_TO, PROP_REPLY_TO, PROP_SIGNATURE, @@ -92,6 +93,7 @@ struct _EComposerHeaderTablePrivate { GtkWidget *signature_label; GtkWidget *signature_combo_box; ENameSelector *name_selector; + EMFolderTreeModel *model; }; static gpointer parent_class; @@ -346,6 +348,12 @@ composer_header_table_set_property (GObject *object, e_destination_freev (destinations); return; + case PROP_MODEL: + e_composer_header_table_set_folder_tree_model ( + E_COMPOSER_HEADER_TABLE (object), + g_value_get_object (value)); + return; + case PROP_POST_TO: list = g_value_dup_string_list (value); e_composer_header_table_set_post_to_list ( @@ -437,6 +445,13 @@ composer_header_table_get_property (GObject *object, e_destination_freev (destinations); return; + case PROP_MODEL: + g_value_set_object ( + value, + e_composer_header_table_get_folder_tree_model ( + E_COMPOSER_HEADER_TABLE (object))); + return; + case PROP_POST_TO: list = e_composer_header_table_get_post_to ( E_COMPOSER_HEADER_TABLE (object)); @@ -502,6 +517,11 @@ composer_header_table_dispose (GObject *object) priv->name_selector = NULL; } + if (priv->model != NULL) { + g_object_unref (priv->model); + priv->model = NULL; + } + /* Chain up to parent's dispose() method. */ G_OBJECT_CLASS (parent_class)->dispose (object); } @@ -591,6 +611,17 @@ composer_header_table_class_init (EComposerHeaderTableClass *class) g_object_class_install_property ( object_class, + PROP_MODEL, + g_param_spec_object ( + "model", + NULL, + NULL, + EM_TYPE_FOLDER_TREE_MODEL, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT_ONLY)); + + g_object_class_install_property ( + object_class, PROP_REPLY_TO, g_param_spec_string ( "reply-to", @@ -971,6 +1002,29 @@ e_composer_header_table_set_destinations_to (EComposerHeaderTable *table, e_composer_name_header_set_destinations (header, destinations); } +EMFolderTreeModel * +e_composer_header_table_get_folder_tree_model (EComposerHeaderTable *table) +{ + EComposerPostHeader *header; + + g_return_val_if_fail (E_IS_COMPOSER_HEADER_TABLE (table), NULL); + + header = E_COMPOSER_HEADER_TABLE_GET_POST_TO_HEADER (table); + return e_composer_post_header_get_folder_tree_model (header); +} + +void +e_composer_header_table_set_folder_tree_model (EComposerHeaderTable *table, + EMFolderTreeModel *model) +{ + EComposerPostHeader *header; + + g_return_if_fail (E_IS_COMPOSER_HEADER_TABLE (table)); + + header = E_COMPOSER_HEADER_TABLE_GET_POST_TO_HEADER (table); + e_composer_post_header_set_folder_tree_model (header, model); +} + GList * e_composer_header_table_get_post_to (EComposerHeaderTable *table) { diff --git a/composer/e-composer-header-table.h b/composer/e-composer-header-table.h index 0e03618dc9..5e1d3e1922 100644 --- a/composer/e-composer-header-table.h +++ b/composer/e-composer-header-table.h @@ -27,6 +27,7 @@ #include <libebook/e-destination.h> #include <e-util/e-signature.h> #include <e-util/e-signature-list.h> +#include <mail/em-folder-tree-model.h> #include "e-composer-header.h" @@ -127,6 +128,12 @@ EDestination ** e_composer_header_table_get_destinations_to void e_composer_header_table_set_destinations_to (EComposerHeaderTable *table, EDestination **destinations); +EMFolderTreeModel * + e_composer_header_table_get_folder_tree_model + (EComposerHeaderTable *table); +void e_composer_header_table_set_folder_tree_model + (EComposerHeaderTable *table, + EMFolderTreeModel *model); GList * e_composer_header_table_get_post_to (EComposerHeaderTable *table); void e_composer_header_table_set_post_to_base diff --git a/composer/e-composer-post-header.c b/composer/e-composer-post-header.c index bb971d53bf..2ff98d053b 100644 --- a/composer/e-composer-post-header.c +++ b/composer/e-composer-post-header.c @@ -32,10 +32,12 @@ enum { PROP_0, - PROP_ACCOUNT + PROP_ACCOUNT, + PROP_FOLDER_TREE_MODEL }; struct _EComposerPostHeaderPrivate { + EMFolderTreeModel *model; EAccount *account; gchar *base_url; /* derived from account */ gboolean custom; @@ -43,10 +45,6 @@ struct _EComposerPostHeaderPrivate { static gpointer parent_class; -/* Forward Declarations (to avoid pulling in Bonobo stuff) */ -struct _MailComponent *mail_component_peek (void); -struct _EMFolderTreeModel *mail_component_peek_tree_model (struct _MailComponent *component); - static gchar * composer_post_header_folder_name_to_string (EComposerPostHeader *header, const gchar *url) @@ -120,7 +118,9 @@ composer_post_header_clicked_cb (EComposerPostHeader *header) GtkWidget *dialog; GList *list; - model = mail_component_peek_tree_model (mail_component_peek ()); + g_return_if_fail (header->priv->model != NULL); + + model = header->priv->model; folder_tree = em_folder_tree_new_with_model (model); em_folder_tree_set_multiselect ( @@ -194,6 +194,12 @@ composer_post_header_set_property (GObject *object, E_COMPOSER_POST_HEADER (object), g_value_get_object (value)); return; + + case PROP_FOLDER_TREE_MODEL: + e_composer_post_header_set_folder_tree_model ( + E_COMPOSER_POST_HEADER (object), + g_value_get_object (value)); + return; } G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); @@ -211,6 +217,13 @@ composer_post_header_get_property (GObject *object, value, e_composer_post_header_get_account ( E_COMPOSER_POST_HEADER (object))); return; + + case PROP_FOLDER_TREE_MODEL: + g_value_set_object ( + value, + e_composer_post_header_get_folder_tree_model ( + E_COMPOSER_POST_HEADER (object))); + return; } G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); @@ -228,6 +241,11 @@ composer_post_header_dispose (GObject *object) priv->account = NULL; } + if (priv->model != NULL) { + g_object_unref (priv->model); + priv->model = NULL; + } + /* Chain up to parent's dispose() method. */ G_OBJECT_CLASS (parent_class)->dispose (object); } @@ -269,6 +287,16 @@ composer_post_header_class_init (EComposerPostHeaderClass *class) NULL, E_TYPE_ACCOUNT, G_PARAM_READWRITE)); + + g_object_class_install_property ( + object_class, + PROP_FOLDER_TREE_MODEL, + g_param_spec_object ( + "folder-tree-model", + NULL, + NULL, + EM_TYPE_FOLDER_TREE_MODEL, + G_PARAM_READWRITE)); } static void @@ -352,6 +380,29 @@ e_composer_post_header_set_account (EComposerPostHeader *header, g_object_notify (G_OBJECT (header), "account"); } +EMFolderTreeModel * +e_composer_post_header_get_folder_tree_model (EComposerPostHeader *header) +{ + g_return_val_if_fail (E_IS_COMPOSER_POST_HEADER (header), NULL); + + return header->priv->model; +} + +void +e_composer_post_header_set_folder_tree_model (EComposerPostHeader *header, + EMFolderTreeModel *model) +{ + g_return_if_fail (E_IS_COMPOSER_POST_HEADER (header)); + g_return_if_fail (EM_IS_FOLDER_TREE_MODEL (model)); + + if (header->priv->model != NULL) + g_object_unref (header->priv->model); + + header->priv->model = g_object_ref (model); + + g_object_notify (G_OBJECT (header), "folder-tree-model"); +} + GList * e_composer_post_header_get_folders (EComposerPostHeader *header) { diff --git a/composer/e-composer-post-header.h b/composer/e-composer-post-header.h index 666d043df2..f2a1a5057c 100644 --- a/composer/e-composer-post-header.h +++ b/composer/e-composer-post-header.h @@ -22,6 +22,7 @@ #define E_COMPOSER_POST_HEADER_H #include <libedataserver/e-account.h> +#include <mail/em-folder-tree-model.h> #include "e-composer-text-header.h" @@ -46,6 +47,8 @@ G_BEGIN_DECLS +/* Avoid including files from the Mail module. */ + typedef struct _EComposerPostHeader EComposerPostHeader; typedef struct _EComposerPostHeaderClass EComposerPostHeaderClass; typedef struct _EComposerPostHeaderPrivate EComposerPostHeaderPrivate; @@ -60,12 +63,19 @@ struct _EComposerPostHeaderClass { }; GType e_composer_post_header_get_type (void); -EComposerHeader * e_composer_post_header_new (const gchar *label); +EComposerHeader * + e_composer_post_header_new (const gchar *label); EAccount * e_composer_post_header_get_account (EComposerPostHeader *header); void e_composer_post_header_set_account (EComposerPostHeader *header, EAccount *account); +EMFolderTreeModel * + e_composer_post_header_get_folder_tree_model + (EComposerPostHeader *header); +void e_composer_post_header_set_folder_tree_model + (EComposerPostHeader *header, + EMFolderTreeModel *model); GList * e_composer_post_header_get_folders (EComposerPostHeader *header); void e_composer_post_header_set_folders diff --git a/composer/e-composer-private.c b/composer/e-composer-private.c index 30cdbfab75..c1e463a98b 100644 --- a/composer/e-composer-private.c +++ b/composer/e-composer-private.c @@ -19,6 +19,8 @@ #include "e-composer-private.h" +#include "mail/e-mail-shell-module.h" + static void composer_setup_charset_menu (EMsgComposer *composer) { @@ -144,6 +146,14 @@ e_composer_private_init (EMsgComposer *composer) priv->header_table = g_object_ref (widget); gtk_widget_show (widget); + /* XXX We have to access the mail shell module directly for the + * benefit of other modules that spawn composer windows but + * don't link to the mail module. Need to work out a better + * inter-module messaging system, in lieu of Bonobo. D-Bus? */ + e_composer_header_table_set_folder_tree_model ( + E_COMPOSER_HEADER_TABLE (widget), + e_mail_shell_module_get_folder_tree_model (mail_shell_module)); + /* Construct attachment widgets. * XXX Move this stuff into a new custom widget. */ diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c index f2ef200219..4f4285215b 100644 --- a/composer/e-msg-composer.c +++ b/composer/e-msg-composer.c @@ -86,16 +86,16 @@ #include <camel/camel-smime-context.h> #endif -#include "mail/em-utils.h" #include "mail/em-composer-utils.h" +#include "mail/em-menu.h" +#include "mail/em-popup.h" +#include "mail/em-utils.h" #include "mail/mail-config.h" #include "mail/mail-crypto.h" -#include "mail/mail-tools.h" -#include "mail/mail-ops.h" #include "mail/mail-mt.h" +#include "mail/mail-ops.h" #include "mail/mail-session.h" -#include "mail/em-popup.h" -#include "mail/em-menu.h" +#include "mail/mail-tools.h" #include "e-msg-composer.h" #include "e-attachment.h" |