[gnome-control-center] user-accounts: Move um_get_iter_for_language to common/
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] user-accounts: Move um_get_iter_for_language to common/
- Date: Mon, 24 Jan 2011 18:21:01 +0000 (UTC)
commit 5dd0a8c47a54531dadebff4cb017bf4d82c74a7d
Author: Bastien Nocera <hadess hadess net>
Date: Mon Jan 24 18:15:03 2011 +0000
user-accounts: Move um_get_iter_for_language to common/
More sharing
panels/common/cc-common-language.c | 8 +++---
panels/common/cc-common-language.h | 7 +++--
panels/user-accounts/um-language-dialog.c | 33 -----------------------------
panels/user-accounts/um-language-dialog.h | 3 --
panels/user-accounts/um-user-panel.c | 6 +++-
5 files changed, 12 insertions(+), 45 deletions(-)
---
diff --git a/panels/common/cc-common-language.c b/panels/common/cc-common-language.c
index a78c1d7..dcc71d5 100644
--- a/panels/common/cc-common-language.c
+++ b/panels/common/cc-common-language.c
@@ -106,11 +106,10 @@ cc_common_language_sort_languages (GtkTreeModel *model,
return result;
}
-#if 0
gboolean
-um_get_iter_for_language (GtkTreeModel *model,
- const gchar *lang,
- GtkTreeIter *iter)
+cc_common_language_get_iter_for_language (GtkTreeModel *model,
+ const gchar *lang,
+ GtkTreeIter *iter)
{
char *l;
char *name;
@@ -140,6 +139,7 @@ um_get_iter_for_language (GtkTreeModel *model,
return FALSE;
}
+#if 0
static void
row_activated (GtkTreeView *tree_view,
GtkTreePath *path,
diff --git a/panels/common/cc-common-language.h b/panels/common/cc-common-language.h
index 4351826..0342e62 100644
--- a/panels/common/cc-common-language.h
+++ b/panels/common/cc-common-language.h
@@ -29,9 +29,6 @@ G_BEGIN_DECLS
#if 0
void um_add_user_languages (GtkTreeModel *model);
gchar *um_get_current_language (void);
-gboolean um_get_iter_for_language (GtkTreeModel *model,
- const gchar *lang,
- GtkTreeIter *iter);
GtkWidget *um_language_chooser_new (void);
gchar *um_language_chooser_get_language (GtkWidget *chooser);
@@ -41,6 +38,10 @@ gint cc_common_language_sort_languages (GtkTreeModel *model,
GtkTreeIter *a,
GtkTreeIter *b,
gpointer data);
+gboolean cc_common_language_get_iter_for_language (GtkTreeModel *model,
+ const gchar *lang,
+ GtkTreeIter *iter);
+
G_END_DECLS
diff --git a/panels/user-accounts/um-language-dialog.c b/panels/user-accounts/um-language-dialog.c
index 6eee2ee..9407ec0 100644
--- a/panels/user-accounts/um-language-dialog.c
+++ b/panels/user-accounts/um-language-dialog.c
@@ -78,39 +78,6 @@ um_language_chooser_get_language (GtkWidget *chooser)
return lang;
}
-gboolean
-um_get_iter_for_language (GtkTreeModel *model,
- const gchar *lang,
- GtkTreeIter *iter)
-{
- char *l;
- char *name;
- char *language;
-
- gtk_tree_model_get_iter_first (model, iter);
- do {
- gtk_tree_model_get (model, iter, LOCALE_COL, &l, -1);
- if (g_strcmp0 (l, lang) == 0) {
- g_free (l);
- return TRUE;
- }
- g_free (l);
- } while (gtk_tree_model_iter_next (model, iter));
-
- name = gdm_normalize_language_name (lang);
- if (name != NULL) {
- language = gdm_get_language_from_name (name, NULL);
-
- gtk_list_store_append (GTK_LIST_STORE (model), iter);
- gtk_list_store_set (GTK_LIST_STORE (model), iter, LOCALE_COL, name, DISPLAY_LOCALE_COL, language, -1);
- g_free (name);
- g_free (language);
- return TRUE;
- }
-
- return FALSE;
-}
-
static void
row_activated (GtkTreeView *tree_view,
GtkTreePath *path,
diff --git a/panels/user-accounts/um-language-dialog.h b/panels/user-accounts/um-language-dialog.h
index 6541c77..d498c9c 100644
--- a/panels/user-accounts/um-language-dialog.h
+++ b/panels/user-accounts/um-language-dialog.h
@@ -31,9 +31,6 @@ typedef struct _UmLanguageDialog UmLanguageDialog;
void um_add_user_languages (GtkTreeModel *model);
gchar *um_get_current_language (void);
-gboolean um_get_iter_for_language (GtkTreeModel *model,
- const gchar *lang,
- GtkTreeIter *iter);
GtkWidget *um_language_chooser_new (void);
gchar *um_language_chooser_get_language (GtkWidget *chooser);
diff --git a/panels/user-accounts/um-user-panel.c b/panels/user-accounts/um-user-panel.c
index e2a2e12..40cf89e 100644
--- a/panels/user-accounts/um-user-panel.c
+++ b/panels/user-accounts/um-user-panel.c
@@ -57,6 +57,8 @@
#include "um-fingerprint-dialog.h"
#include "um-utils.h"
+#include "cc-common-language.h"
+
G_DEFINE_DYNAMIC_TYPE (UmUserPanel, um_user_panel, CC_TYPE_PANEL)
#define UM_USER_PANEL_PRIVATE(o) \
@@ -528,7 +530,7 @@ show_user (UmUser *user, UmUserPanelPrivate *d)
lang = g_strdup (um_user_get_language (user));
if (!lang)
lang = um_get_current_language ();
- um_get_iter_for_language (model, lang, &iter);
+ cc_common_language_get_iter_for_language (model, lang, &iter);
um_editable_combo_set_active_iter (UM_EDITABLE_COMBO (widget), &iter);
g_free (lang);
@@ -627,7 +629,7 @@ language_response (GtkDialog *dialog,
if (!lang)
lang = um_get_current_language ();
}
- um_get_iter_for_language (model, lang, &iter);
+ cc_common_language_get_iter_for_language (model, lang, &iter);
um_editable_combo_set_active_iter (UM_EDITABLE_COMBO (combo), &iter);
g_free (lang);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]