[empathy] contact-chooser: add API to hide the search entry



commit e143c562674626fe318828f6045b733b14c5714f
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date:   Sat Oct 8 16:58:51 2011 -0400

    contact-chooser: add API to hide the search entry
    
    https://bugzilla.gnome.org/show_bug.cgi?id=629517

 libempathy-gtk/empathy-contact-chooser.c |   17 ++++++++++++-----
 libempathy-gtk/empathy-contact-chooser.h |    3 +++
 2 files changed, 15 insertions(+), 5 deletions(-)
---
diff --git a/libempathy-gtk/empathy-contact-chooser.c b/libempathy-gtk/empathy-contact-chooser.c
index e9269a9..10a3757 100644
--- a/libempathy-gtk/empathy-contact-chooser.c
+++ b/libempathy-gtk/empathy-contact-chooser.c
@@ -35,6 +35,7 @@ struct _EmpathyContactChooserPrivate
 
   EmpathyIndividualStore *store;
   EmpathyIndividualView *view;
+  GtkWidget *search_entry;
 
   GPtrArray *search_words;
   gchar *search_str;
@@ -285,7 +286,6 @@ empathy_contact_chooser_init (EmpathyContactChooser *self)
   EmpathyIndividualManager *mgr;
   GtkTreeSelection *selection;
   GtkWidget *scroll;
-  GtkWidget *search_entry;
   GQuark features[] = { TP_ACCOUNT_MANAGER_FEATURE_CORE, 0 };
 
   self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, EMPATHY_TYPE_CONTACT_CHOOSER,
@@ -300,11 +300,11 @@ empathy_contact_chooser_init (EmpathyContactChooser *self)
   tp_proxy_prepare_async (self->priv->account_mgr, features, NULL, NULL);
 
   /* Search entry */
-  search_entry = gtk_entry_new ();
-  gtk_box_pack_start (GTK_BOX (self), search_entry, FALSE, TRUE, 6);
-  gtk_widget_show (search_entry);
+  self->priv->search_entry = gtk_entry_new ();
+  gtk_box_pack_start (GTK_BOX (self), self->priv->search_entry, FALSE, TRUE, 6);
+  gtk_widget_show (self->priv->search_entry);
 
-  g_signal_connect (search_entry, "changed",
+  g_signal_connect (self->priv->search_entry, "changed",
       G_CALLBACK (search_text_changed), self);
 
   /* Add the treeview */
@@ -358,3 +358,10 @@ empathy_contact_chooser_set_filter_func (EmpathyContactChooser *self,
   self->priv->filter_func = func;
   self->priv->filter_data = user_data;
 }
+
+void
+empathy_contact_chooser_show_search_entry (EmpathyContactChooser *self,
+    gboolean show)
+{
+  gtk_widget_set_visible (self->priv->search_entry, show);
+}
diff --git a/libempathy-gtk/empathy-contact-chooser.h b/libempathy-gtk/empathy-contact-chooser.h
index ba95bcf..87466be 100644
--- a/libempathy-gtk/empathy-contact-chooser.h
+++ b/libempathy-gtk/empathy-contact-chooser.h
@@ -61,6 +61,9 @@ void empathy_contact_chooser_set_filter_func (EmpathyContactChooser *self,
     EmpathyContactChooserFilterFunc func,
     gpointer user_data);
 
+void empathy_contact_chooser_show_search_entry (EmpathyContactChooser *self,
+    gboolean show);
+
 G_END_DECLS
 
 #endif



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]