[gtk/wip/matthiasc/shortcut-4: 131/139] label: Respect GtkPopover::mnemonics-visible



commit b19a0e385bc3da2765781bfc6c1d616b59178517
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Mar 24 12:44:08 2020 -0400

    label: Respect GtkPopover::mnemonics-visible
    
    When inside a popover, look to the popover for
    whether to show mnemonics or not.

 gtk/gtklabel.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
---
diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c
index 956a82c4da..1d591877bd 100644
--- a/gtk/gtklabel.c
+++ b/gtk/gtklabel.c
@@ -1960,14 +1960,14 @@ _gtk_label_mnemonics_visible_apply_recursively (GtkWidget *widget,
 }
 
 static void
-label_mnemonics_visible_changed (GtkWindow  *window,
+label_mnemonics_visible_changed (GtkWidget  *widget,
                                  GParamSpec *pspec,
                                  gpointer    data)
 {
   gboolean visible;
 
-  g_object_get (window, "mnemonics-visible", &visible, NULL);
-  _gtk_label_mnemonics_visible_apply_recursively (GTK_WIDGET (window), visible);
+  g_object_get (widget, "mnemonics-visible", &visible, NULL);
+  _gtk_label_mnemonics_visible_apply_recursively (widget, visible);
 }
 
 static void
@@ -4572,15 +4572,16 @@ connect_mnemonics_visible_notify (GtkLabel *label)
   GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
   GtkNative *native;
   gboolean connected;
+  gboolean mnemonics_visible;
 
   native = gtk_widget_get_native (GTK_WIDGET (label));
 
-  if (!GTK_IS_WINDOW (native))
+  if (!GTK_IS_WINDOW (native) && !GTK_IS_POPOVER (native))
     return;
 
   /* always set up this widgets initial value */
-  priv->mnemonics_visible =
-    gtk_window_get_mnemonics_visible (GTK_WINDOW (native));
+  g_object_get (native, "mnemonics-visible", &mnemonics_visible, NULL);
+  priv->mnemonics_visible = mnemonics_visible;
 
   connected =
     GPOINTER_TO_INT (g_object_get_qdata (G_OBJECT (native), quark_mnemonics_visible_connected));


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