[gnome-builder] egg-search-bar: add EggSearchBar::reveal signal action



commit db093a51c96d93a14eb013ffca476988003a22f2
Author: Christian Hergert <christian hergert me>
Date:   Mon May 4 12:17:33 2015 -0700

    egg-search-bar: add EggSearchBar::reveal signal action
    
    This allows us to wire up an accelerator to display the search bar.

 contrib/egg/egg-search-bar.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/contrib/egg/egg-search-bar.c b/contrib/egg/egg-search-bar.c
index 4c7b923..ecd8cfd 100644
--- a/contrib/egg/egg-search-bar.c
+++ b/contrib/egg/egg-search-bar.c
@@ -50,6 +50,7 @@ enum {
 
 enum {
   ACTIVATE,
+  REVEAL,
   LAST_SIGNAL
 };
 
@@ -191,6 +192,17 @@ egg_search_bar_hierarchy_changed (GtkWidget *widget,
     }
 }
 
+static void
+egg_search_bar_reveal (EggSearchBar *self)
+{
+  EggSearchBarPrivate *priv = egg_search_bar_get_instance_private (self);
+
+  g_assert (EGG_IS_SEARCH_BAR (self));
+
+  gtk_revealer_set_reveal_child (priv->revealer, TRUE);
+  gtk_widget_grab_focus (GTK_WIDGET (priv->entry));
+}
+
 static GObject *
 egg_search_bar_get_internal_child (GtkBuildable *buildable,
                                    GtkBuilder   *builder,
@@ -290,6 +302,13 @@ egg_search_bar_class_init (EggSearchBarClass *klass)
                   G_TYPE_FROM_CLASS (klass),
                   G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
                   0, NULL, NULL, NULL, G_TYPE_NONE, 0);
+
+  gSignals [REVEAL] =
+    g_signal_new_class_handler ("reveal",
+                                G_TYPE_FROM_CLASS (klass),
+                                G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+                                G_CALLBACK (egg_search_bar_reveal),
+                                NULL, NULL, NULL, G_TYPE_NONE, 0);
 }
 
 static void


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