Commit 5dd0a8c4 authored by Bastien Nocera's avatar Bastien Nocera
Browse files

user-accounts: Move um_get_iter_for_language to common/

More sharing
parent 6a3b8be9
......@@ -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,
......
......@@ -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
......
......@@ -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,
......
......@@ -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);
......
......@@ -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);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment