[gnome-calendar] window: properly show/hide search bar
- From: Erick Pérez Castellanos <erickpc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar] window: properly show/hide search bar
- Date: Fri, 9 Jan 2015 14:33:04 +0000 (UTC)
commit a00bc04f71de6a399e0e51f99aae82058fab5f00
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Wed Jan 7 16:46:21 2015 -0200
window: properly show/hide search bar
Instead of relaying on hacks, properly toggle visibility based on the GtkRevealer::child-revealed
property.
src/gcal-window.c | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/src/gcal-window.c b/src/gcal-window.c
index 7716d27..c97604f 100644
--- a/src/gcal-window.c
+++ b/src/gcal-window.c
@@ -215,6 +215,10 @@ static void search_toggled (GObject *o
static void search_changed (GtkEditable *editable,
gpointer user_data);
+static void search_bar_revealer_toggled (GObject *object,
+ GParamSpec *pspec,
+ gpointer user_data);
+
static void remove_event (GtkWidget *notification,
GParamSpec *spec,
gpointer user_data);
@@ -1081,6 +1085,19 @@ search_changed (GtkEditable *editable,
}
static void
+search_bar_revealer_toggled (GObject *object,
+ GParamSpec *pspec,
+ gpointer user_data)
+{
+ GcalWindowPrivate *priv;
+
+ priv = gcal_window_get_instance_private (GCAL_WINDOW (user_data));
+
+ if (!gtk_revealer_get_child_revealed (GTK_REVEALER (object)))
+ gtk_widget_hide (priv->search_bar);
+}
+
+static void
remove_event (GtkWidget *notification,
GParamSpec *spec,
gpointer user_data)
@@ -1289,6 +1306,9 @@ gcal_window_constructed (GObject *object)
gtk_search_bar_connect_entry (GTK_SEARCH_BAR (priv->search_bar),
GTK_ENTRY (priv->search_entry));
+ g_signal_connect (gtk_bin_get_child (GTK_BIN (priv->search_bar)), "notify::child-revealed",
+ G_CALLBACK (search_bar_revealer_toggled), object);
+
priv->views[GCAL_WINDOW_VIEW_WEEK] =
gcal_week_view_new (priv->manager);
gcal_week_view_set_first_weekday (
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]