diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2003-12-01 00:35:41 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2003-12-01 00:35:41 +0800 |
commit | 763b4e07e1444c08c4a393ac562621a3d6bbb373 (patch) | |
tree | c5670ee539785e5e3c12a5aabd7d6d21f634b70a /src/language-editor.c | |
parent | c6247087ebcbe7b06c3082c3ceb6378e9557ba37 (diff) | |
download | gsoc2013-epiphany-763b4e07e1444c08c4a393ac562621a3d6bbb373.tar gsoc2013-epiphany-763b4e07e1444c08c4a393ac562621a3d6bbb373.tar.gz gsoc2013-epiphany-763b4e07e1444c08c4a393ac562621a3d6bbb373.tar.bz2 gsoc2013-epiphany-763b4e07e1444c08c4a393ac562621a3d6bbb373.tar.lz gsoc2013-epiphany-763b4e07e1444c08c4a393ac562621a3d6bbb373.tar.xz gsoc2013-epiphany-763b4e07e1444c08c4a393ac562621a3d6bbb373.tar.zst gsoc2013-epiphany-763b4e07e1444c08c4a393ac562621a3d6bbb373.zip |
Remove gtkoptionmenu.h include.
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.
Diffstat (limited to 'src/language-editor.c')
-rw-r--r-- | src/language-editor.c | 23 |
1 files changed, 23 insertions, 0 deletions
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, |