aboutsummaryrefslogtreecommitdiffstats
path: root/composer/e-composer-from-header.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2007-12-02 09:41:04 +0800
committerMatthew Barnes <mbarnes@src.gnome.org>2007-12-02 09:41:04 +0800
commit8266bb685a189d8560450ff161efdd5629849f11 (patch)
treef86f9368649f2a036730a704fb97c12160c10365 /composer/e-composer-from-header.c
parent253452654a4bc2fdd44f61446890ccf556c82958 (diff)
downloadgsoc2013-evolution-8266bb685a189d8560450ff161efdd5629849f11.tar.gz
gsoc2013-evolution-8266bb685a189d8560450ff161efdd5629849f11.tar.zst
gsoc2013-evolution-8266bb685a189d8560450ff161efdd5629849f11.zip
** Fixes part of bug #495123
2007-12-01 Matthew Barnes <mbarnes@redhat.com> ** Fixes part of bug #495123 * composer/e-msg-composer.c: * composer/e-msg-composer-hdrs.h: * composer/e-msg-composer-hdrs.c: Move signature handling to e-msg-composer-hdrs.c. Use an ESignatureComboBox. * composer/e-composer-from-header.h: * composer/e-composer-from-header.c: Clean up the GtkHBox hack. The signature combo is now packed directly into the GtkTable. * composer/e-composer-name-header.c: * composer/e-composer-text-header.c: Code cleanup. * widgets/misc/Makefile.am: Add e-signature-combo-box.[ch]. * widget/misc/e-account-combo-box.c (account_combo_box_refresh_cb): Make sure the EAccount isn't lost while swapping models. * widget/misc/e-signature-combo-box.c: * widget/misc/e-signature-combo-box.h: New widget renders an ESignatureList as a combo box. Also listens for changes to the ESignatureList and updates itself accordingly. svn path=/trunk/; revision=34620
Diffstat (limited to 'composer/e-composer-from-header.c')
-rw-r--r--composer/e-composer-from-header.c53
1 files changed, 10 insertions, 43 deletions
diff --git a/composer/e-composer-from-header.c b/composer/e-composer-from-header.c
index de4f8ac8e0..55f525326e 100644
--- a/composer/e-composer-from-header.c
+++ b/composer/e-composer-from-header.c
@@ -1,12 +1,8 @@
#include "e-composer-from-header.h"
-#define E_COMPOSER_FROM_HEADER_GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE \
- ((obj), E_TYPE_COMPOSER_FROM_HEADER, EComposerFromHeaderPrivate))
-
-struct _EComposerFromHeaderPrivate {
- GtkWidget *combo_box;
-};
+/* Convenience macro */
+#define E_COMPOSER_FROM_HEADER_GET_COMBO_BOX(header) \
+ (E_ACCOUNT_COMBO_BOX (E_COMPOSER_HEADER (header)->input_widget))
static gpointer parent_class;
@@ -18,50 +14,21 @@ composer_from_header_changed_cb (EAccountComboBox *combo_box,
}
static void
-composer_from_header_dispose (GObject *object)
-{
- EComposerFromHeaderPrivate *priv;
-
- priv = E_COMPOSER_FROM_HEADER_GET_PRIVATE (object);
-
- if (priv->combo_box != NULL) {
- g_object_unref (priv->combo_box);
- priv->combo_box = NULL;
- }
-
- /* Chain up to parent's dispose() method. */
- G_OBJECT_CLASS (parent_class)->dispose (object);
-}
-
-static void
composer_from_header_class_init (EComposerFromHeaderClass *class)
{
- GObjectClass *object_class;
-
parent_class = g_type_class_peek_parent (class);
- g_type_class_add_private (class, sizeof (EComposerFromHeaderPrivate));
-
- object_class = G_OBJECT_CLASS (class);
- object_class->dispose = composer_from_header_dispose;
}
static void
composer_from_header_init (EComposerFromHeader *header)
{
- GtkWidget *hbox;
GtkWidget *widget;
- header->priv = E_COMPOSER_FROM_HEADER_GET_PRIVATE (header);
-
- hbox = g_object_ref_sink (gtk_hbox_new (FALSE, 6));
- E_COMPOSER_HEADER (header)->input_widget = hbox;
-
- widget = e_account_combo_box_new ();
+ widget = g_object_ref_sink (e_account_combo_box_new ());
g_signal_connect (
widget, "changed",
G_CALLBACK (composer_from_header_changed_cb), header);
- gtk_box_pack_start (GTK_BOX (hbox), widget, TRUE, TRUE, 0);
- header->priv->combo_box = g_object_ref_sink (widget);
+ E_COMPOSER_HEADER (header)->input_widget = widget;
gtk_widget_show (widget);
}
@@ -108,7 +75,7 @@ e_composer_from_header_set_account_list (EComposerFromHeader *header,
g_return_if_fail (E_IS_COMPOSER_FROM_HEADER (header));
- combo_box = E_ACCOUNT_COMBO_BOX (header->priv->combo_box);
+ combo_box = E_COMPOSER_FROM_HEADER_GET_COMBO_BOX (header);
e_account_combo_box_set_account_list (combo_box, account_list);
}
@@ -119,7 +86,7 @@ e_composer_from_header_get_active (EComposerFromHeader *header)
g_return_val_if_fail (E_IS_COMPOSER_FROM_HEADER (header), NULL);
- combo_box = E_ACCOUNT_COMBO_BOX (header->priv->combo_box);
+ combo_box = E_COMPOSER_FROM_HEADER_GET_COMBO_BOX (header);
return e_account_combo_box_get_active (combo_box);
}
@@ -131,7 +98,7 @@ e_composer_from_header_set_active (EComposerFromHeader *header,
g_return_val_if_fail (E_IS_COMPOSER_FROM_HEADER (header), FALSE);
- combo_box = E_ACCOUNT_COMBO_BOX (header->priv->combo_box);
+ combo_box = E_COMPOSER_FROM_HEADER_GET_COMBO_BOX (header);
return e_account_combo_box_set_active (combo_box, account);
}
@@ -142,7 +109,7 @@ e_composer_from_header_get_active_name (EComposerFromHeader *header)
g_return_val_if_fail (E_IS_COMPOSER_FROM_HEADER (header), NULL);
- combo_box = E_ACCOUNT_COMBO_BOX (header->priv->combo_box);
+ combo_box = E_COMPOSER_FROM_HEADER_GET_COMBO_BOX (header);
return e_account_combo_box_get_active_name (combo_box);
}
@@ -154,7 +121,7 @@ e_composer_from_header_set_active_name (EComposerFromHeader *header,
g_return_val_if_fail (E_IS_COMPOSER_FROM_HEADER (header), FALSE);
- combo_box = E_ACCOUNT_COMBO_BOX (header->priv->combo_box);
+ combo_box = E_COMPOSER_FROM_HEADER_GET_COMBO_BOX (header);
return e_account_combo_box_set_active_name (combo_box, account_name);
}