aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk/empathy-contact-selector.c
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@src.gnome.org>2009-01-31 01:34:04 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2009-01-31 01:34:04 +0800
commit195307cf5f411252ef09d9e03649430d4d71c6a4 (patch)
treef09dc4f161804dff72cbaa851a90611f0f14a22a /libempathy-gtk/empathy-contact-selector.c
parent079da0bc9f39241c31cd66e4c8b6267e714459b9 (diff)
downloadgsoc2013-empathy-195307cf5f411252ef09d9e03649430d4d71c6a4.tar
gsoc2013-empathy-195307cf5f411252ef09d9e03649430d4d71c6a4.tar.gz
gsoc2013-empathy-195307cf5f411252ef09d9e03649430d4d71c6a4.tar.bz2
gsoc2013-empathy-195307cf5f411252ef09d9e03649430d4d71c6a4.tar.lz
gsoc2013-empathy-195307cf5f411252ef09d9e03649430d4d71c6a4.tar.xz
gsoc2013-empathy-195307cf5f411252ef09d9e03649430d4d71c6a4.tar.zst
gsoc2013-empathy-195307cf5f411252ef09d9e03649430d4d71c6a4.zip
consolidate sensitivity management
svn path=/trunk/; revision=2323
Diffstat (limited to 'libempathy-gtk/empathy-contact-selector.c')
-rw-r--r--libempathy-gtk/empathy-contact-selector.c39
1 files changed, 24 insertions, 15 deletions
diff --git a/libempathy-gtk/empathy-contact-selector.c b/libempathy-gtk/empathy-contact-selector.c
index 0be3824f6..6b3d5790e 100644
--- a/libempathy-gtk/empathy-contact-selector.c
+++ b/libempathy-gtk/empathy-contact-selector.c
@@ -133,9 +133,26 @@ unset_blank_contact (EmpathyContactSelector *selector)
static void
-manage_blank_contact (EmpathyContactSelector *selector)
+manage_sensitivity (EmpathyContactSelector *selector)
{
EmpathyContactSelectorPriv *priv = GET_PRIV (selector);
+ gint children;
+
+ children = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (priv->store), NULL);
+ g_print ("Number of children %d\n", children);
+
+ if (children == 1 && priv->is_blank_set)
+ gtk_widget_set_sensitive (GTK_WIDGET (selector), FALSE);
+ else if (children)
+ gtk_widget_set_sensitive (GTK_WIDGET (selector), TRUE);
+ else
+ gtk_widget_set_sensitive (GTK_WIDGET (selector), FALSE);
+}
+
+
+static void
+manage_blank_contact (EmpathyContactSelector *selector)
+{
gboolean is_popup_shown;
g_object_get (selector, "popup-shown", &is_popup_shown, NULL);
@@ -149,15 +166,14 @@ manage_blank_contact (EmpathyContactSelector *selector)
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);
}
}
+
+ manage_sensitivity (selector);
}
@@ -189,17 +205,9 @@ empathy_store_row_changed_cb (EmpathyContactListStore *empathy_store,
gpointer data)
{
EmpathyContactSelector *selector = EMPATHY_CONTACT_SELECTOR (data);
- EmpathyContactSelectorPriv *priv = GET_PRIV (selector);
- gint children;
-
- children = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (priv->store), NULL);
- if (children == 1 && priv->is_blank_set)
- gtk_widget_set_sensitive (GTK_WIDGET (selector), FALSE);
- else if (children)
- gtk_widget_set_sensitive (GTK_WIDGET (selector), TRUE);
- else
- gtk_widget_set_sensitive (GTK_WIDGET (selector), FALSE);
+ g_print ("Row changed\n");
+ manage_sensitivity (selector);
}
@@ -244,7 +252,8 @@ empathy_contact_selector_constructor (GType type,
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (contact_selector), renderer,
"text", EMPATHY_CONTACT_LIST_STORE_COL_NAME, NULL);
- set_blank_contact (contact_selector);
+ manage_blank_contact (contact_selector);
+ manage_sensitivity (contact_selector);
object = G_OBJECT (contact_selector);
return object;