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 | |
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.
-rw-r--r-- | ChangeLog | 12 | ||||
-rw-r--r-- | lib/ephy-dialog.c | 1 | ||||
-rw-r--r-- | src/language-editor.c | 23 | ||||
-rw-r--r-- | src/prefs-dialog.c | 18 |
4 files changed, 52 insertions, 2 deletions
@@ -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)); |