From 92662828ba43c2d3507bb8f4dc253f2f429e91ae Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 4 Mar 2016 22:39:31 -0500 Subject: [PATCH] messagedialog: Respect the gtk-keynav-use-caret setting We used to always make the labels in message dialogs selectable, which is a bit problematic wrt. to keynav - the label can unexpectedly 'turn blue', which irritates some people. With the new gtk-keynav-use-caret setting, we can now only make the labels selectable when it is required for accessibilty reasons. --- gtk/gtkmessagedialog.c | 7 +++++++ gtk/ui/gtkmessagedialog.ui | 2 -- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/gtk/gtkmessagedialog.c b/gtk/gtkmessagedialog.c index a242afd370..ae6f5e57d0 100644 --- a/gtk/gtkmessagedialog.c +++ b/gtk/gtkmessagedialog.c @@ -310,6 +310,8 @@ gtk_message_dialog_init (GtkMessageDialog *dialog) { GtkMessageDialogPrivate *priv; GtkWidget *action_area; + GtkSettings *settings; + gboolean use_caret; dialog->priv = gtk_message_dialog_get_instance_private (dialog); priv = dialog->priv; @@ -326,6 +328,11 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS action_area = gtk_dialog_get_action_area (GTK_DIALOG (dialog)); G_GNUC_END_IGNORE_DEPRECATIONS gtk_button_box_set_layout (GTK_BUTTON_BOX (action_area), GTK_BUTTONBOX_EXPAND); + + settings = gtk_widget_get_settings (GTK_WIDGET (dialog)); + g_object_get (settings, "gtk-keynav-use-caret", &use_caret, NULL); + gtk_label_set_selectable (GTK_LABEL (priv->label), use_caret); + gtk_label_set_selectable (GTK_LABEL (priv->secondary_label), use_caret); } static void diff --git a/gtk/ui/gtkmessagedialog.ui b/gtk/ui/gtkmessagedialog.ui index 861454375c..32f1f71505 100644 --- a/gtk/ui/gtkmessagedialog.ui +++ b/gtk/ui/gtkmessagedialog.ui @@ -33,7 +33,6 @@ center start 1 - 1 60 @@ -47,7 +46,6 @@ center start 1 - 1 60