[gtranslator] Factor out GtrLanguagesFetcher.



commit 3315acda168a1f9412dfc5f070400ae24e0eab9a
Author: Ignacio Casal Quinteiro <icq gnome org>
Date:   Mon Apr 4 16:34:22 2011 +0200

    Factor out GtrLanguagesFetcher.
    
    New object that takes care of filling the comboboxes and
    managing the changes on them.
    Also Use this object in the profile dialog.

 src/dialogs/Makefile.am              |   32 ++--
 src/dialogs/gtr-languages-fetcher.c  |  443 ++++++++++++++++++++++++++++++++++
 src/dialogs/gtr-languages-fetcher.h  |   88 +++++++
 src/dialogs/gtr-languages-fetcher.ui |  251 +++++++++++++++++++
 src/dialogs/gtr-profile-dialog.c     |  301 +++---------------------
 src/dialogs/gtr-profile-dialog.ui    |  313 +-----------------------
 6 files changed, 838 insertions(+), 590 deletions(-)
---
diff --git a/src/dialogs/Makefile.am b/src/dialogs/Makefile.am
index 3e1ebc4..2bf8c83 100644
--- a/src/dialogs/Makefile.am
+++ b/src/dialogs/Makefile.am
@@ -1,14 +1,11 @@
 INCLUDES =                                                      \
-        -I$(top_srcdir)                                         \
-        -I$(top_builddir)                                       \
-        -I$(top_srcdir)/src                                     \
-        -I$(top_builddir)/src                                   \
-	-I$(top_srcdir)/src/plugin-system			\
-	-DPKGDATADIR=\""$(pkgdatadir)"\"			\
-	-DPIXMAPSDIR=\""$(datadir)"/pixmaps/gtranslator\"	\
-        $(GTRANSLATOR_CFLAGS)                                   \
-        $(WARN_CFLAGS)                                          \
-        $(DISABLE_DEPRECATED)
+	-I$(top_srcdir)                                         \
+	-I$(top_builddir)                                       \
+	-I$(top_srcdir)/src                                     \
+	-I$(top_builddir)/src                                   \
+	$(GTRANSLATOR_CFLAGS)                                   \
+	$(WARN_CFLAGS)                                          \
+	$(DISABLE_DEPRECATED)
 
 noinst_LTLIBRARIES = \
 	libdialogs.la
@@ -18,6 +15,8 @@ libdialogs_la_SOURCES = \
 	gtr-close-confirmation-dialog.h \
 	gtr-file-dialogs.c \
 	gtr-file-dialogs.h \
+	gtr-languages-fetcher.c \
+	gtr-languages-fetcher.h \
 	gtr-preferences-dialog.c \
 	gtr-preferences-dialog.h \
 	gtr-search-dialog.c \
@@ -33,13 +32,14 @@ libdialogs_la_SOURCES = \
 
 uidir = $(pkgdatadir)/ui
 ui_DATA =  \
-		gtr-preferences-dialog.ui \
-		gtr-search-dialog.ui \
-		gtr-header-dialog.ui \
-		gtr-profile-dialog.ui \
-		gtr-jump-dialog.ui
+	gtr-preferences-dialog.ui \
+	gtr-search-dialog.ui \
+	gtr-header-dialog.ui \
+	gtr-profile-dialog.ui \
+	gtr-jump-dialog.ui \
+	gtr-languages-fetcher.ui
 
 EXTRA_DIST = \
-		$(ui_DATA)
+	$(ui_DATA)
 
 -include $(top_srcdir)/git.mk
diff --git a/src/dialogs/gtr-languages-fetcher.c b/src/dialogs/gtr-languages-fetcher.c
new file mode 100644
index 0000000..ffbd82e
--- /dev/null
+++ b/src/dialogs/gtr-languages-fetcher.c
@@ -0,0 +1,443 @@
+/*
+ * gtr-languages-fetcher.c
+ * This file is part of gtranslator
+ *
+ * Copyright (C) 2011 - Ignacio Casal Quinteiro
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "gtr-dirs.h"
+#include "gtr-languages-fetcher.h"
+#include "gtr-language.h"
+#include "gtr-utils.h"
+#include <string.h>
+
+#define GTR_LANGUAGES_FETCHER_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE((object), GTR_TYPE_LANGUAGES_FETCHER, GtrLanguagesFetcherPrivate))
+
+struct _GtrLanguagesFetcherPrivate
+{
+  GtkWidget *language;
+  GtkWidget *language_code;
+  GtkWidget *charset;
+  GtkWidget *encoding;
+  GtkWidget *team_email;
+  GtkWidget *plural_forms;
+
+  GtkListStore *language_store;
+  GtkListStore *code_store;
+};
+
+G_DEFINE_TYPE (GtrLanguagesFetcher, gtr_languages_fetcher, GTK_TYPE_VBOX)
+
+static void
+gtr_languages_fetcher_finalize (GObject *object)
+{
+  G_OBJECT_CLASS (gtr_languages_fetcher_parent_class)->finalize (object);
+}
+
+static void
+gtr_languages_fetcher_class_init (GtrLanguagesFetcherClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+  object_class->finalize = gtr_languages_fetcher_finalize;
+
+  g_type_class_add_private (object_class, sizeof (GtrLanguagesFetcherPrivate));
+}
+
+static void
+append_from_languages (GtrLanguagesFetcher *fetcher)
+{
+  const GSList *languages, *l;
+  GHashTable *plurals;
+
+  plurals = g_hash_table_new (g_str_hash, g_int_equal);
+
+  languages = gtr_language_get_languages ();
+
+  for (l = languages; l != NULL; l = (const GSList *)g_list_next (l))
+    {
+      GtrLanguage *lang = (GtrLanguage *)l->data;
+      GtkTreeIter iter1, iter2;
+      const gchar *plural_form;
+
+      gtk_list_store_append (fetcher->priv->language_store, &iter1);
+      gtk_list_store_set (fetcher->priv->language_store, &iter1,
+                          0, gtr_language_get_name (lang),
+                          1, lang,
+                          -1);
+
+      gtk_list_store_append (fetcher->priv->code_store, &iter2);
+      gtk_list_store_set (fetcher->priv->code_store, &iter2,
+                          0, gtr_language_get_code (lang),
+                          1, lang,
+                          -1);
+
+      plural_form = gtr_language_get_plural_form (lang);
+      if (plural_form != NULL && *plural_form != '\0')
+        {
+          gint *value;
+
+          value = g_hash_table_lookup (plurals, plural_form);
+          if (value == NULL)
+            {
+              g_hash_table_insert (plurals, (gchar *)plural_form, GINT_TO_POINTER (1));
+              gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (fetcher->priv->plural_forms),
+                                              plural_form);
+            }
+        }
+    }
+
+    g_hash_table_unref (plurals);
+}
+
+static void
+fill_encoding_and_charset (GtrLanguagesFetcher *fetcher)
+{
+  const gchar *text;
+
+  text = gtk_entry_get_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (fetcher->priv->charset))));
+
+  if (text == NULL || *text == '\0')
+    gtk_combo_box_set_active (GTK_COMBO_BOX (fetcher->priv->charset), 0);
+
+  text = gtk_entry_get_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (fetcher->priv->encoding))));
+
+  if (text == NULL || *text == '\0')
+    gtk_combo_box_set_active (GTK_COMBO_BOX (fetcher->priv->encoding), 0);
+}
+
+static void
+fill_from_language_entry (GtrLanguagesFetcher *fetcher,
+                          GtrLanguage         *lang)
+{
+  const gchar *entry_text;
+
+  fill_encoding_and_charset (fetcher);
+
+  entry_text = gtk_entry_get_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (fetcher->priv->language_code))));
+
+  if (*entry_text == '\0')
+    {
+      const gchar *code;
+
+      code = gtr_language_get_code (lang);
+
+      if (code != NULL && *code != '\0')
+        gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (fetcher->priv->language_code))), code);
+    }
+
+  entry_text = gtk_entry_get_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (fetcher->priv->plural_forms))));
+
+  if (*entry_text == '\0')
+    {
+      const gchar *plural_form;
+
+      plural_form = gtr_language_get_plural_form (lang);
+
+      if (plural_form != NULL && *plural_form != '\0')
+        gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (fetcher->priv->plural_forms))), plural_form);
+    }
+}
+
+static void
+fill_from_language_code_entry (GtrLanguagesFetcher *fetcher,
+                               GtrLanguage         *lang)
+{
+  const gchar *entry_text;
+
+  fill_encoding_and_charset (fetcher);
+
+  entry_text = gtk_entry_get_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (fetcher->priv->language))));
+
+  if (*entry_text == '\0')
+    {
+      const gchar *name;
+
+      name = gtr_language_get_name (lang);
+
+      if (name != NULL && *name != '\0')
+        gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (fetcher->priv->language))), name);
+    }
+
+  entry_text = gtk_entry_get_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (fetcher->priv->plural_forms))));
+
+  if (*entry_text == '\0')
+    {
+      const gchar *plural_form;
+
+      plural_form = gtr_language_get_plural_form (lang);
+
+      if (plural_form != NULL && *plural_form != '\0')
+        gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (fetcher->priv->plural_forms))), plural_form);
+    }
+}
+
+typedef void (* fill_method) (GtrLanguagesFetcher *fetcher, GtrLanguage *lang);
+
+static void
+fill_boxes (GtrLanguagesFetcher *fetcher,
+            GtkEntry            *entry,
+            GtkTreeModel        *store,
+            fill_method          fill)
+{
+  const gchar *text;
+  gchar *entry_row;
+  GtkTreeIter iter;
+  GtrLanguage *lang;
+  gboolean found = FALSE;
+
+  text = gtk_entry_get_text (entry);
+
+  if (text == NULL || *text == '\0' ||
+      !gtk_tree_model_get_iter_first (store, &iter))
+    return;
+
+  do
+    {
+      gtk_tree_model_get (store, &iter,
+                          0, &entry_row,
+                          -1);
+
+      if (entry_row != NULL && strcmp (entry_row, text) == 0)
+        {
+          found = TRUE;
+          g_free (entry_row);
+          break;
+        }
+
+      g_free (entry_row);
+    }
+  while (gtk_tree_model_iter_next (store, &iter));
+
+  if (found)
+    {
+      gtk_tree_model_get (store, &iter,
+                          1, &lang,
+                          -1);
+
+      fill (fetcher, lang);
+    }
+}
+
+static void
+on_language_activate (GtkEntry         *entry,
+                      GtrLanguagesFetcher *fetcher)
+{
+  fill_boxes (fetcher, entry, GTK_TREE_MODEL (fetcher->priv->language_store),
+              fill_from_language_entry);
+}
+
+static void
+on_language_focus_out_event (GtkEntry         *entry,
+                             GdkEvent         *event,
+                             GtrLanguagesFetcher *fetcher)
+{
+  on_language_activate (entry, fetcher);
+}
+
+static void
+on_language_code_activate (GtkEntry         *entry,
+                           GtrLanguagesFetcher *fetcher)
+{
+  fill_boxes (fetcher, entry, GTK_TREE_MODEL (fetcher->priv->code_store),
+              fill_from_language_code_entry);
+}
+
+static void
+on_language_code_focus_out_event (GtkEntry         *entry,
+                                  GdkEvent         *event,
+                                  GtrLanguagesFetcher *fetcher)
+{
+  on_language_code_activate (entry, fetcher);
+}
+
+static void
+gtr_languages_fetcher_init (GtrLanguagesFetcher *fetcher)
+{
+  GtkWidget *error_widget;
+  GtkWidget *main_box;
+  gboolean ret;
+  gchar *path;
+  gchar *root_objects[] = {
+    "main_box",
+    "language_store",
+    "code_store",
+    NULL
+  };
+
+  fetcher->priv = GTR_LANGUAGES_FETCHER_GET_PRIVATE (fetcher);
+
+  path = gtr_dirs_get_ui_file ("gtr-languages-fetcher.ui");
+  ret = gtr_utils_get_ui_objects (path,
+                                  root_objects,
+                                  &error_widget,
+                                  "main_box", &main_box,
+                                  "language", &fetcher->priv->language,
+                                  "language_code", &fetcher->priv->language_code,
+                                  "charset", &fetcher->priv->charset,
+                                  "encoding", &fetcher->priv->encoding,
+                                  "team_email", &fetcher->priv->team_email,
+                                  "plural_forms", &fetcher->priv->plural_forms,
+
+                                  "language_store", &fetcher->priv->language_store,
+                                  "code_store", &fetcher->priv->code_store,
+                                  NULL);
+  g_free (path);
+
+  if (!ret)
+    {
+      gtk_widget_show (error_widget);
+      gtk_box_pack_start (GTK_BOX (fetcher), error_widget, TRUE, TRUE, 0);
+
+      return;
+    }
+
+  gtk_box_pack_start (GTK_BOX (fetcher), main_box, FALSE, FALSE, 0);
+
+  /* add items to comboboxes */
+  append_from_languages (fetcher);
+
+  g_signal_connect (gtk_bin_get_child (GTK_BIN (fetcher->priv->language)),
+                    "activate",
+                    G_CALLBACK (on_language_activate),
+                    fetcher);
+  g_signal_connect (gtk_bin_get_child (GTK_BIN (fetcher->priv->language)),
+                    "focus-out-event",
+                    G_CALLBACK (on_language_focus_out_event),
+                    fetcher);
+  g_signal_connect (gtk_bin_get_child (GTK_BIN (fetcher->priv->language_code)),
+                    "activate",
+                    G_CALLBACK (on_language_code_activate),
+                    fetcher);
+  g_signal_connect (gtk_bin_get_child (GTK_BIN (fetcher->priv->language_code)),
+                    "focus-out-event",
+                    G_CALLBACK (on_language_code_focus_out_event),
+                    fetcher);
+}
+
+GtkWidget *
+gtr_languages_fetcher_new ()
+{
+  return g_object_new (GTR_TYPE_LANGUAGES_FETCHER, NULL);
+}
+
+const gchar *
+gtr_languages_fetcher_get_language_name (GtrLanguagesFetcher *fetcher)
+{
+  g_return_val_if_fail (GTR_IS_LANGUAGES_FETCHER (fetcher), NULL);
+
+  return gtk_entry_get_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (fetcher->priv->language))));
+}
+
+void
+gtr_languages_fetcher_set_language_name (GtrLanguagesFetcher *fetcher,
+                                         const gchar         *name)
+{
+  g_return_if_fail (GTR_IS_LANGUAGES_FETCHER (fetcher));
+  g_return_if_fail (name != NULL);
+
+  gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (fetcher->priv->language))), name);
+}
+
+const gchar *
+gtr_languages_fetcher_get_language_code (GtrLanguagesFetcher *fetcher)
+{
+  g_return_val_if_fail (GTR_IS_LANGUAGES_FETCHER (fetcher), NULL);
+
+  return gtk_entry_get_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (fetcher->priv->language_code))));
+}
+
+void
+gtr_languages_fetcher_set_language_code (GtrLanguagesFetcher *fetcher,
+                                         const gchar         *code)
+{
+  g_return_if_fail (GTR_IS_LANGUAGES_FETCHER (fetcher));
+  g_return_if_fail (code != NULL);
+
+  gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (fetcher->priv->language_code))), code);
+}
+
+const gchar *
+gtr_languages_fetcher_get_charset (GtrLanguagesFetcher *fetcher)
+{
+  g_return_val_if_fail (GTR_IS_LANGUAGES_FETCHER (fetcher), NULL);
+
+  return gtk_entry_get_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (fetcher->priv->charset))));
+}
+
+void
+gtr_languages_fetcher_set_charset (GtrLanguagesFetcher *fetcher,
+                                   const gchar         *charset)
+{
+  g_return_if_fail (GTR_IS_LANGUAGES_FETCHER (fetcher));
+  g_return_if_fail (charset != NULL);
+
+  gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (fetcher->priv->charset))), charset);
+}
+
+const gchar *
+gtr_languages_fetcher_get_encoding (GtrLanguagesFetcher *fetcher)
+{
+  g_return_val_if_fail (GTR_IS_LANGUAGES_FETCHER (fetcher), NULL);
+
+  return gtk_entry_get_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (fetcher->priv->encoding))));
+}
+
+void
+gtr_languages_fetcher_set_encoding (GtrLanguagesFetcher *fetcher,
+                                    const gchar         *enc)
+{
+  g_return_if_fail (GTR_IS_LANGUAGES_FETCHER (fetcher));
+  g_return_if_fail (enc != NULL);
+
+  gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (fetcher->priv->encoding))), enc);
+}
+
+const gchar *
+gtr_languages_fetcher_get_team_email (GtrLanguagesFetcher *fetcher)
+{
+  g_return_val_if_fail (GTR_IS_LANGUAGES_FETCHER (fetcher), NULL);
+
+  return gtk_entry_get_text (GTK_ENTRY (fetcher->priv->team_email));
+}
+
+void
+gtr_languages_fetcher_set_team_email (GtrLanguagesFetcher *fetcher,
+                                      const gchar         *email)
+{
+  g_return_if_fail (GTR_IS_LANGUAGES_FETCHER (fetcher));
+  g_return_if_fail (email != NULL);
+
+  gtk_entry_set_text (GTK_ENTRY (fetcher->priv->team_email), email);
+}
+
+const gchar *
+gtr_languages_fetcher_get_plural_form (GtrLanguagesFetcher *fetcher)
+{
+  g_return_val_if_fail (GTR_IS_LANGUAGES_FETCHER (fetcher), NULL);
+
+  return gtk_entry_get_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (fetcher->priv->plural_forms))));
+}
+
+void
+gtr_languages_fetcher_set_plural_form (GtrLanguagesFetcher *fetcher,
+                                       const gchar         *plural_form)
+{
+  g_return_if_fail (GTR_IS_LANGUAGES_FETCHER (fetcher));
+  g_return_if_fail (plural_form != NULL);
+
+  gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (fetcher->priv->plural_forms))), plural_form);
+}
diff --git a/src/dialogs/gtr-languages-fetcher.h b/src/dialogs/gtr-languages-fetcher.h
new file mode 100644
index 0000000..fa135a3
--- /dev/null
+++ b/src/dialogs/gtr-languages-fetcher.h
@@ -0,0 +1,88 @@
+/*
+ * gtr-languages-fetcher.h
+ * This file is part of gtranslator
+ *
+ * Copyright (C) 2011 - Ignacio Casal Quinteiro
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __GTR_LANGUAGES_FETCHER_H__
+#define __GTR_LANGUAGES_FETCHER_H__
+
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+#define GTR_TYPE_LANGUAGES_FETCHER		(gtr_languages_fetcher_get_type ())
+#define GTR_LANGUAGES_FETCHER(obj)		(G_TYPE_CHECK_INSTANCE_CAST ((obj), GTR_TYPE_LANGUAGES_FETCHER, GtrLanguagesFetcher))
+#define GTR_LANGUAGES_FETCHER_CONST(obj)	(G_TYPE_CHECK_INSTANCE_CAST ((obj), GTR_TYPE_LANGUAGES_FETCHER, GtrLanguagesFetcher const))
+#define GTR_LANGUAGES_FETCHER_CLASS(klass)	(G_TYPE_CHECK_CLASS_CAST ((klass), GTR_TYPE_LANGUAGES_FETCHER, GtrLanguagesFetcherClass))
+#define GTR_IS_LANGUAGES_FETCHER(obj)		(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTR_TYPE_LANGUAGES_FETCHER))
+#define GTR_IS_LANGUAGES_FETCHER_CLASS(klass)	(G_TYPE_CHECK_CLASS_TYPE ((klass), GTR_TYPE_LANGUAGES_FETCHER))
+#define GTR_LANGUAGES_FETCHER_GET_CLASS(obj)	(G_TYPE_INSTANCE_GET_CLASS ((obj), GTR_TYPE_LANGUAGES_FETCHER, GtrLanguagesFetcherClass))
+
+typedef struct _GtrLanguagesFetcher		GtrLanguagesFetcher;
+typedef struct _GtrLanguagesFetcherClass	GtrLanguagesFetcherClass;
+typedef struct _GtrLanguagesFetcherPrivate	GtrLanguagesFetcherPrivate;
+
+struct _GtrLanguagesFetcher
+{
+  GtkVBox parent;
+
+  GtrLanguagesFetcherPrivate *priv;
+};
+
+struct _GtrLanguagesFetcherClass
+{
+  GtkVBoxClass parent_class;
+};
+
+GType                  gtr_languages_fetcher_get_type             (void) G_GNUC_CONST;
+
+GtkWidget             *gtr_languages_fetcher_new                  (void);
+
+const gchar           *gtr_languages_fetcher_get_language_name    (GtrLanguagesFetcher *fetcher);
+
+void                   gtr_languages_fetcher_set_language_name    (GtrLanguagesFetcher *fetcher,
+                                                                   const gchar         *name);
+
+const gchar           *gtr_languages_fetcher_get_language_code    (GtrLanguagesFetcher *fetcher);
+
+void                   gtr_languages_fetcher_set_language_code    (GtrLanguagesFetcher *fetcher,
+                                                                   const gchar         *code);
+
+const gchar           *gtr_languages_fetcher_get_charset          (GtrLanguagesFetcher *fetcher);
+
+void                   gtr_languages_fetcher_set_charset          (GtrLanguagesFetcher *fetcher,
+                                                                   const gchar         *charset);
+
+const gchar           *gtr_languages_fetcher_get_encoding         (GtrLanguagesFetcher *fetcher);
+
+void                   gtr_languages_fetcher_set_encoding         (GtrLanguagesFetcher *fetcher,
+                                                                   const gchar         *enc);
+
+const gchar           *gtr_languages_fetcher_get_team_email       (GtrLanguagesFetcher *fetcher);
+
+void                   gtr_languages_fetcher_set_team_email       (GtrLanguagesFetcher *fetcher,
+                                                                   const gchar         *email);
+
+const gchar           *gtr_languages_fetcher_get_plural_form      (GtrLanguagesFetcher *fetcher);
+
+void                   gtr_languages_fetcher_set_plural_form      (GtrLanguagesFetcher *fetcher,
+                                                                   const gchar         *plural_form);
+
+G_END_DECLS
+
+#endif /* __GTR_LANGUAGES_FETCHER_H__ */
diff --git a/src/dialogs/gtr-languages-fetcher.ui b/src/dialogs/gtr-languages-fetcher.ui
new file mode 100644
index 0000000..4634af2
--- /dev/null
+++ b/src/dialogs/gtr-languages-fetcher.ui
@@ -0,0 +1,251 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <!-- interface-requires gtk+ 3.0 -->
+  <object class="GtkListStore" id="code_store">
+    <columns>
+      <!-- column-name text -->
+      <column type="gchararray"/>
+      <!-- column-name language -->
+      <column type="gpointer"/>
+    </columns>
+  </object>
+  <object class="GtkListStore" id="language_store">
+    <columns>
+      <!-- column-name text -->
+      <column type="gchararray"/>
+      <!-- column-name language -->
+      <column type="gpointer"/>
+    </columns>
+  </object>
+  <object class="GtkWindow" id="languages-fetcher">
+    <property name="can_focus">False</property>
+    <child>
+      <object class="GtkVBox" id="main_box">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+        <property name="spacing">6</property>
+        <child>
+          <object class="GtkTable" id="table4">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+            <property name="n_rows">5</property>
+            <property name="n_columns">2</property>
+            <property name="column_spacing">6</property>
+            <property name="row_spacing">6</property>
+            <child>
+              <object class="GtkLabel" id="label15">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes">_Team email:</property>
+                <property name="use_underline">True</property>
+              </object>
+              <packing>
+                <property name="top_attach">4</property>
+                <property name="bottom_attach">5</property>
+                <property name="x_options">GTK_FILL</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label14">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes">Transfer en_coding:</property>
+                <property name="use_underline">True</property>
+              </object>
+              <packing>
+                <property name="top_attach">3</property>
+                <property name="bottom_attach">4</property>
+                <property name="x_options">GTK_FILL</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label13">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes">Character _set</property>
+                <property name="use_underline">True</property>
+              </object>
+              <packing>
+                <property name="top_attach">2</property>
+                <property name="bottom_attach">3</property>
+                <property name="x_options">GTK_FILL</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label12">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes">Language _code:</property>
+                <property name="use_underline">True</property>
+              </object>
+              <packing>
+                <property name="top_attach">1</property>
+                <property name="bottom_attach">2</property>
+                <property name="x_options">GTK_FILL</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label11">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes">_Language:</property>
+                <property name="use_underline">True</property>
+              </object>
+              <packing>
+                <property name="x_options">GTK_FILL</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkEntry" id="team_email">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                <property name="invisible_char">â??</property>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="right_attach">2</property>
+                <property name="top_attach">4</property>
+                <property name="bottom_attach">5</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkComboBoxText" id="charset">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="has_entry">True</property>
+                <property name="entry_text_column">0</property>
+                <property name="id_column">1</property>
+                <items>
+                  <item>UTF-8</item>
+                </items>
+                <child internal-child="entry">
+                  <object class="GtkEntry" id="comboboxentry-entry">
+                    <property name="can_focus">True</property>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="right_attach">2</property>
+                <property name="top_attach">2</property>
+                <property name="bottom_attach">3</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkComboBoxText" id="encoding">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="has_entry">True</property>
+                <property name="entry_text_column">0</property>
+                <items>
+                  <item>8bits</item>
+                </items>
+                <child internal-child="entry">
+                  <object class="GtkEntry" id="comboboxentry-entry1">
+                    <property name="can_focus">True</property>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="right_attach">2</property>
+                <property name="top_attach">3</property>
+                <property name="bottom_attach">4</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkComboBox" id="language">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="model">language_store</property>
+                <property name="has_entry">True</property>
+                <property name="entry_text_column">0</property>
+                <child internal-child="entry">
+                  <object class="GtkEntry" id="comboboxentry-entry2">
+                    <property name="can_focus">True</property>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="right_attach">2</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkComboBox" id="language_code">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="model">code_store</property>
+                <property name="has_entry">True</property>
+                <property name="entry_text_column">0</property>
+                <child internal-child="entry">
+                  <object class="GtkEntry" id="comboboxentry-entry3">
+                    <property name="can_focus">True</property>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="right_attach">2</property>
+                <property name="top_attach">1</property>
+                <property name="bottom_attach">2</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label10">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+            <property name="xalign">0</property>
+            <property name="label" translatable="yes">_Plural forms:</property>
+            <property name="use_underline">True</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkComboBoxText" id="plural_forms">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="has_entry">True</property>
+            <property name="entry_text_column">0</property>
+            <property name="id_column">1</property>
+            <child internal-child="entry">
+              <object class="GtkEntry" id="comboboxentry-entry4">
+                <property name="can_focus">True</property>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">2</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+  </object>
+</interface>
diff --git a/src/dialogs/gtr-profile-dialog.c b/src/dialogs/gtr-profile-dialog.c
index f4f63c0..c24195e 100644
--- a/src/dialogs/gtr-profile-dialog.c
+++ b/src/dialogs/gtr-profile-dialog.c
@@ -28,7 +28,7 @@
 #include "gtr-profile-dialog.h"
 #include "gtr-profile.h"
 #include "gtr-utils.h"
-#include "gtr-language.h"
+#include "gtr-languages-fetcher.h"
 
 #include <string.h>
 #include <glib.h>
@@ -51,15 +51,7 @@ struct _GtrProfileDialogPrivate
   GtkWidget *author_name;
   GtkWidget *author_email;
 
-  GtkWidget *language;
-  GtkWidget *language_code;
-  GtkWidget *charset;
-  GtkWidget *encoding;
-  GtkWidget *team_email;
-  GtkWidget *plural_forms;
-
-  GtkListStore *language_store;
-  GtkListStore *code_store;
+  GtkWidget *languages_fetcher;
 };
 
 static void
@@ -69,223 +61,15 @@ gtr_profile_dialog_class_init (GtrProfileDialogClass *klass)
 }
 
 static void
-append_from_languages (GtrProfileDialog *dlg)
-{
-  const GSList *languages, *l;
-  GHashTable *plurals;
-
-  plurals = g_hash_table_new (g_str_hash, g_int_equal);
-
-  languages = gtr_language_get_languages ();
-
-  for (l = languages; l != NULL; l = (const GSList *)g_list_next (l))
-    {
-      GtrLanguage *lang = (GtrLanguage *)l->data;
-      GtkTreeIter iter1, iter2;
-      const gchar *plural_form;
-
-      gtk_list_store_append (dlg->priv->language_store, &iter1);
-      gtk_list_store_set (dlg->priv->language_store, &iter1,
-                          0, gtr_language_get_name (lang),
-                          1, lang,
-                          -1);
-
-      gtk_list_store_append (dlg->priv->code_store, &iter2);
-      gtk_list_store_set (dlg->priv->code_store, &iter2,
-                          0, gtr_language_get_code (lang),
-                          1, lang,
-                          -1);
-
-      plural_form = gtr_language_get_plural_form (lang);
-      if (plural_form != NULL && *plural_form != '\0')
-        {
-          gint *value;
-
-          value = g_hash_table_lookup (plurals, plural_form);
-          if (value == NULL)
-            {
-              g_hash_table_insert (plurals, (gchar *)plural_form, GINT_TO_POINTER (1));
-              gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (dlg->priv->plural_forms),
-                                              plural_form);
-            }
-        }
-    }
-
-    g_hash_table_unref (plurals);
-}
-
-static void
-fill_encoding_and_charset (GtrProfileDialog *dlg)
-{
-  const gchar *text;
-
-  text = gtk_entry_get_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (dlg->priv->charset))));
-
-  if (text == NULL || *text == '\0')
-    gtk_combo_box_set_active (GTK_COMBO_BOX (dlg->priv->charset), 0);
-
-  text = gtk_entry_get_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (dlg->priv->encoding))));
-
-  if (text == NULL || *text == '\0')
-    gtk_combo_box_set_active (GTK_COMBO_BOX (dlg->priv->encoding), 0);
-}
-
-static void
-fill_from_language_entry (GtrProfileDialog *dlg,
-                          GtrLanguage      *lang)
-{
-  const gchar *entry_text;
-
-  fill_encoding_and_charset (dlg);
-
-  entry_text = gtk_entry_get_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (dlg->priv->language_code))));
-
-  if (*entry_text == '\0')
-    {
-      const gchar *code;
-
-      code = gtr_language_get_code (lang);
-
-      if (code != NULL && *code != '\0')
-        gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (dlg->priv->language_code))), code);
-    }
-
-  entry_text = gtk_entry_get_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (dlg->priv->plural_forms))));
-
-  if (*entry_text == '\0')
-    {
-      const gchar *plural_form;
-
-      plural_form = gtr_language_get_plural_form (lang);
-
-      if (plural_form != NULL && *plural_form != '\0')
-        gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (dlg->priv->plural_forms))), plural_form);
-    }
-}
-
-static void
-fill_from_language_code_entry (GtrProfileDialog *dlg,
-                               GtrLanguage      *lang)
-{
-  const gchar *entry_text;
-
-  fill_encoding_and_charset (dlg);
-
-  entry_text = gtk_entry_get_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (dlg->priv->language))));
-
-  if (*entry_text == '\0')
-    {
-      const gchar *name;
-
-      name = gtr_language_get_name (lang);
-
-      if (name != NULL && *name != '\0')
-        gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (dlg->priv->language))), name);
-    }
-
-  entry_text = gtk_entry_get_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (dlg->priv->plural_forms))));
-
-  if (*entry_text == '\0')
-    {
-      const gchar *plural_form;
-
-      plural_form = gtr_language_get_plural_form (lang);
-
-      if (plural_form != NULL && *plural_form != '\0')
-        gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (dlg->priv->plural_forms))), plural_form);
-    }
-}
-
-typedef void (* fill_method) (GtrProfileDialog *dlg, GtrLanguage *lang);
-
-static void
-fill_boxes (GtrProfileDialog *dlg,
-            GtkEntry         *entry,
-            GtkTreeModel     *store,
-            fill_method       fill)
-{
-  const gchar *text;
-  gchar *entry_row;
-  GtkTreeIter iter;
-  GtrLanguage *lang;
-  gboolean found = FALSE;
-
-  text = gtk_entry_get_text (entry);
-
-  if (text == NULL || *text == '\0' ||
-      !gtk_tree_model_get_iter_first (store, &iter))
-    return;
-
-  do
-    {
-      gtk_tree_model_get (store, &iter,
-                          0, &entry_row,
-                          -1);
-
-      if (entry_row != NULL && strcmp (entry_row, text) == 0)
-        {
-          found = TRUE;
-          g_free (entry_row);
-          break;
-        }
-
-      g_free (entry_row);
-    }
-  while (gtk_tree_model_iter_next (store, &iter));
-
-  if (found)
-    {
-      gtk_tree_model_get (store, &iter,
-                          1, &lang,
-                          -1);
-
-      fill (dlg, lang);
-    }
-}
-
-static void
-on_language_activate (GtkEntry         *entry,
-                      GtrProfileDialog *dlg)
-{
-  fill_boxes (dlg, entry, GTK_TREE_MODEL (dlg->priv->language_store),
-              fill_from_language_entry);
-}
-
-static void
-on_language_focus_out_event (GtkEntry         *entry,
-                             GdkEvent         *event,
-                             GtrProfileDialog *dlg)
-{
-  on_language_activate (entry, dlg);
-}
-
-static void
-on_language_code_activate (GtkEntry         *entry,
-                           GtrProfileDialog *dlg)
-{
-  fill_boxes (dlg, entry, GTK_TREE_MODEL (dlg->priv->code_store),
-              fill_from_language_code_entry);
-}
-
-static void
-on_language_code_focus_out_event (GtkEntry         *entry,
-                                  GdkEvent         *event,
-                                  GtrProfileDialog *dlg)
-{
-  on_language_code_activate (entry, dlg);
-}
-
-static void
 gtr_profile_dialog_init (GtrProfileDialog *dlg)
 {
   gboolean ret;
   GtkWidget *error_widget, *action_area;
   GtkBox *content_area;
+  GtkWidget *fetcher_box;
   gchar *path;
   gchar *root_objects[] = {
     "main_box",
-    "language_store",
-    "code_store",
     NULL
   };
 
@@ -316,15 +100,7 @@ gtr_profile_dialog_init (GtrProfileDialog *dlg)
                                   "profile_name", &dlg->priv->profile_name,
                                   "name", &dlg->priv->author_name,
                                   "email", &dlg->priv->author_email,
-                                  "language", &dlg->priv->language,
-                                  "language_code", &dlg->priv->language_code,
-                                  "charset", &dlg->priv->charset,
-                                  "encoding", &dlg->priv->encoding,
-                                  "team_email", &dlg->priv->team_email,
-                                  "plural_forms", &dlg->priv->plural_forms,
-
-                                  "language_store", &dlg->priv->language_store,
-                                  "code_store", &dlg->priv->code_store,
+                                  "fetcher_box", &fetcher_box,
                                   NULL);
   g_free (path);
 
@@ -338,25 +114,10 @@ gtr_profile_dialog_init (GtrProfileDialog *dlg)
 
   gtk_box_pack_start (content_area, dlg->priv->main_box, FALSE, FALSE, 0);
 
-  /* add items to comboboxes */
-  append_from_languages (dlg);
-
-  g_signal_connect (gtk_bin_get_child (GTK_BIN (dlg->priv->language)),
-                    "activate",
-                    G_CALLBACK (on_language_activate),
-                    dlg);
-  g_signal_connect (gtk_bin_get_child (GTK_BIN (dlg->priv->language)),
-                    "focus-out-event",
-                    G_CALLBACK (on_language_focus_out_event),
-                    dlg);
-  g_signal_connect (gtk_bin_get_child (GTK_BIN (dlg->priv->language_code)),
-                    "activate",
-                    G_CALLBACK (on_language_code_activate),
-                    dlg);
-  g_signal_connect (gtk_bin_get_child (GTK_BIN (dlg->priv->language_code)),
-                    "focus-out-event",
-                    G_CALLBACK (on_language_code_focus_out_event),
-                    dlg);
+  dlg->priv->languages_fetcher = gtr_languages_fetcher_new ();
+  gtk_widget_show (dlg->priv->languages_fetcher);
+  gtk_box_pack_start (GTK_BOX (fetcher_box), dlg->priv->languages_fetcher,
+                      TRUE, TRUE, 0);
 }
 
 static void
