[gnome-initial-setup] keyboard: Don't choose irrelevant layouts as first level choices
- From: Rui Matos <rtcm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-initial-setup] keyboard: Don't choose irrelevant layouts as first level choices
- Date: Thu, 30 Oct 2014 18:01:55 +0000 (UTC)
commit 9acab741946a2d7f8ceaf93d14212dd7af21d2d5
Author: Rui Matos <tiagomatos gmail com>
Date: Thu Oct 30 18:52:41 2014 +0100
keyboard: Don't choose irrelevant layouts as first level choices
If the language and country layouts aren't enough to fill our first
level number of rows we would end up showing totally irrelevant
layouts which looks bad and defeats the purpose of the initial
filtering.
.../pages/keyboard/cc-input-chooser.c | 38 +++++++++++++++++---
1 files changed, 33 insertions(+), 5 deletions(-)
---
diff --git a/gnome-initial-setup/pages/keyboard/cc-input-chooser.c
b/gnome-initial-setup/pages/keyboard/cc-input-chooser.c
index f11c708..c5bd085 100644
--- a/gnome-initial-setup/pages/keyboard/cc-input-chooser.c
+++ b/gnome-initial-setup/pages/keyboard/cc-input-chooser.c
@@ -324,6 +324,36 @@ no_results_widget_new (void)
}
static void
+choose_non_extras_foreach (GtkWidget *row,
+ gpointer user_data)
+{
+ GtkWidget *child;
+ InputWidget *widget;
+ guint *count = user_data;
+
+ *count += 1;
+ if (*count > MIN_ROWS)
+ return;
+
+ child = gtk_bin_get_child (GTK_BIN (row));
+ widget = get_input_widget (child);
+ if (widget == NULL)
+ return;
+
+ widget->is_extra = FALSE;
+}
+
+static void
+choose_non_extras (CcInputChooser *chooser)
+{
+ CcInputChooserPrivate *priv = cc_input_chooser_get_instance_private (chooser);
+ guint count = 0;
+
+ gtk_container_foreach (GTK_CONTAINER (priv->input_list),
+ choose_non_extras_foreach, &count);
+}
+
+static void
add_rows_to_list (CcInputChooser *chooser,
GList *list,
const gchar *type,
@@ -348,11 +378,7 @@ add_rows_to_list (CcInputChooser *chooser,
}
g_hash_table_add (priv->inputs, key);
- if (g_hash_table_size (priv->inputs) > MIN_ROWS)
- is_extra = TRUE;
- else
- is_extra = FALSE;
- widget = input_widget_new (chooser, type, id, is_extra);
+ widget = input_widget_new (chooser, type, id, TRUE);
gtk_container_add (GTK_CONTAINER (priv->input_list), widget);
}
}
@@ -394,6 +420,8 @@ get_locale_infos (CcInputChooser *chooser)
add_rows_to_list (chooser, list, INPUT_SOURCE_TYPE_XKB, id);
g_list_free (list);
+ choose_non_extras (chooser);
+
list = gnome_xkb_info_get_all_layouts (priv->xkb_info);
add_rows_to_list (chooser, list, INPUT_SOURCE_TYPE_XKB, id);
g_list_free (list);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]