Re: forcing of English :)



On Sun, Jun 18, 2000 at 06:07:06PM -0700, Ryan Murray wrote:
> English is always in the list, which solves the problem...

ugh.  Missed a few things, and forgot to test it first.  <sigh>

Here's a patch that actually works.  I've put English in the "Other" menu
for now, since most systems don't have anything in "other", and English
doesn't look good when it shows up out of order (most locale.alias files are
sorted).

It may even make sense to have an option for "C" in the menu with the
breakdown sub-menus...

-- 
Ryan Murray, (rmurray cyberhqz com, rmurray debian org, rmurray stormix com)
Programmer, Stormix Technologies Inc., Debian Developer
The opinions expressed here are my own.
diff -ruN gdm-2.0beta4.orig/gui/gdmlogin.c gdm-2.0beta4/gui/gdmlogin.c
--- gdm-2.0beta4.orig/gui/gdmlogin.c	Sun Jun 18 18:15:03 2000
+++ gdm-2.0beta4/gui/gdmlogin.c	Sun Jun 18 18:14:08 2000
@@ -713,6 +713,7 @@
     FILE *langlist;
     char curline[256];
     char *ctmp, *ctmp1, *ctmp2;
+    BOOL english = FALSE;
 
     if (!menu)
 	return;
@@ -752,8 +753,7 @@
 
     langlist = fopen (GdmLocaleFile, "r");
 
-    if (!langlist)
-	return;
+    if (langlist) {
         
     while (fgets (curline, sizeof (curline), langlist)) {
 
@@ -773,6 +773,10 @@
 	*ctmp = '\0';
 	curline[0] = toupper (curline[0]);
 	
+	if ( !strcmp( curline, "English" ) ) {
+		english = TRUE;
+	}
+
 	item = gtk_radio_menu_item_new_with_label (languages, curline);
 	languages = gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (item));
 
@@ -790,6 +794,25 @@
     }
     
     fclose (langlist);
+    }
+
+	/*
+	 * This should maybe include more name checks than "English" (POSIX,
+	 * "C", etc...), but it's better than nothing.
+	 * It allows a user to always have a sane locale in the menu,
+	 * however, if all others were removed for some reason, or English
+	 * isn't in the installed list.
+	 * English isn't really "other", but it looks better there...
+	 */
+    if ( !english ) {
+	item = gtk_radio_menu_item_new_with_label (languages, "English" );
+	languages = gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (item));
+	gtk_menu_append (GTK_MENU (omenu), item);
+	gtk_signal_connect (GTK_OBJECT (item), "activate", 
+			    GTK_SIGNAL_FUNC (gdm_login_language_handler), 
+			    NULL);
+	gtk_widget_show (GTK_WIDGET (item));
+    }
 }
 
 

Attachment: pgpeBtnM5BVz7.pgp
Description: PGP signature



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