source: lightdm-gtk-greeter/trunk/fuentes/debian/patches/test_default @ 2857

Last change on this file since 2857 was 2857, checked in by mabarracus, 3 years ago

Add default language option to use pam_environment sessions settings

File size: 5.7 KB
Line 
1Description: <short summary of the patch>
2 TODO: Put a short summary on the line above and replace this paragraph
3 with a longer explanation of this change. Complete the meta-information
4 with other relevant fields (see below for details). To make it easier, the
5 information below has been extracted from the changelog. Adjust it or drop
6 it.
7 .
8 lightdm-gtk-greeter (2.0.1-2+lliurex2) xenial; urgency=medium
9 .
10   * Change language labels (fixed patch)
11Author: M.Angel Juan <m.angel.juan@gmail.com>
12
13---
14The information above should follow the Patch Tagging Guidelines, please
15checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
16are templates for supplementary fields that you might want to add:
17
18Origin: <vendor|upstream|other>, <url of original patch>
19Bug: <url in upstream bugtracker>
20Bug-Debian: https://bugs.debian.org/<bugnumber>
21Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
22Forwarded: <no|not-needed|url proving that it has been forwarded>
23Reviewed-By: <name and email of someone who approved the patch>
24Last-Update: <YYYY-MM-DD>
25
26Index: fuentes/src/lightdm-gtk-greeter.c
27===================================================================
28--- fuentes.orig/src/lightdm-gtk-greeter.c
29+++ fuentes/src/lightdm-gtk-greeter.c
30@@ -300,7 +300,6 @@ struct SavedFocusData
31 gpointer greeter_save_focus(GtkWidget* widget);
32 void greeter_restore_focus(const gpointer saved_data);
33 
34-
35 static void
36 read_monitor_configuration (const gchar *group, const gchar *name)
37 {
38@@ -1026,7 +1025,6 @@ static gchar*
39 get_language (void)
40 {
41     GList *menu_items, *menu_iter;
42-
43     /* if the user manually selected a language, use it */
44     if (current_language){
45         if(g_strcmp0(current_language,gchar_valencian)!=0)
46@@ -1050,6 +1048,7 @@ get_language (void)
47     return NULL;
48 }
49 
50+
51 static void
52 set_language (const gchar *language)
53 {
54@@ -1065,7 +1064,7 @@ set_language (const gchar *language)
55         current_language = g_strdup (language);
56         return;
57     }
58-
59+   
60     menu_items = gtk_container_get_children (GTK_CONTAINER (language_menu));
61 
62     if (language)
63@@ -1084,11 +1083,14 @@ set_language (const gchar *language)
64                 gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_iter->data), TRUE);
65                 g_free (current_language);
66                 current_language = g_strdup (language);
67-
68-                if ( g_strcmp0(current_language,"ca_ES@valencia")==0)
69+                if ( g_strcmp0(current_language,"ca_ES@valencia")==0){
70                     gtk_menu_item_set_label (GTK_MENU_ITEM (language_menuitem),g_strdup_printf("%s",gchar_valencian));
71-                else
72-                    gtk_menu_item_set_label (GTK_MENU_ITEM (language_menuitem),current_language);
73+               }else{
74+                   if ( g_strcmp0(current_language,"default")==0)
75+                       gtk_menu_item_set_label (GTK_MENU_ITEM (language_menuitem),g_strdup_printf("%s","Default Language"));
76+                   else
77+                       gtk_menu_item_set_label (GTK_MENU_ITEM (language_menuitem),current_language);
78+               }
79                 return;
80             }
81         }
82@@ -1105,6 +1107,12 @@ set_language (const gchar *language)
83     }
84     if (default_language && g_strcmp0 (default_language, language) != 0)
85         set_language (default_language);
86+
87+    if (language == NULL ){
88+           gtk_menu_item_set_label (GTK_MENU_ITEM (language_menuitem), "Default Language");
89+           default_language=g_strdup_printf("%s","default");
90+           set_language("default");
91+    }
92     /* If all else fails, just use the first language from the menu */
93     else
94     {
95@@ -1128,6 +1136,9 @@ language_selected_cb (GtkMenuItem *menui
96        if (g_strcmp0(language,gchar_valencian) == 0){
97             language = g_strdup_printf("%s","ca_ES@valencia");
98        }
99+       if (g_strcmp0(language,"Default Language") == 0){
100+            language = g_strdup_printf("%s","default");
101+       }
102        set_language (language);
103     }
104 }
105@@ -2037,7 +2048,8 @@ start_session (void)
106 
107     language = get_language ();
108     if (language)
109-        lightdm_greeter_set_language (greeter, language);
110+       if (g_strcmp0(language,"default") != 0)
111+           lightdm_greeter_set_language (greeter, language);
112     g_free (language);
113 
114     session = get_session ();
115@@ -2206,12 +2218,7 @@ set_displayed_user (LightDMGreeter *gree
116     set_user_image (username);
117     user = lightdm_user_list_get_user_by_name (lightdm_user_list_get_instance (), username);
118     if (user)
119-    {
120-        set_language (lightdm_user_get_language (user));
121         set_session (lightdm_user_get_session (user));
122-    }
123-    else
124-        set_language (lightdm_language_get_code (lightdm_get_language ()));
125     gtk_widget_set_tooltip_text (GTK_WIDGET (user_combo), user_tooltip);
126     start_authentication (username);
127     g_free (user_tooltip);
128@@ -2916,7 +2923,17 @@ main (int argc, char **argv)
129     {
130         items = lightdm_get_languages ();
131         GSList *languages = NULL;
132-        for (item = items; item; item = item->next)
133+
134+       gchar *dummy_label = g_strdup_printf ("%s", "Default Language");
135+       gchar *dummy_code = g_strdup_printf ("%s", "default");
136+       GtkWidget *radiomenuitem_dummy = gtk_radio_menu_item_new_with_label(languages,dummy_label);
137+       g_object_set_data(G_OBJECT (radiomenuitem_dummy), LANGUAGE_DATA_CODE, (gpointer) dummy_code);
138+        languages = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (radiomenuitem_dummy));
139+        g_signal_connect (G_OBJECT (radiomenuitem_dummy), "activate", G_CALLBACK (language_selected_cb), NULL);
140+        gtk_menu_shell_append (GTK_MENU_SHELL (language_menu), radiomenuitem_dummy);
141+        gtk_widget_show (GTK_WIDGET (radiomenuitem_dummy));
142+       
143+       for (item = items; item; item = item->next)
144         {
145             LightDMLanguage *language = item->data;
146             const gchar *country, *code;
Note: See TracBrowser for help on using the repository browser.