From 683a038c8ec82c97ebf1076e344ddab209dd8a16 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Thu, 10 Oct 2013 17:59:50 -0400 Subject: EMailIdentityComboBox cleanups. --- .../evolution-util/evolution-util-sections.txt | 2 + e-util/e-mail-identity-combo-box.c | 70 +++++++++++----------- e-util/e-mail-identity-combo-box.h | 4 +- 3 files changed, 39 insertions(+), 37 deletions(-) diff --git a/doc/reference/evolution-util/evolution-util-sections.txt b/doc/reference/evolution-util/evolution-util-sections.txt index c7cd9fcbdc..b1a59439fa 100644 --- a/doc/reference/evolution-util/evolution-util-sections.txt +++ b/doc/reference/evolution-util/evolution-util-sections.txt @@ -2003,6 +2003,8 @@ EMailIdentityComboBox e_mail_identity_combo_box_new e_mail_identity_combo_box_refresh e_mail_identity_combo_box_get_registry +e_mail_identity_combo_box_get_allow_none +e_mail_identity_combo_box_set_allow_none E_MAIL_IDENTITY_COMBO_BOX E_IS_MAIL_IDENTITY_COMBO_BOX diff --git a/e-util/e-mail-identity-combo-box.c b/e-util/e-mail-identity-combo-box.c index 5cb7b0da34..9dab53d069 100644 --- a/e-util/e-mail-identity-combo-box.c +++ b/e-util/e-mail-identity-combo-box.c @@ -39,8 +39,8 @@ struct _EMailIdentityComboBoxPrivate { enum { PROP_0, - PROP_REGISTRY, - PROP_ALLOW_NONE + PROP_ALLOW_NONE, + PROP_REGISTRY }; enum { @@ -132,17 +132,17 @@ mail_identity_combo_box_set_property (GObject *object, GParamSpec *pspec) { switch (property_id) { - case PROP_REGISTRY: - mail_identity_combo_box_set_registry ( - E_MAIL_IDENTITY_COMBO_BOX (object), - g_value_get_object (value)); - return; - case PROP_ALLOW_NONE: e_mail_identity_combo_box_set_allow_none ( E_MAIL_IDENTITY_COMBO_BOX (object), g_value_get_boolean (value)); return; + + case PROP_REGISTRY: + mail_identity_combo_box_set_registry ( + E_MAIL_IDENTITY_COMBO_BOX (object), + g_value_get_object (value)); + return; } G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); @@ -155,17 +155,17 @@ mail_identity_combo_box_get_property (GObject *object, GParamSpec *pspec) { switch (property_id) { - case PROP_REGISTRY: - g_value_set_object ( + case PROP_ALLOW_NONE: + g_value_set_boolean ( value, - e_mail_identity_combo_box_get_registry ( + e_mail_identity_combo_box_get_allow_none ( E_MAIL_IDENTITY_COMBO_BOX (object))); return; - case PROP_ALLOW_NONE: - g_value_set_boolean ( + case PROP_REGISTRY: + g_value_set_object ( value, - e_mail_identity_combo_box_get_allow_none ( + e_mail_identity_combo_box_get_registry ( E_MAIL_IDENTITY_COMBO_BOX (object))); return; } @@ -242,25 +242,25 @@ e_mail_identity_combo_box_class_init (EMailIdentityComboBoxClass *class) g_object_class_install_property ( object_class, - PROP_REGISTRY, - g_param_spec_object ( - "registry", - "Registry", + PROP_ALLOW_NONE, + g_param_spec_boolean ( + "allow-none", + "Allow None Item", NULL, - E_TYPE_SOURCE_REGISTRY, + FALSE, G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS)); g_object_class_install_property ( object_class, - PROP_ALLOW_NONE, - g_param_spec_boolean ( - "allow-none", - "Allow None Item", + PROP_REGISTRY, + g_param_spec_object ( + "registry", + "Registry", NULL, - FALSE, + E_TYPE_SOURCE_REGISTRY, G_PARAM_READWRITE | + G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS)); } @@ -268,7 +268,6 @@ static void e_mail_identity_combo_box_init (EMailIdentityComboBox *combo_box) { combo_box->priv = E_MAIL_IDENTITY_COMBO_BOX_GET_PRIVATE (combo_box); - combo_box->priv->allow_none = FALSE; } GtkWidget * @@ -426,13 +425,21 @@ e_mail_identity_combo_box_get_registry (EMailIdentityComboBox *combo_box) return combo_box->priv->registry; } +gboolean +e_mail_identity_combo_box_get_allow_none (EMailIdentityComboBox *combo_box) +{ + g_return_val_if_fail (E_IS_MAIL_IDENTITY_COMBO_BOX (combo_box), FALSE); + + return combo_box->priv->allow_none; +} + void e_mail_identity_combo_box_set_allow_none (EMailIdentityComboBox *combo_box, - gboolean allow_none) + gboolean allow_none) { g_return_if_fail (E_IS_MAIL_IDENTITY_COMBO_BOX (combo_box)); - if ((combo_box->priv->allow_none ? 1 : 0) == (allow_none ? 1 : 0)) + if (allow_none == combo_box->priv->allow_none) return; combo_box->priv->allow_none = allow_none; @@ -442,10 +449,3 @@ e_mail_identity_combo_box_set_allow_none (EMailIdentityComboBox *combo_box, e_mail_identity_combo_box_refresh (combo_box); } -gboolean -e_mail_identity_combo_box_get_allow_none (EMailIdentityComboBox *combo_box) -{ - g_return_val_if_fail (E_IS_MAIL_IDENTITY_COMBO_BOX (combo_box), FALSE); - - return combo_box->priv->allow_none; -} diff --git a/e-util/e-mail-identity-combo-box.h b/e-util/e-mail-identity-combo-box.h index 07336a435d..24f0dce009 100644 --- a/e-util/e-mail-identity-combo-box.h +++ b/e-util/e-mail-identity-combo-box.h @@ -69,11 +69,11 @@ void e_mail_identity_combo_box_refresh ESourceRegistry * e_mail_identity_combo_box_get_registry (EMailIdentityComboBox *combo_box); +gboolean e_mail_identity_combo_box_get_allow_none + (EMailIdentityComboBox *combo_box); void e_mail_identity_combo_box_set_allow_none (EMailIdentityComboBox *combo_box, gboolean allow_none); -gboolean e_mail_identity_combo_box_get_allow_none - (EMailIdentityComboBox *combo_box); G_END_DECLS -- cgit