[gnome-calendar/search-improvements] window: properly show/hide search bar
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar/search-improvements] window: properly show/hide search bar
- Date: Wed, 7 Jan 2015 18:46:30 +0000 (UTC)
commit f0cfefcee751801d0c31ac75d55e7d086d0aa07f
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 f3666ac..36ccc52 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]