Commit b80c95f3 authored by Daniel Garcia Moreno's avatar Daniel Garcia Moreno
Browse files

Connect search button with search revealer

Fix #156
parent ab01ab4c
Pipeline #397017 passed with stages
in 3 minutes and 26 seconds
......@@ -137,6 +137,7 @@ enum
MESSAGE_CHANGED,
MESSAGE_EDITION_FINISHED,
SELECTION_CHANGED,
SEARCHBAR_TOGGLED,
LAST_SIGNAL
};
......@@ -626,6 +627,15 @@ emit_selection_changed (GtkTextBuffer * buf, GParamSpec * spec, GtrTab * tab)
g_signal_emit (G_OBJECT (tab), signals[SELECTION_CHANGED], 0);
}
static void
emit_searchbar_toggled (GtkRevealer *revealer,
GParamSpec *pspec,
GtrTab *tab)
{
gboolean revealed = gtk_revealer_get_child_revealed (revealer);
g_signal_emit (G_OBJECT (tab), signals[SEARCHBAR_TOGGLED], 0, revealed);
}
static void
update_status (GtrTab * tab, GtrMsg * msg, gpointer useless)
{
......@@ -805,6 +815,9 @@ gtr_tab_init (GtrTab * tab)
g_signal_connect (priv->progress_eventbox, "button-press-event",
G_CALLBACK (show_hide_revealer), tab);
g_signal_connect (priv->search_revealer, "notify::child-revealed",
G_CALLBACK (emit_searchbar_toggled), tab);
}
static void
......@@ -961,6 +974,15 @@ gtr_tab_class_init (GtrTabClass * klass)
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
signals[SEARCHBAR_TOGGLED] =
g_signal_new ("searchbar-toggled",
G_OBJECT_CLASS_TYPE (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GtrTabClass, searchbar_toggled),
NULL, NULL,
g_cclosure_marshal_VOID__BOOLEAN,
G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
/* Properties */
g_object_class_install_property (object_class,
PROP_NAME,
......
......@@ -68,6 +68,7 @@ struct _GtrTabClass
void (*message_changed) (GtrTab * tab, GtrMsg * msg);
void (*message_edition_finished) (GtrTab * tab, GtrMsg * msg);
void (*selection_changed) (GtrTab * tab);
void (*searchbar_toggled) (GtrTab * tab, gboolean revealed);
};
typedef enum
......
......@@ -510,6 +510,13 @@ gtr_window_class_init (GtrWindowClass *klass)
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass), GtrWindow, header_stack);
}
static void
searchbar_toggled (GtrTab * tab, gboolean revealed, GtrWindow *window)
{
GtrWindowPrivate *priv = gtr_window_get_instance_private (window);
gtr_notebook_enable_find_button (GTR_NOTEBOOK (priv->notebook), revealed);
}
/***************************** Public funcs ***********************************/
/**
......@@ -549,6 +556,8 @@ gtr_window_create_tab (GtrWindow * window, GtrPo * po)
G_CALLBACK
(update_saved_state),
window);
g_signal_connect (tab, "searchbar-toggled", G_CALLBACK (searchbar_toggled), window);
return tab;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment