aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog12
-rw-r--r--lib/ephy-dialog.c1
-rw-r--r--src/language-editor.c23
-rw-r--r--src/prefs-dialog.c18
4 files changed, 52 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 92d19bae2..e0c6fe3cc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2003-11-30 Christian Persch <chpe@cvs.gnome.org>
+
+ * lib/ephy-dialog.c:
+
+ Remove gtkoptionmenu.h include.
+
+ * src/language-editor.c: (language_editor_add):
+ * src/prefs-dialog.c: (create_language_menu):
+
+ Make languages list unique; don't allow to add an entry
+ already in the list.
+
2003-11-30 Marco Pesenti Gritti <marco@gnome.org>
* embed/Makefile.am:
diff --git a/lib/ephy-dialog.c b/lib/ephy-dialog.c
index e24bca90b..db5103702 100644
--- a/lib/ephy-dialog.c
+++ b/lib/ephy-dialog.c
@@ -34,7 +34,6 @@
#include <string.h>
#include <gtk/gtktogglebutton.h>
#include <gtk/gtkradiobutton.h>
-#include <gtk/gtkoptionmenu.h>
#include <gtk/gtkcombobox.h>
#include <gtk/gtkspinbutton.h>
#include <gtk/gtkeditable.h>
diff --git a/src/language-editor.c b/src/language-editor.c
index 28d09515f..b864bc75c 100644
--- a/src/language-editor.c
+++ b/src/language-editor.c
@@ -33,6 +33,7 @@
#include <gtk/gtkliststore.h>
#include <gtk/gtkcellrenderertext.h>
#include <glib/gi18n.h>
+#include <string.h>
enum
{
@@ -361,6 +362,28 @@ language_editor_add (LanguageEditor *editor,
{
GtkTreeIter iter;
+ g_return_if_fail (code != NULL && desc != NULL);
+
+ /* first check that the code isn't already in the list */
+ if (gtk_tree_model_get_iter_first (editor->priv->model, &iter))
+ {
+ do
+ {
+ char *c;
+
+ gtk_tree_model_get (editor->priv->model, &iter,
+ COL_DATA, &c,
+ -1);
+
+ if (c && strcmp (code, c) == 0)
+ {
+ /* already in list, no need to add again */
+ return;
+ }
+ }
+ while (gtk_tree_model_iter_next (editor->priv->model, &iter));
+ }
+
gtk_list_store_append (GTK_LIST_STORE (editor->priv->model), &iter);
gtk_list_store_set (GTK_LIST_STORE (editor->priv->model), &iter,
diff --git a/src/prefs-dialog.c b/src/prefs-dialog.c
index e9e2a207f..d276753ac 100644
--- a/src/prefs-dialog.c
+++ b/src/prefs-dialog.c
@@ -594,11 +594,27 @@ create_language_menu (EphyDialog *dialog)
GtkTreeIter iter;
GtkCellRenderer *renderer;
int i;
- GSList *list, *l;
+ GSList *list, *l, *ulist = NULL;
/* init value from first element of the list */
list = eel_gconf_get_string_list (CONF_RENDERING_LANGUAGE);
+ /* uniquify list */
+ for (l = list; l != NULL; l = l->next)
+ {
+ if (g_slist_find_custom (ulist, l->data, (GCompareFunc) strcmp) == NULL)
+ {
+ ulist = g_slist_prepend (ulist, l->data);
+ }
+ else
+ {
+ g_free (l->data);
+ }
+ }
+ g_slist_free (list);
+ list = g_slist_reverse (ulist);
+ eel_gconf_set_string_list (CONF_RENDERING_LANGUAGE, list);
+
combo = GTK_COMBO_BOX (ephy_dialog_get_control
(dialog, properties[LANGUAGE_PROP].id));