gdm r6554 - in trunk: . gui/simple-greeter



Author: halfline
Date: Wed Oct  1 14:32:11 2008
New Revision: 6554
URL: http://svn.gnome.org/viewvc/gdm?rev=6554&view=rev

Log:
2008-10-01  Ray Strode <rstrode redhat com>

	* gui/simple-greeter/gdm-language-option-widget.c:
	* gui/simple-greeter/gdm-recent-option-widget.[ch]:
	Filter out duplicates from gconf mru lists that
	back language selector on panel


Modified:
   trunk/ChangeLog
   trunk/gui/simple-greeter/gdm-language-option-widget.c
   trunk/gui/simple-greeter/gdm-layout-option-widget.c
   trunk/gui/simple-greeter/gdm-recent-option-widget.c
   trunk/gui/simple-greeter/gdm-recent-option-widget.h

Modified: trunk/gui/simple-greeter/gdm-language-option-widget.c
==============================================================================
--- trunk/gui/simple-greeter/gdm-language-option-widget.c	(original)
+++ trunk/gui/simple-greeter/gdm-language-option-widget.c	Wed Oct  1 14:32:11 2008
@@ -173,7 +173,7 @@
         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 @@
         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 @@
         g_free (language);
         g_free (lang_tag);
 
-        return TRUE;
+        return normalized_locale;
 }
 
 static void
@@ -294,7 +298,7 @@
 
         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);
         }

Modified: trunk/gui/simple-greeter/gdm-layout-option-widget.c
==============================================================================
--- trunk/gui/simple-greeter/gdm-layout-option-widget.c	(original)
+++ trunk/gui/simple-greeter/gdm-layout-option-widget.c	Wed Oct  1 14:32:11 2008
@@ -176,24 +176,24 @@
         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

Modified: trunk/gui/simple-greeter/gdm-recent-option-widget.c
==============================================================================
--- trunk/gui/simple-greeter/gdm-recent-option-widget.c	(original)
+++ trunk/gui/simple-greeter/gdm-recent-option-widget.c	Wed Oct  1 14:32:11 2008
@@ -159,13 +159,24 @@
         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 @@
 
                         g_free (name);
                         g_free (comment);
+                        g_free (id);
                 }
         }
 

Modified: trunk/gui/simple-greeter/gdm-recent-option-widget.h
==============================================================================
--- trunk/gui/simple-greeter/gdm-recent-option-widget.h	(original)
+++ trunk/gui/simple-greeter/gdm-recent-option-widget.h	Wed Oct  1 14:32:11 2008
@@ -48,10 +48,10 @@
         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);



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