source: lightdm-gtk-greeter/trunk/fuentes/debian/patches/valencian_labels @ 2361

Last change on this file since 2361 was 2361, checked in by mabarracus, 4 years ago

Added patched content

File size: 8.5 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+lliurex) xenial; urgency=medium
9 .
10   * Change language labels
11Author: M.Angel Juan <m.angel.juan>
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
26--- lightdm-gtk-greeter-2.0.1.orig/src/lightdm-gtk-greeter.c
27+++ lightdm-gtk-greeter-2.0.1/src/lightdm-gtk-greeter.c
28@@ -184,7 +184,7 @@ static gchar *current_language;
29 static gchar* get_language (void);
30 static void set_language (const gchar *language);
31 void language_selected_cb (GtkMenuItem *menuitem, gpointer user_data);
32-
33+static const gchar* gchar_valencian = "Valencià";
34 /* Screensaver values */
35 static int timeout, interval, prefer_blanking, allow_exposures;
36 
37@@ -1027,14 +1027,23 @@ get_language (void)
38     GList *menu_items, *menu_iter;
39 
40     /* if the user manually selected a language, use it */
41-    if (current_language)
42-        return g_strdup (current_language);
43+    if (current_language){
44+       if(g_strcmp0(current_language,gchar_valencian)!=0)
45+           return g_strdup (current_language);
46+       else
47+           return g_strdup_printf("%s","ca_ES@valencia");
48+    }
49 
50     menu_items = gtk_container_get_children (GTK_CONTAINER (language_menu));
51     for (menu_iter = menu_items; menu_iter != NULL; menu_iter = g_list_next (menu_iter))
52     {
53-        if (gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (menu_iter->data)))
54-            return g_strdup (g_object_get_data (G_OBJECT (menu_iter->data), LANGUAGE_DATA_CODE));
55+        if (gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (menu_iter->data))){
56+           gchar *lang= g_object_get_data (G_OBJECT (menu_iter->data), LANGUAGE_DATA_CODE);
57+            if (g_strcmp0(lang,gchar_valencian)!=0)
58+               return g_strdup (lang);
59+           else
60+               return g_strdup_printf("%s","ca_ES@valencia");
61+       }
62     }
63 
64     return NULL;
65@@ -1045,6 +1054,9 @@ set_language (const gchar *language)
66 {
67     const gchar *default_language = NULL;
68     GList *menu_items, *menu_iter;
69+   
70+    if ( g_strcmp0(language,gchar_valencian)==0)
71+       language = g_strdup_printf("%s","ca_ES@valencia");
72 
73     if (!gtk_widget_get_visible (language_menuitem))
74     {
75@@ -1054,7 +1066,6 @@ set_language (const gchar *language)
76     }
77 
78     menu_items = gtk_container_get_children (GTK_CONTAINER (language_menu));
79-
80     if (language)
81     {
82         for (menu_iter = menu_items; menu_iter != NULL; menu_iter = g_list_next (menu_iter))
83@@ -1062,30 +1073,37 @@ set_language (const gchar *language)
84             gchar *s;
85             gboolean matched;
86             s = g_strdup (g_object_get_data (G_OBJECT (menu_iter->data), LANGUAGE_DATA_CODE));
87-            matched = g_strcmp0 (s, language) == 0;
88+            if ( g_strcmp0(s,gchar_valencian)==0)
89+               s = g_strdup_printf("%s","ca_ES@valencia");
90+           matched = g_strcmp0 (s, language) == 0;
91             g_free (s);
92             if (matched)
93             {
94                 gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_iter->data), TRUE);
95                 g_free (current_language);
96                 current_language = g_strdup (language);
97-                gtk_menu_item_set_label (GTK_MENU_ITEM (language_menuitem),language);
98+
99+               if ( g_strcmp0(current_language,"ca_ES@valencia")==0)
100+                   gtk_menu_item_set_label (GTK_MENU_ITEM (language_menuitem),g_strdup_printf("%s",gchar_valencian));
101+               else
102+                   gtk_menu_item_set_label (GTK_MENU_ITEM (language_menuitem),current_language);
103                 return;
104             }
105         }
106     }
107-
108     /* If failed to find this language, then try the default */
109     if (lightdm_get_language ())
110     {
111         default_language = lightdm_language_get_code (lightdm_get_language ());
112-        gtk_menu_item_set_label (GTK_MENU_ITEM (language_menuitem), default_language);
113+       if ( g_strcmp0(default_language,"ca_ES@valencia")==0)
114+               gtk_menu_item_set_label (GTK_MENU_ITEM (language_menuitem), g_strdup_printf("%s",gchar_valencian));
115+       else
116+           gtk_menu_item_set_label (GTK_MENU_ITEM (language_menuitem), default_language);
117     }
118     if (default_language && g_strcmp0 (default_language, language) != 0)
119-        set_language (default_language);
120+       set_language (default_language);
121     /* If all else fails, just use the first language from the menu */
122     else
123-    {
124         for (menu_iter = menu_items; menu_iter != NULL; menu_iter = g_list_next (menu_iter))
125         {
126             if (gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (menu_iter->data)))
127@@ -1094,7 +1112,6 @@ set_language (const gchar *language)
128                 break;
129             }
130         }
131-    }
132 }
133 
134 void
135@@ -1102,8 +1119,12 @@ language_selected_cb (GtkMenuItem *menui
136 {
137     if (gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (menuitem)))
138     {
139-       gchar *language = g_object_get_data (G_OBJECT (menuitem), LANGUAGE_DATA_CODE);
140-       set_language (language);
141+        gchar *language = g_object_get_data (G_OBJECT (menuitem), LANGUAGE_DATA_CODE);
142+       if (g_strcmp0(language,gchar_valencian) == 0){
143+           language = g_strdup_printf("%s","ca_ES@valencia");
144+       }
145+       set_language (language);
146+       g_free(language);
147     }
148 }
149 
150@@ -1941,7 +1962,6 @@ start_authentication (const gchar *usern
151     else
152     {
153         LightDMUser *user;
154-
155         user = lightdm_user_list_get_user_by_name (lightdm_user_list_get_instance (), username);
156         if (user)
157         {
158@@ -1958,6 +1978,7 @@ start_authentication (const gchar *usern
159 
160         lightdm_greeter_authenticate (greeter, username);
161     }
162+
163 }
164 
165 static void
166@@ -2009,12 +2030,10 @@ start_session (void)
167 {
168     gchar *language;
169     gchar *session;
170-
171     language = get_language ();
172     if (language)
173         lightdm_greeter_set_language (greeter, language);
174     g_free (language);
175-
176     session = get_session ();
177 
178     /* Remember last choice */
179@@ -2885,7 +2904,6 @@ main (int argc, char **argv)
180         }
181         set_session (NULL);
182     }
183-
184     /* Language menu */
185     if (gtk_widget_get_visible (language_menuitem))
186     {
187@@ -2900,21 +2918,26 @@ main (int argc, char **argv)
188 
189             country = lightdm_language_get_territory (language);
190             if (country)
191-                label = g_strdup_printf ("%s - %s", lightdm_language_get_name (language), country);
192-            else
193+               label = g_strdup_printf ("%s - %s", lightdm_language_get_name (language), country);
194+           else
195                 label = g_strdup (lightdm_language_get_name (language));
196-
197             code = lightdm_language_get_code (language);
198             gchar *modifier = strchr (code, '@');
199             if (modifier != NULL)
200-            {
201-                gchar *label_new = g_strdup_printf ("%s [%s]", label, modifier+1);
202+            { 
203+               gchar *label_new;
204+                if (g_strcmp0(modifier+1,"valencia")!=0){
205+                   label_new = g_strdup_printf ("%s [%s]", label, modifier+1);
206+               }else{
207+                   label_new = g_strdup_printf ("%s", gchar_valencian);
208+               }
209                 g_free (label);
210                 label = label_new;
211             }
212-
213-            radiomenuitem = gtk_radio_menu_item_new_with_label (languages, label);
214-            g_object_set_data (G_OBJECT (radiomenuitem), LANGUAGE_DATA_CODE, (gpointer) code);
215+           radiomenuitem = gtk_radio_menu_item_new_with_label (languages, label);
216+           if (g_strcmp0(code,"ca_ES@valencia")==0)
217+               code = g_strdup_printf ("%s", gchar_valencian);
218+           g_object_set_data (G_OBJECT (radiomenuitem), LANGUAGE_DATA_CODE, (gpointer) code);
219             languages = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (radiomenuitem));
220             g_signal_connect (G_OBJECT (radiomenuitem), "activate", G_CALLBACK (language_selected_cb), NULL);
221             gtk_menu_shell_append (GTK_MENU_SHELL (language_menu), radiomenuitem);
222@@ -2922,7 +2945,6 @@ main (int argc, char **argv)
223         }
224         set_language (NULL);
225     }
226-
227     /* a11y menu */
228     if (gtk_widget_get_visible (a11y_menuitem))
229     {
Note: See TracBrowser for help on using the repository browser.