@@ -375,28 +136,28 @@ fill_entries (GtrProfileDialog *dlg, GtrProfile *profile)
                         gtr_profile_get_author_email (profile));
 
   if (gtr_profile_get_language_name (profile) != NULL)
-    gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (dlg->priv->language))),
-                        gtr_profile_get_language_name (profile));
+    gtr_languages_fetcher_set_language_name (GTR_LANGUAGES_FETCHER (dlg->priv->languages_fetcher),
+                                             gtr_profile_get_language_name (profile));
 
   if (gtr_profile_get_language_code (profile) != NULL)
-    gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (dlg->priv->language_code))),
-                        gtr_profile_get_language_code (profile));
+    gtr_languages_fetcher_set_language_code (GTR_LANGUAGES_FETCHER (dlg->priv->languages_fetcher),
+                                             gtr_profile_get_language_code (profile));
 
   if (gtr_profile_get_charset (profile) != NULL)
-    gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (dlg->priv->charset))),
-                        gtr_profile_get_charset (profile));
+    gtr_languages_fetcher_set_charset (GTR_LANGUAGES_FETCHER (dlg->priv->languages_fetcher),
+                                       gtr_profile_get_charset (profile));
 
   if (gtr_profile_get_encoding (profile) != NULL)
-    gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (dlg->priv->encoding))),
-                        gtr_profile_get_encoding (profile));
+    gtr_languages_fetcher_set_encoding (GTR_LANGUAGES_FETCHER (dlg->priv->languages_fetcher),
+                                        gtr_profile_get_encoding (profile));
 
   if (gtr_profile_get_group_email (profile) != NULL)
