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



Author: mccann
Date: Mon Mar 24 03:34:34 2008
New Revision: 6055
URL: http://svn.gnome.org/viewvc/gdm?rev=6055&view=rev

Log:
2008-03-23  William Jon McCann  <jmccann redhat com>

	* gui/simple-greeter/Makefile.am:
	* gui/simple-greeter/gdm-language-option-widget.c: (create_dialog),
	(gdm_language_option_widget_init):
	* gui/simple-greeter/test-languages.c: (print_languages), (main):
	Add a test tool for language lookup and resolution.



Added:
   trunk/gui/simple-greeter/test-languages.c
Modified:
   trunk/ChangeLog
   trunk/gui/simple-greeter/Makefile.am
   trunk/gui/simple-greeter/gdm-language-option-widget.c

Modified: trunk/gui/simple-greeter/Makefile.am
==============================================================================
--- trunk/gui/simple-greeter/Makefile.am	(original)
+++ trunk/gui/simple-greeter/Makefile.am	Mon Mar 24 03:34:34 2008
@@ -56,13 +56,14 @@
 	$(NULL)
 
 noinst_PROGRAMS = 			\
+	test-a11y-preferences		\
 	test-greeter-login-window	\
-	test-remote-login-window	\
 	test-greeter-panel		\
 	test-language-chooser		\
+	test-languages			\
+	test-remote-login-window	\
 	test-user-chooser		\
 	test-user-manager		\
-	test-a11y-preferences		\
 	$(NULL)
 
 test_greeter_login_window_SOURCES = 	\
@@ -159,6 +160,17 @@
 	$(GTK_LIBS)		\
 	$(NULL)
 
+test_languages_SOURCES = 		\
+	test-languages.c		\
+	gdm-languages.h			\
+	gdm-languages.c			\
+	locarchive.h			\
+	$(NULL)
+
+test_languages_LDADD =		\
+	$(GTK_LIBS)		\
+	$(NULL)
+
 test_user_chooser_SOURCES = 		\
 	test-user-chooser.c		\
 	gdm-cell-renderer-timer.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	Mon Mar 24 03:34:34 2008
@@ -35,6 +35,7 @@
 #include <glib/gstdio.h>
 #include <gtk/gtk.h>
 
+#include "gdm-profile.h"
 #include "gdm-languages.h"
 #include "gdm-language-option-widget.h"
 #include "gdm-recent-option-widget.h"
@@ -161,6 +162,23 @@
 }
 
 static void
+create_dialog (GdmLanguageOptionWidget *widget)
+{
+        gdm_profile_start (NULL);
+
+        g_assert (widget->priv->dialog == NULL);
+
+        widget->priv->dialog = gdm_language_chooser_dialog_new ();
+
+        g_signal_connect (GTK_DIALOG (widget->priv->dialog),
+                          "response",
+                          G_CALLBACK (on_dialog_response),
+                          widget);
+
+        gdm_profile_end (NULL);
+}
+
+static void
 gdm_language_option_widget_init (GdmLanguageOptionWidget *widget)
 {
         GError *error;
@@ -180,15 +198,13 @@
         }
 
         gdm_option_widget_add_item (GDM_OPTION_WIDGET (widget),
-                                    "__other", _("Other..."),
+                                    "__other",
+                                    _("Other..."),
                                     _("Choose a language from the "
                                       "full list of available languages."),
                                     GDM_OPTION_WIDGET_POSITION_BOTTOM);
 
-        widget->priv->dialog = gdm_language_chooser_dialog_new ();
-
-        g_signal_connect (GTK_DIALOG (widget->priv->dialog), "response",
-                G_CALLBACK (on_dialog_response), widget);
+        create_dialog (widget);
 }
 
 static void

Added: trunk/gui/simple-greeter/test-languages.c
==============================================================================
--- (empty file)
+++ trunk/gui/simple-greeter/test-languages.c	Mon Mar 24 03:34:34 2008
@@ -0,0 +1,81 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2007 William Jon McCann <mccann jhu edu>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <libintl.h>
+#include <locale.h>
+#include <string.h>
+#include <unistd.h>
+#include <signal.h>
+#include <errno.h>
+
+#include <glib/gi18n.h>
+#include <gtk/gtk.h>
+
+#include "gdm-languages.h"
+
+static void
+print_languages (void)
+{
+        char **language_names;
+        int    i;
+
+        language_names = gdm_get_all_language_names ();
+
+        for (i = 0; language_names[i] != NULL; i++) {
+                char *language;
+                char *normalized_name;
+                char *readable_language;
+
+                normalized_name = gdm_normalize_language_name (language_names[i]);
+                language = gdm_get_language_from_name (normalized_name, normalized_name);
+                readable_language = gdm_get_language_from_name (normalized_name, NULL);
+
+                g_print ("%s\t%s\t%s\t%s\n",
+                         language_names[i],
+                         normalized_name,
+                         language,
+                         readable_language);
+
+                g_free (language);
+                g_free (readable_language);
+                g_free (normalized_name);
+        }
+
+        g_strfreev (language_names);
+}
+
+int
+main (int argc, char *argv[])
+{
+
+        bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
+        bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+        textdomain (GETTEXT_PACKAGE);
+
+        setlocale (LC_ALL, "");
+
+        gtk_init (&argc, &argv);
+
+        print_languages ();
+
+        return 0;
+}



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