gdm/gdm-2.23.92-filter-dupes-from-lang-list.patch
Ray Strode e1ea6b93ab - canonicalize codeset to match output of locale -m
- filter duplicates from language list
2008-09-17 15:15:09 +00:00

139 lines
6.2 KiB
Diff

diff -up gdm-2.23.92/gui/simple-greeter/gdm-language-option-widget.c.filter-dupes-from-lang-list gdm-2.23.92/gui/simple-greeter/gdm-language-option-widget.c
--- gdm-2.23.92/gui/simple-greeter/gdm-language-option-widget.c.filter-dupes-from-lang-list 2008-08-26 15:04:00.000000000 -0400
+++ gdm-2.23.92/gui/simple-greeter/gdm-language-option-widget.c 2008-09-17 11:07:51.000000000 -0400
@@ -173,7 +173,7 @@ gdm_language_option_widget_class_init (G
g_type_class_add_private (klass, sizeof (GdmLanguageOptionWidgetPrivate));
}
-static gboolean
+static char *
gdm_language_option_widget_lookup_item (GdmRecentOptionWidget *widget,
const char *locale,
char **name,
@@ -182,11 +182,15 @@ gdm_language_option_widget_lookup_item (
char *language;
char *readable_language;
char *lang_tag;
+ char *normalized_locale;
- language = gdm_get_language_from_name (locale, locale);
+ normalized_locale = gdm_normalize_language_name (locale);
+
+ language = gdm_get_language_from_name (locale, normalized_locale);
if (language == NULL) {
- return FALSE;
+ g_free (normalized_locale);
+ return NULL;
}
readable_language = gdm_get_language_from_name (locale, NULL);
@@ -197,7 +201,7 @@ gdm_language_option_widget_lookup_item (
g_free (language);
g_free (lang_tag);
- return TRUE;
+ return normalized_locale;
}
static void
@@ -294,7 +298,7 @@ gdm_language_option_widget_set_current_l
if (normalized_language_name != NULL &&
!gdm_option_widget_lookup_item (GDM_OPTION_WIDGET (widget),
- normalized_language_name, NULL, NULL, NULL)) {
+ &normalized_language_name, NULL, NULL, NULL)) {
gdm_recent_option_widget_add_item (GDM_RECENT_OPTION_WIDGET (widget),
normalized_language_name);
}
diff -up gdm-2.23.92/gui/simple-greeter/gdm-layout-option-widget.c.filter-dupes-from-lang-list gdm-2.23.92/gui/simple-greeter/gdm-layout-option-widget.c
--- gdm-2.23.92/gui/simple-greeter/gdm-layout-option-widget.c.filter-dupes-from-lang-list 2008-09-17 10:55:20.000000000 -0400
+++ gdm-2.23.92/gui/simple-greeter/gdm-layout-option-widget.c 2008-09-17 11:08:07.000000000 -0400
@@ -176,24 +176,24 @@ gdm_layout_option_widget_class_init (Gdm
g_type_class_add_private (klass, sizeof (GdmLayoutOptionWidgetPrivate));
}
-static gboolean
+static char *
gdm_layout_option_widget_lookup_item (GdmRecentOptionWidget *widget,
- const char *id,
+ const char *key,
char **name,
char **comment)
{
char *layout;
- layout = gdm_get_layout_from_name (id);
+ layout = gdm_get_layout_from_name (key);
if (layout == NULL) {
- return FALSE;
+ return NULL;
}
*name = layout;
*comment = NULL;
- return TRUE;
+ return g_strdup (key);
}
static void
diff -up gdm-2.23.92/gui/simple-greeter/gdm-recent-option-widget.c.filter-dupes-from-lang-list gdm-2.23.92/gui/simple-greeter/gdm-recent-option-widget.c
--- gdm-2.23.92/gui/simple-greeter/gdm-recent-option-widget.c.filter-dupes-from-lang-list 2008-08-26 15:04:00.000000000 -0400
+++ gdm-2.23.92/gui/simple-greeter/gdm-recent-option-widget.c 2008-09-17 11:06:34.000000000 -0400
@@ -159,13 +159,24 @@ gdm_recent_option_widget_sync_items_from
default_is_set = FALSE;
for (tmp = list; tmp != NULL; tmp = tmp->next) {
- const char *id;
+ const char *key;
+ char *id;
char *name;
char *comment;
- id = (char *) tmp->data;
+ key = (char *) tmp->data;
+
+ id = widget->priv->lookup_item_func (widget, key, &name, &comment);
+
+ if (id != NULL) {
+ gboolean item_exists;
+
+ item_exists = gdm_option_widget_lookup_item (GDM_OPTION_WIDGET (widget), id, NULL, NULL, NULL);
+
+ if (item_exists) {
+ continue;
+ }
- if (widget->priv->lookup_item_func (widget, id, &name, &comment)) {
gdm_option_widget_add_item (GDM_OPTION_WIDGET (widget),
id, name, comment,
GDM_OPTION_WIDGET_POSITION_MIDDLE);
@@ -177,6 +188,7 @@ gdm_recent_option_widget_sync_items_from
g_free (name);
g_free (comment);
+ g_free (id);
}
}
diff -up gdm-2.23.92/gui/simple-greeter/gdm-recent-option-widget.h.filter-dupes-from-lang-list gdm-2.23.92/gui/simple-greeter/gdm-recent-option-widget.h
--- gdm-2.23.92/gui/simple-greeter/gdm-recent-option-widget.h.filter-dupes-from-lang-list 2008-08-26 15:04:00.000000000 -0400
+++ gdm-2.23.92/gui/simple-greeter/gdm-recent-option-widget.h 2008-09-17 11:07:40.000000000 -0400
@@ -48,10 +48,10 @@ typedef struct
GdmOptionWidgetClass parent_class;
} GdmRecentOptionWidgetClass;
-typedef gboolean (* GdmRecentOptionLookupItemFunc) (GdmRecentOptionWidget *widget,
- const char *id,
- char **name,
- char **comment);
+typedef char * (* GdmRecentOptionLookupItemFunc) (GdmRecentOptionWidget *widget,
+ const char *key,
+ char **name,
+ char **comment);
GType gdm_recent_option_widget_get_type (void);