-    gtk_entry_set_text (GTK_ENTRY (dlg->priv->team_email),
-                        gtr_profile_get_group_email (profile));
+    gtr_languages_fetcher_set_team_email (GTR_LANGUAGES_FETCHER (dlg->priv->languages_fetcher),
+                                          gtr_profile_get_group_email (profile));
 
   if (gtr_profile_get_plural_forms (profile) != NULL)
-    gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (dlg->priv->plural_forms))),
-                        gtr_profile_get_plural_forms (profile));
+    gtr_languages_fetcher_set_plural_form (GTR_LANGUAGES_FETCHER (dlg->priv->languages_fetcher),
+                                           gtr_profile_get_plural_forms (profile));
 }
 
 GtrProfileDialog *
@@ -434,7 +195,6 @@ GtrProfile *
 gtr_profile_dialog_get_profile (GtrProfileDialog *dlg)
 {
   GtrProfile *profile;
-  gchar *text;
 
   g_return_val_if_fail (GTR_IS_PROFILE_DIALOG (dlg), NULL);
 
@@ -450,25 +210,22 @@ gtr_profile_dialog_get_profile (GtrProfileDialog *dlg)
                                 gtk_entry_get_text (GTK_ENTRY (dlg->priv->author_email)));
 
   gtr_profile_set_language_name (profile,
-                                 gtk_entry_get_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (dlg->priv->language)))));
+                                 gtr_languages_fetcher_get_language_name (GTR_LANGUAGES_FETCHER (dlg->priv->languages_fetcher)));
 
   gtr_profile_set_language_code (profile,
-                                 gtk_entry_get_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (dlg->priv->language_code)))));
+                                 gtr_languages_fetcher_get_language_code (GTR_LANGUAGES_FETCHER (dlg->priv->languages_fetcher)));
 
