[gnome-initial-setup] language: Split out label widget creation
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-initial-setup] language: Split out label widget creation
- Date: Thu, 3 Jan 2013 07:32:31 +0000 (UTC)
commit 3243e8ec9c0c75bb1368754cf57acf69808b8699
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Wed Jan 2 11:31:53 2013 -0500
language: Split out label widget creation
.../pages/language/gis-language-page.c | 33 ++++++++++++++------
1 files changed, 23 insertions(+), 10 deletions(-)
---
diff --git a/gnome-initial-setup/pages/language/gis-language-page.c b/gnome-initial-setup/pages/language/gis-language-page.c
index db424c2..8f6a3e2 100644
--- a/gnome-initial-setup/pages/language/gis-language-page.c
+++ b/gnome-initial-setup/pages/language/gis-language-page.c
@@ -111,6 +111,26 @@ use_language (char *locale_id)
return g_strdup_printf (use, language);
}
+static GtkWidget *
+language_widget_new (char *locale_id,
+ gboolean is_extra)
+{
+ gchar *locale_name;
+ GtkWidget *widget;
+
+ locale_name = use_language (locale_id);
+
+ widget = gtk_label_new (locale_name);
+ g_object_set_data (G_OBJECT (widget), "locale-id",
+ locale_id);
+ g_object_set_data (G_OBJECT (widget), "locale-name",
+ locale_name);
+ g_object_set_data (G_OBJECT (widget), "is-extra",
+ GUINT_TO_POINTER (is_extra));
+
+ return widget;
+}
+
static void
add_languages (GisLanguagePage *page,
char **locale_ids,
@@ -123,7 +143,6 @@ add_languages (GisLanguagePage *page,
while (*locale_ids) {
gchar *locale_id;
- gchar *locale_name;
gboolean is_extra;
GtkWidget *widget;
@@ -135,16 +154,8 @@ add_languages (GisLanguagePage *page,
continue;
is_extra = (g_hash_table_lookup (initial, locale_id) != NULL);
- locale_name = use_language (locale_id);
- widget = gtk_label_new (locale_name);
- g_object_set_data (G_OBJECT (widget), "locale-id",
- locale_id);
- g_object_set_data (G_OBJECT (widget), "locale-name",
- locale_name);
- g_object_set_data (G_OBJECT (widget), "is-extra",
- GUINT_TO_POINTER (is_extra));
- gtk_widget_show (widget);
+ widget = language_widget_new (locale_id, is_extra);
gtk_container_add (GTK_CONTAINER (priv->language_list),
widget);
@@ -153,6 +164,8 @@ add_languages (GisLanguagePage *page,
egg_list_box_select_child (EGG_LIST_BOX (priv->language_list), widget);
}
+ gtk_widget_show_all (priv->language_list);
+
priv->adding_languages = FALSE;
setlocale (LC_MESSAGES, orig_locale_id);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]