aboutsummaryrefslogtreecommitdiffstats
path: root/composer
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@src.gnome.org>2009-02-13 12:32:51 +0800
committerMatthew Barnes <mbarnes@src.gnome.org>2009-02-13 12:32:51 +0800
commit7986af5369482c4feeaad6880045bf92a4d3f744 (patch)
tree6145dc9d0ca08c545f92f99e9fb973385b6506ec /composer
parent10c3ddb38138f3408044fd46115d5804f057c13a (diff)
downloadgsoc2013-evolution-7986af5369482c4feeaad6880045bf92a4d3f744.tar.gz
gsoc2013-evolution-7986af5369482c4feeaad6880045bf92a4d3f744.tar.zst
gsoc2013-evolution-7986af5369482c4feeaad6880045bf92a4d3f744.zip
Let the mail module handle composer "Post To:" button clicks, since
EMFolderSelector and EMFolderTree are off-limits to the composer. This further weakens the composer's mail module dependency. Add class methods to EComposerHeader for "changed" and "clicked" signals. Allows subclasses to implement them without connecting to their own signals. svn path=/branches/kill-bonobo/; revision=37260
Diffstat (limited to 'composer')
-rw-r--r--composer/e-composer-header-table.c54
-rw-r--r--composer/e-composer-header-table.h7
-rw-r--r--composer/e-composer-header.c6
-rw-r--r--composer/e-composer-header.h6
-rw-r--r--composer/e-composer-name-header.c35
-rw-r--r--composer/e-composer-post-header.c148
-rw-r--r--composer/e-composer-post-header.h7
7 files changed, 55 insertions, 208 deletions
diff --git a/composer/e-composer-header-table.c b/composer/e-composer-header-table.c
index c3af87a76d..461c11efa1 100644
--- a/composer/e-composer-header-table.c
+++ b/composer/e-composer-header-table.c
@@ -78,7 +78,6 @@ enum {
PROP_DESTINATIONS_BCC,
PROP_DESTINATIONS_CC,
PROP_DESTINATIONS_TO,
- PROP_MODEL,
PROP_POST_TO,
PROP_REPLY_TO,
PROP_SIGNATURE,
@@ -91,7 +90,6 @@ struct _EComposerHeaderTablePrivate {
GtkWidget *signature_label;
GtkWidget *signature_combo_box;
ENameSelector *name_selector;
- EMFolderTreeModel *model;
};
static gpointer parent_class;
@@ -346,12 +344,6 @@ 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 (
@@ -443,13 +435,6 @@ 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));
@@ -515,11 +500,6 @@ 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);
}
@@ -609,17 +589,6 @@ 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",
@@ -1000,29 +969,6 @@ 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 565880f324..b3150c409a 100644
--- a/composer/e-composer-header-table.h
+++ b/composer/e-composer-header-table.h
@@ -25,7 +25,6 @@
#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"
@@ -126,12 +125,6 @@ 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-header.c b/composer/e-composer-header.c
index 8cbcf64f1f..8a6d553921 100644
--- a/composer/e-composer-header.c
+++ b/composer/e-composer-header.c
@@ -240,7 +240,8 @@ composer_header_class_init (EComposerHeaderClass *class)
"changed",
G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_LAST,
- 0, NULL, NULL,
+ G_STRUCT_OFFSET (EComposerHeaderClass, changed),
+ NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
@@ -248,7 +249,8 @@ composer_header_class_init (EComposerHeaderClass *class)
"clicked",
G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_LAST,
- 0, NULL, NULL,
+ G_STRUCT_OFFSET (EComposerHeaderClass, clicked),
+ NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
}
diff --git a/composer/e-composer-header.h b/composer/e-composer-header.h
index d1edd110fe..4845816faf 100644
--- a/composer/e-composer-header.h
+++ b/composer/e-composer-header.h
@@ -28,7 +28,7 @@
((obj), E_TYPE_COMPOSER_HEADER, EComposerHeader))
#define E_COMPOSER_HEADER_CLASS(cls) \
(G_TYPE_CHECK_CLASS_CAST \
- ((obj), E_TYPE_COMPOSER_HEADER, EComposerHeaderClass))
+ ((cls), E_TYPE_COMPOSER_HEADER, EComposerHeaderClass))
#define E_IS_COMPOSER_HEADER(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE \
((obj), E_TYPE_COMPOSER_HEADER))
@@ -54,6 +54,10 @@ struct _EComposerHeader {
struct _EComposerHeaderClass {
GObjectClass parent_class;
+
+ /* Signals */
+ void (*changed) (EComposerHeader *header);
+ void (*clicked) (EComposerHeader *header);
};
GType e_composer_header_get_type (void);
diff --git a/composer/e-composer-name-header.c b/composer/e-composer-name-header.c
index 70a126b1e0..1b5acc19d5 100644
--- a/composer/e-composer-name-header.c
+++ b/composer/e-composer-name-header.c
@@ -47,18 +47,6 @@ struct _EComposerNameHeaderPrivate {
static gpointer parent_class;
static void
-composer_name_header_clicked_cb (EComposerNameHeader *header)
-{
- ENameSelectorDialog *dialog;
-
- dialog = e_name_selector_peek_dialog (header->priv->name_selector);
- e_name_selector_dialog_set_destination_index (
- dialog, header->priv->destination_index);
- gtk_dialog_run (GTK_DIALOG (dialog));
- gtk_widget_hide (GTK_WIDGET (dialog));
-}
-
-static void
composer_name_header_entry_changed_cb (ENameSelectorEntry *entry,
EComposerNameHeader *header)
{
@@ -130,10 +118,6 @@ composer_name_header_constructor (GType type,
NULL);
E_COMPOSER_HEADER (object)->input_widget = g_object_ref_sink (entry);
- g_signal_connect (
- object, "clicked",
- G_CALLBACK (composer_name_header_clicked_cb), NULL);
-
return object;
}
@@ -192,9 +176,25 @@ composer_name_header_dispose (GObject *object)
}
static void
+composer_name_header_clicked (EComposerHeader *header)
+{
+ EComposerNameHeaderPrivate *priv;
+ ENameSelectorDialog *dialog;
+
+ priv = E_COMPOSER_NAME_HEADER_GET_PRIVATE (header);
+
+ dialog = e_name_selector_peek_dialog (priv->name_selector);
+ e_name_selector_dialog_set_destination_index (
+ dialog, priv->destination_index);
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_hide (GTK_WIDGET (dialog));
+}
+
+static void
composer_name_header_class_init (EComposerNameHeaderClass *class)
{
GObjectClass *object_class;
+ EComposerHeaderClass *header_class;
parent_class = g_type_class_peek_parent (class);
g_type_class_add_private (class, sizeof (EComposerNameHeaderPrivate));
@@ -205,6 +205,9 @@ composer_name_header_class_init (EComposerNameHeaderClass *class)
object_class->get_property = composer_name_header_get_property;
object_class->dispose = composer_name_header_dispose;
+ header_class = E_COMPOSER_HEADER_CLASS (class);
+ header_class->clicked = composer_name_header_clicked;
+
g_object_class_install_property (
object_class,
PROP_NAME_SELECTOR,
diff --git a/composer/e-composer-post-header.c b/composer/e-composer-post-header.c
index 5a5ca2e610..88d20d5f58 100644
--- a/composer/e-composer-post-header.c
+++ b/composer/e-composer-post-header.c
@@ -22,9 +22,7 @@
#include <string.h>
#include <glib/gi18n.h>
-
-#include "mail/em-folder-selector.h"
-#include "mail/em-folder-tree.h"
+#include <camel/camel-url.h>
#define E_COMPOSER_POST_HEADER_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE \
@@ -32,12 +30,10 @@
enum {
PROP_0,
- PROP_ACCOUNT,
- PROP_FOLDER_TREE_MODEL
+ PROP_ACCOUNT
};
struct _EComposerPostHeaderPrivate {
- EMFolderTreeModel *model;
EAccount *account;
gchar *base_url; /* derived from account */
gboolean custom;
@@ -104,58 +100,6 @@ composer_post_header_split_csv (const gchar *csv)
return g_list_reverse (list);
}
-static void
-composer_post_header_changed_cb (EComposerPostHeader *header)
-{
- header->priv->custom = TRUE;
-}
-
-static void
-composer_post_header_clicked_cb (EComposerPostHeader *header)
-{
- EMFolderTreeModel *model;
- GtkWidget *folder_tree;
- GtkWidget *dialog;
- GList *list;
-
- 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 (
- EM_FOLDER_TREE (folder_tree), TRUE);
- em_folder_tree_set_excluded (
- EM_FOLDER_TREE (folder_tree),
- EMFT_EXCLUDE_NOSELECT |
- EMFT_EXCLUDE_VIRTUAL |
- EMFT_EXCLUDE_VTRASH);
-
- dialog = em_folder_selector_new (
- EM_FOLDER_TREE (folder_tree),
- EM_FOLDER_SELECTOR_CAN_CREATE,
- _("Posting destination"),
- _("Choose folders to post the message to."),
- NULL);
-
- list = e_composer_post_header_get_folders (header);
- em_folder_selector_set_selected_list (
- EM_FOLDER_SELECTOR (dialog), list);
- g_list_foreach (list, (GFunc) g_free, NULL);
- g_list_free (list);
-
- if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK) {
- list = em_folder_selector_get_selected_uris (
- EM_FOLDER_SELECTOR (dialog));
- e_composer_post_header_set_folders (header, list);
- header->priv->custom = FALSE;
- g_list_foreach (list, (GFunc) g_free, NULL);
- g_list_free (list);
- }
-
- gtk_widget_destroy (dialog);
-}
-
static GObject *
composer_post_header_constructor (GType type,
guint n_construct_properties,
@@ -171,14 +115,6 @@ composer_post_header_constructor (GType type,
E_COMPOSER_HEADER (object),
_("Click here to select folders to post to"));
- g_signal_connect (
- object, "changed",
- G_CALLBACK (composer_post_header_changed_cb), NULL);
-
- g_signal_connect (
- object, "clicked",
- G_CALLBACK (composer_post_header_clicked_cb), NULL);
-
return object;
}
@@ -194,12 +130,6 @@ 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);
@@ -217,13 +147,6 @@ 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);
@@ -241,11 +164,6 @@ 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);
}
@@ -264,9 +182,30 @@ composer_post_header_finalize (GObject *object)
}
static void
+composer_post_header_changed (EComposerHeader *header)
+{
+ EComposerPostHeaderPrivate *priv;
+
+ priv = E_COMPOSER_POST_HEADER_GET_PRIVATE (header);
+
+ priv->custom = TRUE;
+}
+
+static void
+composer_post_header_clicked (EComposerHeader *header)
+{
+ EComposerPostHeaderPrivate *priv;
+
+ priv = E_COMPOSER_POST_HEADER_GET_PRIVATE (header);
+
+ priv->custom = FALSE;
+}
+
+static void
composer_post_header_class_init (EComposerPostHeaderClass *class)
{
GObjectClass *object_class;
+ EComposerHeaderClass *header_class;
parent_class = g_type_class_peek_parent (class);
g_type_class_add_private (class, sizeof (EComposerPostHeaderPrivate));
@@ -278,6 +217,10 @@ composer_post_header_class_init (EComposerPostHeaderClass *class)
object_class->dispose = composer_post_header_dispose;
object_class->finalize = composer_post_header_finalize;
+ header_class = E_COMPOSER_HEADER_CLASS (class);
+ header_class->changed = composer_post_header_changed;
+ header_class->clicked = composer_post_header_clicked;
+
g_object_class_install_property (
object_class,
PROP_ACCOUNT,
@@ -287,16 +230,6 @@ 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
@@ -380,33 +313,6 @@ 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));
-
- if (model != NULL) {
- g_return_if_fail (EM_IS_FOLDER_TREE_MODEL (model));
- g_object_ref (model);
- }
-
- if (header->priv->model != NULL)
- g_object_unref (header->priv->model);
-
- header->priv->model = 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 f2a1a5057c..92b582600b 100644
--- a/composer/e-composer-post-header.h
+++ b/composer/e-composer-post-header.h
@@ -22,7 +22,6 @@
#define E_COMPOSER_POST_HEADER_H
#include <libedataserver/e-account.h>
-#include <mail/em-folder-tree-model.h>
#include "e-composer-text-header.h"
@@ -70,12 +69,6 @@ EAccount * e_composer_post_header_get_account
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