-  text = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (dlg->priv->charset));
-  gtr_profile_set_charset (profile, text);
-  g_free (text);
+  gtr_profile_set_charset (profile,
+                           gtr_languages_fetcher_get_charset (GTR_LANGUAGES_FETCHER (dlg->priv->languages_fetcher)));
 
-  text = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (dlg->priv->encoding));
-  gtr_profile_set_encoding (profile, text);
-  g_free (text);
+  gtr_profile_set_encoding (profile,
+                            gtr_languages_fetcher_get_encoding (GTR_LANGUAGES_FETCHER (dlg->priv->languages_fetcher)));
 
   gtr_profile_set_group_email (profile,
-                               gtk_entry_get_text (GTK_ENTRY (dlg->priv->team_email)));
+                               gtr_languages_fetcher_get_team_email (GTR_LANGUAGES_FETCHER (dlg->priv->languages_fetcher)));
 
-  text = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (dlg->priv->plural_forms));
-  gtr_profile_set_plural_forms (profile, text);
-  g_free (text);
+  gtr_profile_set_plural_forms (profile,
+                                gtr_languages_fetcher_get_plural_form (GTR_LANGUAGES_FETCHER (dlg->priv->languages_fetcher)));
 
   return profile;
 }
diff --git a/src/dialogs/gtr-profile-dialog.ui b/src/dialogs/gtr-profile-dialog.ui
index b50f3d4..fa52ba8 100644
--- a/src/dialogs/gtr-profile-dialog.ui
+++ b/src/dialogs/gtr-profile-dialog.ui
@@ -1,14 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
   <requires lib="gtk+" version="2.16"/>
-  <object class="GtkListStore" id="code_store">
-    <columns>
-      <!-- column-name text -->
-      <column type="gchararray"/>
-      <!-- column-name language -->
-      <column type="gpointer"/>
-    </columns>
-  </object>
   <object class="GtkDialog" id="dialog1">
     <property name="can_focus">False</property>
     <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
@@ -66,23 +58,10 @@
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkHBox" id="hbox1">
+                  <object class="GtkAlignment" id="alignment3">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                    <child>
-                      <object class="GtkLabel" id="label2">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                      </object>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">False</property>
-                        <property name="padding">6</property>
-                        <property name="position">0</property>
-                      </packing>
-                    </child>
+                    <property name="left_padding">12</property>
                     <child>
                       <object class="GtkTable" id="table1">
                         <property name="visible">True</property>
@@ -96,6 +75,7 @@
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                            <property name="invisible_char">â??</property>
                           </object>
                           <packing>
                             <property name="left_attach">1</property>
@@ -117,11 +97,6 @@
                           </packing>
                         </child>
                       </object>
-                      <packing>
-                        <property name="expand">True</property>
-                        <property name="fill">True</property>
-                        <property name="position">1</property>
-                      </packing>
                     </child>
                   </object>
                   <packing>
@@ -161,23 +136,10 @@
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkHBox" id="hbox2">
+                  <object class="GtkAlignment" id="alignment2">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                    <child>
-                      <object class="GtkLabel" id="label5">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                      </object>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">False</property>
-                        <property name="padding">6</property>
-                        <property name="position">0</property>
-                      </packing>
-                    </child>
+                    <property name="left_padding">12</property>
                     <child>
                       <object class="GtkTable" id="table2">
                         <property name="visible">True</property>
@@ -192,6 +154,7 @@
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                            <property name="invisible_char">â??</property>
                           </object>
                           <packing>
                             <property name="left_attach">1</property>
@@ -235,6 +198,7 @@
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                            <property name="invisible_char">â??</property>
                           </object>
                           <packing>
                             <property name="left_attach">1</property>
@@ -242,11 +206,6 @@
                           </packing>
                         </child>
                       </object>
-                      <packing>
-                        <property name="expand">True</property>
-                        <property name="fill">True</property>
-                        <property name="position">1</property>
-                      </packing>
                     </child>
                   </object>
                   <packing>
@@ -286,260 +245,18 @@
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkHBox" id="hbox3">
+                  <object class="GtkAlignment" id="alignment1">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                    <child>
-                      <object class="GtkLabel" id="label9">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                      </object>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">False</property>
-                        <property name="padding">6</property>
-                        <property name="position">0</property>
-                      </packing>
-                    </child>
+                    <property name="left_padding">12</property>
                     <child>
-                      <object class="GtkVBox" id="vbox5">
+                      <object class="GtkVBox" id="fetcher_box">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                        <property name="spacing">6</property>
                         <child>
