From 1c2c2d0342f1b4fd335886c9508b055da6ff3190 Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Mon, 18 Aug 2014 22:17:50 +0200 Subject: [PATCH] Bind signal callbacks with gtk_widget_class_bind_template_callback() --- src/ag-window.c | 39 ++++++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/src/ag-window.c b/src/ag-window.c index 2f8f90a..bfdb6d0 100644 --- a/src/ag-window.c +++ b/src/ag-window.c @@ -984,7 +984,7 @@ ag_window_close_action(GSimpleAction *action, } } -gboolean +static gboolean ag_window_delete_event_callback(AgWindow *window, GdkEvent *event, gpointer user_data) @@ -992,7 +992,7 @@ ag_window_delete_event_callback(AgWindow *window, return (!ag_window_can_close(window, TRUE)); } -void +static void ag_window_tab_changed_cb(GtkStack *stack, GParamSpec *pspec, AgWindow *window) { GtkWidget *active_tab; @@ -1495,6 +1495,17 @@ ag_window_dispose(GObject *gobject) G_OBJECT_CLASS(ag_window_parent_class)->dispose(gobject); } +static void +ag_window_name_changed_cb(GtkEntry *name_entry, AgWindow *window) +{ + const gchar *name; + AgWindowPrivate *priv = ag_window_get_instance_private(window); + + name = gtk_entry_get_text(name_entry); + + gtk_header_bar_set_subtitle(GTK_HEADER_BAR(priv->header_bar), name); +} + static void ag_window_class_init(AgWindowClass *klass) { @@ -1618,6 +1629,19 @@ ag_window_class_init(AgWindowClass *klass) AgWindow, selection_toolbar ); + + gtk_widget_class_bind_template_callback( + widget_class, + ag_window_delete_event_callback + ); + gtk_widget_class_bind_template_callback( + widget_class, + ag_window_tab_changed_cb + ); + gtk_widget_class_bind_template_callback( + widget_class, + ag_window_name_changed_cb + ); } gboolean @@ -1787,17 +1811,6 @@ ag_window_change_tab(AgWindow *window, const gchar *tab_name) ); } -void -ag_window_name_changed_cb(GtkEntry *name_entry, AgWindow *window) -{ - const gchar *name; - AgWindowPrivate *priv = ag_window_get_instance_private(window); - - name = gtk_entry_get_text(name_entry); - - gtk_header_bar_set_subtitle(GTK_HEADER_BAR(priv->header_bar), name); -} - static void ag_window_add_chart_to_list(AgDbSave *save_data, AgWindow *window) {