diff options
author | Benjamin Otte <otte@redhat.com> | 2018-03-09 00:35:18 +0100 |
---|---|---|
committer | Carlos Garnacho <carlosg@gnome.org> | 2018-04-26 17:59:41 +0200 |
commit | 40a082de10fc40de4294054a1584222f5679b0ca (patch) | |
tree | 8ee65c0377429580b806db31c4b56b152aea36eb | |
parent | 9c0acf62b47102e3b16b29839516f8528f5590d3 (diff) | |
download | gtk+-40a082de10fc40de4294054a1584222f5679b0ca.tar.gz |
aboutdialog: Put event controllers into ui file
-rw-r--r-- | gtk/gtkaboutdialog.c | 30 | ||||
-rw-r--r-- | gtk/ui/gtkaboutdialog.ui | 30 |
2 files changed, 33 insertions, 27 deletions
diff --git a/gtk/gtkaboutdialog.c b/gtk/gtkaboutdialog.c index a6aec53265..49d890dddf 100644 --- a/gtk/gtkaboutdialog.c +++ b/gtk/gtkaboutdialog.c @@ -185,13 +185,6 @@ struct _GtkAboutDialogPrivate GSList *visited_links; - GtkGesture *license_press; - GtkGesture *system_press; - GtkEventController *license_motion; - GtkEventController *system_motion; - GtkEventController *license_key; - GtkEventController *system_key; - GtkLicense license_type; guint hovering_over_link : 1; @@ -614,6 +607,9 @@ gtk_about_dialog_class_init (GtkAboutDialogClass *klass) gtk_widget_class_bind_template_child_private (widget_class, GtkAboutDialog, system_view); gtk_widget_class_bind_template_callback (widget_class, emit_activate_link); + gtk_widget_class_bind_template_callback (widget_class, text_view_released); + gtk_widget_class_bind_template_callback (widget_class, text_view_motion); + gtk_widget_class_bind_template_callback (widget_class, text_view_key_pressed); gtk_widget_class_bind_template_callback (widget_class, stack_visible_child_notify); } @@ -777,19 +773,6 @@ gtk_about_dialog_init (GtkAboutDialog *about) switch_page (about, "main"); update_stack_switcher_visibility (about); - priv->license_press = gtk_gesture_multi_press_new (priv->license_view); - g_signal_connect (priv->license_press, "released", G_CALLBACK (text_view_released), about); - priv->system_press = gtk_gesture_multi_press_new (priv->system_view); - g_signal_connect (priv->system_press, "released", G_CALLBACK (text_view_released), about); - priv->license_motion = gtk_event_controller_motion_new (priv->license_view); - g_signal_connect (priv->license_motion, "motion", G_CALLBACK (text_view_motion), about); - priv->system_motion = gtk_event_controller_motion_new (priv->system_view); - g_signal_connect (priv->system_motion, "motion", G_CALLBACK (text_view_motion), about); - priv->license_key = gtk_event_controller_key_new (priv->license_view); - g_signal_connect (priv->license_key, "key-pressed", G_CALLBACK (text_view_key_pressed), about); - priv->system_key = gtk_event_controller_key_new (priv->system_view); - g_signal_connect (priv->system_key, "key-pressed", G_CALLBACK (text_view_key_pressed), about); - /* force defaults */ gtk_about_dialog_set_program_name (about, NULL); gtk_about_dialog_set_logo (about, NULL); @@ -826,13 +809,6 @@ gtk_about_dialog_finalize (GObject *object) g_slist_free_full (priv->credit_sections, destroy_credit_section); g_slist_free_full (priv->visited_links, g_free); - g_object_unref (priv->license_press); - g_object_unref (priv->system_press); - g_object_unref (priv->license_motion); - g_object_unref (priv->system_motion); - g_object_unref (priv->license_key); - g_object_unref (priv->system_key); - G_OBJECT_CLASS (gtk_about_dialog_parent_class)->finalize (object); } diff --git a/gtk/ui/gtkaboutdialog.ui b/gtk/ui/gtkaboutdialog.ui index f48ed4c9b9..180151f66e 100644 --- a/gtk/ui/gtkaboutdialog.ui +++ b/gtk/ui/gtkaboutdialog.ui @@ -157,6 +157,21 @@ <property name="left-margin">8</property> <property name="right-margin">8</property> <property name="cursor-visible">0</property> + <child> + <object class="GtkGestureMultiPress"> + <signal name="released" handler="text_view_released" swapped="no"/> + </object> + </child> + <child> + <object class="GtkEventControllerMotion"> + <signal name="motion" handler="text_view_motion" swapped="no"/> + </object> + </child> + <child> + <object class="GtkEventControllerKey"> + <signal name="key-pressed" handler="text_view_key_pressed" swapped="no"/> + </object> + </child> </object> </child> </object> @@ -183,6 +198,21 @@ <property name="left-margin">8</property> <property name="right-margin">8</property> <property name="cursor-visible">0</property> + <child> + <object class="GtkGestureMultiPress"> + <signal name="released" handler="text_view_released" swapped="no"/> + </object> + </child> + <child> + <object class="GtkEventControllerMotion"> + <signal name="motion" handler="text_view_motion" swapped="no"/> + </object> + </child> + <child> + <object class="GtkEventControllerKey"> + <signal name="key-pressed" handler="text_view_key_pressed" swapped="no"/> + </object> + </child> </object> </child> </object> |