common: Tick an unselected row when enter is pressed
This makes the dialog easier to use via keyboard navigation since otherwise we would just dismiss the dialog with the current selection on enter when the user actually intended to change the selection. https://bugzilla.gnome.org/show_bug.cgi?id=752001
This commit is contained in:
parent
7916040cea
commit
ae7b1a97eb
1 changed files with 23 additions and 0 deletions
|
@ -368,6 +368,26 @@ row_activated (GtkListBox *box,
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
activate_default (GtkWindow *window,
|
||||
GtkDialog *chooser)
|
||||
{
|
||||
CcLanguageChooserPrivate *priv = GET_PRIVATE (chooser);
|
||||
GtkWidget *focus;
|
||||
gchar *locale_id;
|
||||
|
||||
focus = gtk_window_get_focus (window);
|
||||
if (!focus)
|
||||
return;
|
||||
|
||||
locale_id = g_object_get_data (G_OBJECT (focus), "locale-id");
|
||||
if (g_strcmp0 (locale_id, priv->language) == 0)
|
||||
return;
|
||||
|
||||
g_signal_stop_emission_by_name (window, "activate-default");
|
||||
gtk_widget_activate (focus);
|
||||
}
|
||||
|
||||
static void
|
||||
cc_language_chooser_private_free (gpointer data)
|
||||
{
|
||||
|
@ -433,6 +453,9 @@ cc_language_chooser_new (GtkWidget *parent)
|
|||
|
||||
gtk_window_set_transient_for (GTK_WINDOW (chooser), GTK_WINDOW (parent));
|
||||
|
||||
g_signal_connect (chooser, "activate-default",
|
||||
G_CALLBACK (activate_default), chooser);
|
||||
|
||||
return chooser;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue