Bind signal callbacks with gtk_widget_class_bind_template_callback()

This commit is contained in:
Gergely Polonkai 2014-08-18 22:17:50 +02:00
parent cdb856d8ed
commit 1c2c2d0342

View File

@ -984,7 +984,7 @@ ag_window_close_action(GSimpleAction *action,
} }
} }
gboolean static gboolean
ag_window_delete_event_callback(AgWindow *window, ag_window_delete_event_callback(AgWindow *window,
GdkEvent *event, GdkEvent *event,
gpointer user_data) gpointer user_data)
@ -992,7 +992,7 @@ ag_window_delete_event_callback(AgWindow *window,
return (!ag_window_can_close(window, TRUE)); return (!ag_window_can_close(window, TRUE));
} }
void static void
ag_window_tab_changed_cb(GtkStack *stack, GParamSpec *pspec, AgWindow *window) ag_window_tab_changed_cb(GtkStack *stack, GParamSpec *pspec, AgWindow *window)
{ {
GtkWidget *active_tab; GtkWidget *active_tab;
@ -1495,6 +1495,17 @@ ag_window_dispose(GObject *gobject)
G_OBJECT_CLASS(ag_window_parent_class)->dispose(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 static void
ag_window_class_init(AgWindowClass *klass) ag_window_class_init(AgWindowClass *klass)
{ {
@ -1618,6 +1629,19 @@ ag_window_class_init(AgWindowClass *klass)
AgWindow, AgWindow,
selection_toolbar 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 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 static void
ag_window_add_chart_to_list(AgDbSave *save_data, AgWindow *window) ag_window_add_chart_to_list(AgDbSave *save_data, AgWindow *window)
{ {