diff options
Diffstat (limited to 'libempathy-gtk/empathy-contact-selector.c')
-rw-r--r-- | libempathy-gtk/empathy-contact-selector.c | 43 |
1 files changed, 19 insertions, 24 deletions
diff --git a/libempathy-gtk/empathy-contact-selector.c b/libempathy-gtk/empathy-contact-selector.c index 8d93b6f4c..0be3824f6 100644 --- a/libempathy-gtk/empathy-contact-selector.c +++ b/libempathy-gtk/empathy-contact-selector.c @@ -133,15 +133,12 @@ unset_blank_contact (EmpathyContactSelector *selector) static void -notify_popup_shown_cb (GtkComboBox *widget, - GParamSpec *property, - gpointer data) +manage_blank_contact (EmpathyContactSelector *selector) { - EmpathyContactSelector *selector = EMPATHY_CONTACT_SELECTOR (widget); EmpathyContactSelectorPriv *priv = GET_PRIV (selector); gboolean is_popup_shown; - g_object_get (widget, property->name, &is_popup_shown, NULL); + g_object_get (selector, "popup-shown", &is_popup_shown, NULL); if (is_popup_shown) { @@ -149,41 +146,39 @@ notify_popup_shown_cb (GtkComboBox *widget, } else { - if (gtk_combo_box_get_active (widget) == -1) + if (gtk_combo_box_get_active (GTK_COMBO_BOX (selector)) == -1) { set_blank_contact (selector); if (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (priv->store), NULL) == 1) gtk_widget_set_sensitive (GTK_WIDGET (selector), FALSE); } + else + { + unset_blank_contact (selector); + } } } static void -changed_cb (GtkComboBox *widget, - gpointer data) +notify_popup_shown_cb (GtkComboBox *widget, + GParamSpec *property, + gpointer data) { EmpathyContactSelector *selector = EMPATHY_CONTACT_SELECTOR (widget); - EmpathyContactSelectorPriv *priv = GET_PRIV (selector); - gboolean is_popup_shown; - g_object_get (widget, "popup-shown", &is_popup_shown, NULL); + manage_blank_contact (selector); +} - if (is_popup_shown) - return; - if (gtk_combo_box_get_active (widget) == -1) - { - set_blank_contact (selector); - if (gtk_tree_model_iter_n_children (GTK_TREE_MODEL (priv->store), - NULL) == 1) - gtk_widget_set_sensitive (GTK_WIDGET (selector), FALSE); - } - else - { - unset_blank_contact (selector); - } +static void +changed_cb (GtkComboBox *widget, + gpointer data) +{ + EmpathyContactSelector *selector = EMPATHY_CONTACT_SELECTOR (widget); + + manage_blank_contact (selector); } |