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.
This commit is contained in:
Matthias Clasen 2016-03-04 22:39:31 -05:00
parent d8dee2952a
commit 92662828ba
2 changed files with 7 additions and 2 deletions

View File

@ -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

View File

@ -33,7 +33,6 @@
<property name="halign">center</property>
<property name="valign">start</property>
<property name="wrap">1</property>
<property name="selectable">1</property>
<property name="max-width-chars">60</property>
</object>
<packing>
@ -47,7 +46,6 @@
<property name="halign">center</property>
<property name="valign">start</property>
<property name="wrap">1</property>
<property name="selectable">1</property>
<property name="max-width-chars">60</property>
</object>
<packing>