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

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

fixed patch valencian_labels

File size: 6.6 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
26Index: fuentes/src/lightdm-gtk-greeter.c
27===================================================================
28--- fuentes.orig/src/lightdm-gtk-greeter.c
29+++ fuentes/src/lightdm-gtk-greeter.c
30@@ -184,6 +184,7 @@ static gchar *current_language;
31 static gchar* get_language (void);
32 static void set_language (const gchar *language);
33 void language_selected_cb (GtkMenuItem *menuitem, gpointer user_data);
34+static const gchar* gchar_valencian = "Valencià";
35 
36 /* Screensaver values */
37 static int timeout, interval, prefer_blanking, allow_exposures;
38@@ -1003,7 +1004,7 @@ set_session (const gchar *session)
39             menu_iter = menu_items;
40 
41         if (menu_iter)
42-               gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_iter->data), TRUE);
43+            gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_iter->data), TRUE);
44     }
45 
46     g_free (current_session);
47@@ -1027,14 +1028,23 @@ get_language (void)
48     GList *menu_items, *menu_iter;
49 
50     /* if the user manually selected a language, use it */
51-    if (current_language)
52-        return g_strdup (current_language);
53+    if (current_language){
54+        if(g_strcmp0(current_language,gchar_valencian)!=0)
55+            return g_strdup (current_language);
56+        else
57+            return g_strdup_printf("%s","ca_ES@valencia");
58+    }
59 
60     menu_items = gtk_container_get_children (GTK_CONTAINER (language_menu));
61     for (menu_iter = menu_items; menu_iter != NULL; menu_iter = g_list_next (menu_iter))
62     {
63-        if (gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (menu_iter->data)))
64-            return g_strdup (g_object_get_data (G_OBJECT (menu_iter->data), LANGUAGE_DATA_CODE));
65+        if (gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (menu_iter->data))){
66+            gchar *lang= g_object_get_data (G_OBJECT (menu_iter->data), LANGUAGE_DATA_CODE);
67+            if (g_strcmp0(lang,gchar_valencian)!=0)
68+                return g_strdup (lang);
69+            else
70+                return g_strdup_printf("%s","ca_ES@valencia");
71+        }
72     }
73 
74     return NULL;
75@@ -1046,6 +1056,9 @@ set_language (const gchar *language)
76     const gchar *default_language = NULL;
77     GList *menu_items, *menu_iter;
78 
79+    if ( g_strcmp0(language,gchar_valencian)==0)
80+       language = g_strdup_printf("%s","ca_ES@valencia");
81+
82     if (!gtk_widget_get_visible (language_menuitem))
83     {
84         g_free (current_language);
85@@ -1062,6 +1075,8 @@ set_language (const gchar *language)
86             gchar *s;
87             gboolean matched;
88             s = g_strdup (g_object_get_data (G_OBJECT (menu_iter->data), LANGUAGE_DATA_CODE));
89+            if ( g_strcmp0(s,gchar_valencian)==0)
90+                s = g_strdup_printf("%s","ca_ES@valencia");
91             matched = g_strcmp0 (s, language) == 0;
92             g_free (s);
93             if (matched)
94@@ -1069,7 +1084,11 @@ set_language (const gchar *language)
95                 gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_iter->data), TRUE);
96                 g_free (current_language);
97                 current_language = g_strdup (language);
98-                gtk_menu_item_set_label (GTK_MENU_ITEM (language_menuitem),language);
99+
100+                if ( g_strcmp0(current_language,"ca_ES@valencia")==0)
101+                    gtk_menu_item_set_label (GTK_MENU_ITEM (language_menuitem),g_strdup_printf("%s",gchar_valencian));
102+                else
103+                    gtk_menu_item_set_label (GTK_MENU_ITEM (language_menuitem),current_language);
104                 return;
105             }
106         }
107@@ -1079,7 +1098,10 @@ set_language (const gchar *language)
108     if (lightdm_get_language ())
109     {
110         default_language = lightdm_language_get_code (lightdm_get_language ());
111-        gtk_menu_item_set_label (GTK_MENU_ITEM (language_menuitem), default_language);
112+        if ( g_strcmp0(default_language,"ca_ES@valencia")==0)
113+            gtk_menu_item_set_label (GTK_MENU_ITEM (language_menuitem), g_strdup_printf("%s",gchar_valencian));
114+        else
115+            gtk_menu_item_set_label (GTK_MENU_ITEM (language_menuitem), default_language);
116     }
117     if (default_language && g_strcmp0 (default_language, language) != 0)
118         set_language (default_language);
119@@ -1103,6 +1125,9 @@ language_selected_cb (GtkMenuItem *menui
120     if (gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (menuitem)))
121     {
122        gchar *language = g_object_get_data (G_OBJECT (menuitem), LANGUAGE_DATA_CODE);
123+       if (g_strcmp0(language,gchar_valencian) == 0){
124+            language = g_strdup_printf("%s","ca_ES@valencia");
125+       }
126        set_language (language);
127     }
128 }
129@@ -2908,12 +2933,19 @@ main (int argc, char **argv)
130             gchar *modifier = strchr (code, '@');
131             if (modifier != NULL)
132             {
133-                gchar *label_new = g_strdup_printf ("%s [%s]", label, modifier+1);
134+                gchar *label_new;
135+                if (g_strcmp0(modifier+1,"valencia")!=0){
136+                    label_new = g_strdup_printf ("%s [%s]", label, modifier+1);
137+                }else{
138+                    label_new = g_strdup_printf ("%s", gchar_valencian);
139+                }
140                 g_free (label);
141                 label = label_new;
142             }
143 
144             radiomenuitem = gtk_radio_menu_item_new_with_label (languages, label);
145+            if (g_strcmp0(code,"ca_ES@valencia")==0)
146+                code = g_strdup_printf ("%s", gchar_valencian);
147             g_object_set_data (G_OBJECT (radiomenuitem), LANGUAGE_DATA_CODE, (gpointer) code);
148             languages = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (radiomenuitem));
149             g_signal_connect (G_OBJECT (radiomenuitem), "activate", G_CALLBACK (language_selected_cb), NULL);
Note: See TracBrowser for help on using the repository browser.