window: properly show/hide search bar
Instead of relaying on hacks, properly toggle visibility based on the GtkRevealer::child-revealed property.
This commit is contained in:
committed by
Erick Pérez Castellanos
parent
7f24744455
commit
a00bc04f71
@@ -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);
|
||||
@@ -1080,6 +1084,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,
|
||||
@@ -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 (
|
||||
|
||||
Reference in New Issue
Block a user