[gtk/shortcuts-rebased-again: 3/6] Set names on shortcut controllers



commit 433d4e395a184fae214aafd3884c25254acc9b71
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 | 4 ++++
 3 files changed, 8 insertions(+)
---
diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c
index 0e190a357b..5d8c2f8d2b 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 f683149eb7..b0bc184569 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 47d1b2b636..063e57ec31 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -1873,6 +1873,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),
@@ -3075,6 +3076,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]