-                          <object class="GtkTable" id="table4">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                            <property name="n_rows">5</property>
-                            <property name="n_columns">2</property>
-                            <property name="column_spacing">6</property>
-                            <property name="row_spacing">6</property>
-                            <child>
-                              <object class="GtkLabel" id="label15">
-                                <property name="visible">True</property>
-                                <property name="can_focus">False</property>
-                                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                                <property name="xalign">0</property>
-                                <property name="label" translatable="yes">_Team email:</property>
-                                <property name="use_underline">True</property>
-                              </object>
-                              <packing>
-                                <property name="top_attach">4</property>
-                                <property name="bottom_attach">5</property>
-                                <property name="x_options">GTK_FILL</property>
-                              </packing>
-                            </child>
-                            <child>
-                              <object class="GtkLabel" id="label14">
-                                <property name="visible">True</property>
-                                <property name="can_focus">False</property>
-                                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                                <property name="xalign">0</property>
-                                <property name="label" translatable="yes">Transfer en_coding:</property>
-                                <property name="use_underline">True</property>
-                              </object>
-                              <packing>
-                                <property name="top_attach">3</property>
-                                <property name="bottom_attach">4</property>
-                                <property name="x_options">GTK_FILL</property>
-                              </packing>
-                            </child>
-                            <child>
-                              <object class="GtkLabel" id="label13">
-                                <property name="visible">True</property>
-                                <property name="can_focus">False</property>
-                                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                                <property name="xalign">0</property>
-                                <property name="label" translatable="yes">Character _set</property>
-                                <property name="use_underline">True</property>
-                              </object>
-                              <packing>
-                                <property name="top_attach">2</property>
-                                <property name="bottom_attach">3</property>
-                                <property name="x_options">GTK_FILL</property>
-                              </packing>
-                            </child>
-                            <child>
-                              <object class="GtkLabel" id="label12">
-                                <property name="visible">True</property>
-                                <property name="can_focus">False</property>
-                                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                                <property name="xalign">0</property>
-                                <property name="label" translatable="yes">Language _code:</property>
-                                <property name="use_underline">True</property>
-                              </object>
-                              <packing>
-                                <property name="top_attach">1</property>
-                                <property name="bottom_attach">2</property>
-                                <property name="x_options">GTK_FILL</property>
-                              </packing>
-                            </child>
-                            <child>
-                              <object class="GtkLabel" id="label11">
-                                <property name="visible">True</property>
-                                <property name="can_focus">False</property>
-                                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                                <property name="xalign">0</property>
-                                <property name="label" translatable="yes">_Language:</property>
-                                <property name="use_underline">True</property>
-                              </object>
-                              <packing>
-                                <property name="x_options">GTK_FILL</property>
-                              </packing>
-                            </child>
-                            <child>
-                              <object class="GtkEntry" id="team_email">
-                                <property name="visible">True</property>
-                                <property name="can_focus">True</property>
-                                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                              </object>
-                              <packing>
-                                <property name="left_attach">1</property>
-                                <property name="right_attach">2</property>
-                                <property name="top_attach">4</property>
-                                <property name="bottom_attach">5</property>
-                              </packing>
-                            </child>
-                            <child>
-                              <object class="GtkComboBoxText" id="charset">
-                                <property name="visible">True</property>
-                                <property name="can_focus">False</property>
-                                <property name="has_entry">True</property>
-                                <property name="entry_text_column">0</property>
-                                <property name="id_column">1</property>
-                                <items>
-                                  <item>UTF-8</item>
-                                </items>
-                                <child internal-child="entry">
-                                  <object class="GtkEntry" id="comboboxentry-entry2">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                  </object>
-                                </child>
-                              </object>
-                              <packing>
-                                <property name="left_attach">1</property>
-                                <property name="right_attach">2</property>
-                                <property name="top_attach">2</property>
-                                <property name="bottom_attach">3</property>
-                              </packing>
-                            </child>
-                            <child>
-                              <object class="GtkComboBoxText" id="encoding">
-                                <property name="visible">True</property>
-                                <property name="can_focus">False</property>
-                                <property name="has_entry">True</property>
-                                <property name="entry_text_column">0</property>
-                                <items>
-                                  <item>8bits</item>
-                                </items>
-                                <child internal-child="entry">
-                                  <object class="GtkEntry" id="comboboxentry-entry3">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                  </object>
-                                </child>
-                              </object>
-                              <packing>
-                                <property name="left_attach">1</property>
-                                <property name="right_attach">2</property>
-                                <property name="top_attach">3</property>
-                                <property name="bottom_attach">4</property>
-                              </packing>
-                            </child>
-                            <child>
-                              <object class="GtkComboBox" id="language">
-                                <property name="visible">True</property>
-                                <property name="can_focus">False</property>
-                                <property name="model">language_store</property>
-                                <property name="has_entry">True</property>
-                                <property name="entry_text_column">0</property>
-                                <child internal-child="entry">
-                                  <object class="GtkEntry" id="comboboxentry-entry1">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                  </object>
-                                </child>
-                              </object>
-                              <packing>
-                                <property name="left_attach">1</property>
-                                <property name="right_attach">2</property>
-                              </packing>
-                            </child>
-                            <child>
-                              <object class="GtkComboBox" id="language_code">
-                                <property name="visible">True</property>
-                                <property name="can_focus">False</property>
-                                <property name="model">code_store</property>
-                                <property name="has_entry">True</property>
-                                <property name="entry_text_column">0</property>
-                                <child internal-child="entry">
-                                  <object class="GtkEntry" id="comboboxentry-entry">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                  </object>
-                                </child>
-                              </object>
-                              <packing>
-                                <property name="left_attach">1</property>
-                                <property name="right_attach">2</property>
-                                <property name="top_attach">1</property>
-                                <property name="bottom_attach">2</property>
-                              </packing>
-                            </child>
-                          </object>
-                          <packing>
-                            <property name="expand">True</property>
-                            <property name="fill">True</property>
-                            <property name="position">0</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkLabel" id="label10">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                            <property name="xalign">0</property>
-                            <property name="label" translatable="yes">_Plural forms:</property>
-                            <property name="use_underline">True</property>
-                          </object>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">False</property>
-                            <property name="position">1</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkComboBoxText" id="plural_forms">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="has_entry">True</property>
-                            <property name="entry_text_column">0</property>
-                            <property name="id_column">1</property>
-                            <property name="active_id">text</property>
-                            <child internal-child="entry">
-                              <object class="GtkEntry" id="comboboxentry-entry4">
-                                <property name="visible">True</property>
-                                <property name="can_focus">True</property>
-                              </object>
-                            </child>
-                          </object>
-                          <packing>
-                            <property name="expand">True</property>
-                            <property name="fill">True</property>
-                            <property name="position">2</property>
-                          </packing>
+                          <placeholder/>
                         </child>
                       </object>
-                      <packing>
-                        <property name="expand">True</property>
-                        <property name="fill">True</property>
-                        <property name="position">1</property>
-                      </packing>
                     </child>
                   </object>
                   <packing>
@@ -565,12 +282,4 @@
       </object>
     </child>
   </object>
-  <object class="GtkListStore" id="language_store">
-    <columns>
-      <!-- column-name text -->
-      <column type="gchararray"/>
-      <!-- column-name language -->
-      <column type="gpointer"/>
-    </columns>
-  </object>
 </interface>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]