summaryrefslogtreecommitdiff
path: root/examples/application7
diff options
context:
space:
mode:
authorMohammed Sadiq <sadiq@sadiqpk.org>2018-05-08 18:17:54 +0530
committerMohammed Sadiq <sadiq@sadiqpk.org>2018-05-08 18:55:48 +0530
commit8fcc401e05b9db074fbdf2cc83c497aae1df477b (patch)
tree1c28cda04d8ddd703f5aa6eae6586a97b5d58581 /examples/application7
parentf07b1313621ca7e69d236161f9b96578fc98e435 (diff)
downloadgtk+-8fcc401e05b9db074fbdf2cc83c497aae1df477b.tar.gz
examples: Take advantage of user_data passed
The last parameter of the signal callback from .ui is the template's object from which the class is derived. And so, we already have access to the window object. Let's just use it.
Diffstat (limited to 'examples/application7')
-rw-r--r--examples/application7/exampleappwin.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/examples/application7/exampleappwin.c b/examples/application7/exampleappwin.c
index f7f7d15d88..38ec027128 100644
--- a/examples/application7/exampleappwin.c
+++ b/examples/application7/exampleappwin.c
@@ -16,9 +16,9 @@ struct _ExampleAppWindow
G_DEFINE_TYPE (ExampleAppWindow, example_app_window, GTK_TYPE_APPLICATION_WINDOW)
static void
-search_text_changed (GtkEntry *entry)
+search_text_changed (GtkEntry *entry,
+ ExampleAppWindow *win)
{
- ExampleAppWindow *win;
const gchar *text;
GtkWidget *tab;
GtkWidget *view;
@@ -30,8 +30,6 @@ search_text_changed (GtkEntry *entry)
if (text[0] == '\0')
return;
- win = EXAMPLE_APP_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (entry)));
-
tab = gtk_stack_get_visible_child (GTK_STACK (win->stack));
view = gtk_bin_get_child (GTK_BIN (tab));
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
@@ -48,16 +46,13 @@ search_text_changed (GtkEntry *entry)
}
static void
-visible_child_changed (GObject *stack,
- GParamSpec *pspec)
+visible_child_changed (GObject *stack,
+ GParamSpec *pspec,
+ ExampleAppWindow *win)
{
- ExampleAppWindow *win;
-
if (gtk_widget_in_destruction (GTK_WIDGET (stack)))
return;
- win = EXAMPLE_APP_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (stack)));
-
gtk_search_bar_set_search_mode (GTK_SEARCH_BAR (win->searchbar), FALSE);
}