aboutsummaryrefslogtreecommitdiffstats
path: root/composer/e-composer-from-header.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2011-04-13 22:31:31 +0800
committerMatthew Barnes <mbarnes@redhat.com>2012-06-03 11:00:40 +0800
commitf78795f4dff8b225d78385c5e23e1cd44ee946ad (patch)
treea35151efbda32b3fbc0b352b86dd1c7089d84240 /composer/e-composer-from-header.c
parent68c35c4bedc4cd36cf2396121921f2e781b631fb (diff)
downloadgsoc2013-evolution-f78795f4dff8b225d78385c5e23e1cd44ee946ad.tar.gz
gsoc2013-evolution-f78795f4dff8b225d78385c5e23e1cd44ee946ad.tar.zst
gsoc2013-evolution-f78795f4dff8b225d78385c5e23e1cd44ee946ad.zip
Adapt composer to the new ESource API.
Diffstat (limited to 'composer/e-composer-from-header.c')
-rw-r--r--composer/e-composer-from-header.c130
1 files changed, 42 insertions, 88 deletions
diff --git a/composer/e-composer-from-header.c b/composer/e-composer-from-header.c
index 0b569717c2..a844ca3d6a 100644
--- a/composer/e-composer-from-header.c
+++ b/composer/e-composer-from-header.c
@@ -24,16 +24,7 @@
#include "e-composer-from-header.h"
-/* Convenience macro */
-#define E_COMPOSER_FROM_HEADER_GET_COMBO_BOX(header) \
- (E_ACCOUNT_COMBO_BOX (E_COMPOSER_HEADER (header)->input_widget))
-
-enum {
- REFRESHED,
- LAST_SIGNAL
-};
-
-static guint signal_ids[LAST_SIGNAL];
+#include <misc/e-mail-identity-combo-box.h>
G_DEFINE_TYPE (
EComposerFromHeader,
@@ -41,119 +32,82 @@ G_DEFINE_TYPE (
E_TYPE_COMPOSER_HEADER)
static void
-composer_from_header_changed_cb (EAccountComboBox *combo_box,
+composer_from_header_changed_cb (EMailIdentityComboBox *combo_box,
EComposerFromHeader *header)
{
g_signal_emit_by_name (header, "changed");
}
static void
-composer_from_header_refreshed_cb (EAccountComboBox *combo_box,
- EComposerFromHeader *header)
+composer_from_header_constructed (GObject *object)
{
- g_signal_emit (header, signal_ids[REFRESHED], 0);
-}
+ ESourceRegistry *registry;
+ EComposerHeader *header;
+ GtkWidget *widget;
-static void
-e_composer_from_header_class_init (EComposerFromHeaderClass *class)
-{
- signal_ids[REFRESHED] = g_signal_new (
- "refreshed",
- G_TYPE_FROM_CLASS (class),
- G_SIGNAL_RUN_LAST,
- 0, NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-}
+ header = E_COMPOSER_HEADER (object);
+ registry = e_composer_header_get_registry (header);
-static void
-e_composer_from_header_init (EComposerFromHeader *header)
-{
- GtkWidget *widget;
+ /* Input widget must be set before chaining up. */
- widget = g_object_ref_sink (e_account_combo_box_new ());
+ widget = e_mail_identity_combo_box_new (registry);
g_signal_connect (
widget, "changed",
G_CALLBACK (composer_from_header_changed_cb), header);
- g_signal_connect (
- widget, "refreshed",
- G_CALLBACK (composer_from_header_refreshed_cb), header);
- E_COMPOSER_HEADER (header)->input_widget = widget;
-}
-
-EComposerHeader *
-e_composer_from_header_new (const gchar *label)
-{
- return g_object_new (
- E_TYPE_COMPOSER_FROM_HEADER, "label", label,
- "button", FALSE, NULL);
-}
-
-EAccountList *
-e_composer_from_header_get_account_list (EComposerFromHeader *header)
-{
- EAccountComboBox *combo_box;
-
- g_return_val_if_fail (E_IS_COMPOSER_FROM_HEADER (header), NULL);
+ header->input_widget = g_object_ref_sink (widget);
- combo_box = E_COMPOSER_FROM_HEADER_GET_COMBO_BOX (header);
- return e_account_combo_box_get_account_list (combo_box);
+ /* Chain up to parent's constructed() method. */
+ G_OBJECT_CLASS (e_composer_from_header_parent_class)->
+ constructed (object);
}
-void
-e_composer_from_header_set_account_list (EComposerFromHeader *header,
- EAccountList *account_list)
+static void
+e_composer_from_header_class_init (EComposerFromHeaderClass *class)
{
- EAccountComboBox *combo_box;
-
- g_return_if_fail (E_IS_COMPOSER_FROM_HEADER (header));
+ GObjectClass *object_class;
- combo_box = E_COMPOSER_FROM_HEADER_GET_COMBO_BOX (header);
- e_account_combo_box_set_account_list (combo_box, account_list);
+ object_class = G_OBJECT_CLASS (class);
+ object_class->constructed = composer_from_header_constructed;
}
-EAccount *
-e_composer_from_header_get_active (EComposerFromHeader *header)
+static void
+e_composer_from_header_init (EComposerFromHeader *from_header)
{
- EAccountComboBox *combo_box;
-
- g_return_val_if_fail (E_IS_COMPOSER_FROM_HEADER (header), NULL);
-
- combo_box = E_COMPOSER_FROM_HEADER_GET_COMBO_BOX (header);
- return e_account_combo_box_get_active (combo_box);
}
-gboolean
-e_composer_from_header_set_active (EComposerFromHeader *header,
- EAccount *account)
+EComposerHeader *
+e_composer_from_header_new (ESourceRegistry *registry,
+ const gchar *label)
{
- EAccountComboBox *combo_box;
+ g_return_val_if_fail (E_IS_SOURCE_REGISTRY (registry), NULL);
- g_return_val_if_fail (E_IS_COMPOSER_FROM_HEADER (header), FALSE);
-
- combo_box = E_COMPOSER_FROM_HEADER_GET_COMBO_BOX (header);
- return e_account_combo_box_set_active (combo_box, account);
+ return g_object_new (
+ E_TYPE_COMPOSER_FROM_HEADER,
+ "label", label, "button", FALSE,
+ "registry", registry, NULL);
}
const gchar *
-e_composer_from_header_get_active_name (EComposerFromHeader *header)
+e_composer_from_header_get_active_id (EComposerFromHeader *header)
{
- EAccountComboBox *combo_box;
+ GtkComboBox *combo_box;
g_return_val_if_fail (E_IS_COMPOSER_FROM_HEADER (header), NULL);
- combo_box = E_COMPOSER_FROM_HEADER_GET_COMBO_BOX (header);
- return e_account_combo_box_get_active_name (combo_box);
+ combo_box = GTK_COMBO_BOX (E_COMPOSER_HEADER (header)->input_widget);
+
+ return gtk_combo_box_get_active_id (combo_box);
}
-gboolean
-e_composer_from_header_set_active_name (EComposerFromHeader *header,
- const gchar *account_name)
+void
+e_composer_from_header_set_active_id (EComposerFromHeader *header,
+ const gchar *active_id)
{
- EAccountComboBox *combo_box;
+ GtkComboBox *combo_box;
+
+ g_return_if_fail (E_IS_COMPOSER_FROM_HEADER (header));
- g_return_val_if_fail (E_IS_COMPOSER_FROM_HEADER (header), FALSE);
+ combo_box = GTK_COMBO_BOX (E_COMPOSER_HEADER (header)->input_widget);
- combo_box = E_COMPOSER_FROM_HEADER_GET_COMBO_BOX (header);
- return e_account_combo_box_set_active_name (combo_box, account_name);
+ gtk_combo_box_set_active_id (combo_box, active_id);
}