[gtk/shortcuts-rebased-again: 117/145] Set names on shortcut controllers



commit b8794d768bac7385642dca7ee449e12b70b66396
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Jun 19 11:10:40 2019 +0000

    Set names on shortcut controllers

 gtk/gtklabel.c  | 1 +
 gtk/gtkwidget.c | 3 +++
 gtk/gtkwindow.c | 5 +++++
 3 files changed, 9 insertions(+)
---
diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c
index 4e557e8a8f..c1fceb01c2 100644
--- a/gtk/gtklabel.c
+++ b/gtk/gtklabel.c
@@ -1798,6 +1798,7 @@ gtk_label_setup_mnemonic (GtkLabel *label)
   if (priv->mnemonic_controller == NULL)
     {
       priv->mnemonic_controller = gtk_shortcut_controller_new ();
+      gtk_event_controller_set_name (priv->mnemonic_controller, "mnemonic");
       gtk_event_controller_set_propagation_phase (priv->mnemonic_controller, GTK_PHASE_CAPTURE);
       gtk_shortcut_controller_set_scope (GTK_SHORTCUT_CONTROLLER (priv->mnemonic_controller), 
GTK_SHORTCUT_SCOPE_MANAGED);
 
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index ffdf0bcc01..05ef6c6ccf 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -2880,11 +2880,13 @@ gtk_widget_init (GTypeInstance *instance, gpointer g_class)
       model = gtk_concat_model_new (GTK_TYPE_SHORTCUT);
       g_object_set_data_full (G_OBJECT (widget), "gtk-shortcut-manager-bubble", model, g_object_unref);
       controller = gtk_shortcut_controller_new_for_model (G_LIST_MODEL (model));
+      gtk_event_controller_set_name (controller, "shortcut manager bubble");
       gtk_widget_add_controller (widget, controller);
 
       model = gtk_concat_model_new (GTK_TYPE_SHORTCUT);
       g_object_set_data_full (G_OBJECT (widget), "gtk-shortcut-manager-capture", model, g_object_unref);
       controller = gtk_shortcut_controller_new_for_model (G_LIST_MODEL (model));
+      gtk_event_controller_set_name (controller, "shortcut manager capture");
       gtk_event_controller_set_propagation_phase (controller, GTK_PHASE_CAPTURE);
       gtk_widget_add_controller (widget, controller);
     }
@@ -2894,6 +2896,7 @@ gtk_widget_init (GTypeInstance *instance, gpointer g_class)
     gtk_widget_set_layout_manager (widget, g_object_new (layout_manager_type, NULL));
 
   controller = gtk_shortcut_controller_new_for_model (G_LIST_MODEL (GTK_WIDGET_CLASS 
(g_class)->priv->shortcuts));
+  gtk_event_controller_set_name (controller, "class shortcuts");
   gtk_widget_add_controller (widget, controller);
 }
 
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 9167b55b02..8a371bbe60 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -1876,6 +1876,7 @@ gtk_window_init (GtkWindow *window)
 
   priv->key_controller = gtk_event_controller_key_new ();
   gtk_event_controller_set_propagation_phase (priv->key_controller, GTK_PHASE_CAPTURE);
+  gtk_event_controller_set_name (priv->key_controller, "window focus");
   g_signal_connect_swapped (priv->key_controller, "focus-in",
                             G_CALLBACK (gtk_window_focus_in), window);
   g_signal_connect_swapped (priv->key_controller, "focus-out",
@@ -1887,6 +1888,7 @@ gtk_window_init (GtkWindow *window)
   gtk_widget_add_controller (widget, priv->key_controller);
 
   controller = gtk_shortcut_controller_new ();
+  gtk_event_controller_set_name (controller, "window menubar");
   gtk_event_controller_set_propagation_phase (controller, GTK_PHASE_CAPTURE);
 
   shortcut = gtk_shortcut_new (gtk_keyval_trigger_new (MENU_BAR_ACCEL, 0),
@@ -3089,6 +3091,9 @@ gtk_window_set_application (GtkWindow      *window,
 
           app_accels = gtk_application_get_application_accels (priv->application);
           priv->application_shortcut_controller = gtk_shortcut_controller_new_for_model 
(gtk_application_accels_get_shortcuts (app_accels));
+          g_object_set (priv->application_shortcut_controller,
+                        "name", "application shortcuts",
+                        NULL);
           gtk_event_controller_set_propagation_phase (priv->application_shortcut_controller, 
GTK_PHASE_CAPTURE);
           gtk_shortcut_controller_set_scope (GTK_SHORTCUT_CONTROLLER 
(priv->application_shortcut_controller), GTK_SHORTCUT_SCOPE_GLOBAL);
           gtk_widget_add_controller (GTK_WIDGET (window), priv->application_shortcut_controller);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]