Merge lp:~attente/gnome-screensaver/lp1225514 into lp:~ubuntu-desktop/gnome-screensaver/ubuntu
- lp1225514
- Merge into ubuntu
Proposed by
William Hua
Status: | Merged |
---|---|
Merge reported by: | Sebastien Bacher |
Merged at revision: | not available |
Proposed branch: | lp:~attente/gnome-screensaver/lp1225514 |
Merge into: | lp:~ubuntu-desktop/gnome-screensaver/ubuntu |
Diff against target: |
373 lines (+353/-0) 3 files modified
debian/changelog (+7/-0) debian/patches/32_input_sources_switcher.patch (+345/-0) debian/patches/series (+1/-0) |
To merge this branch: | bzr merge lp:~attente/gnome-screensaver/lp1225514 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Sebastien Bacher | Approve | ||
Review via email: mp+193152@code.launchpad.net |
Commit message
* debian/
- Use input sources instead of XKB layouts.
Description of the change
* debian/
- Use input sources instead of XKB layouts.
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'debian/changelog' |
2 | --- debian/changelog 2013-05-28 12:33:11 +0000 |
3 | +++ debian/changelog 2013-10-29 22:30:08 +0000 |
4 | @@ -1,3 +1,10 @@ |
5 | +gnome-screensaver (3.6.1-0ubuntu7) UNRELEASED; urgency=low |
6 | + |
7 | + * debian/patches/32_input_sources_switcher.patch: |
8 | + - Use input sources instead of XKB layouts. |
9 | + |
10 | + -- William Hua <william.hua@canonical.com> Tue, 29 Oct 2013 11:21:38 -0700 |
11 | + |
12 | gnome-screensaver (3.6.1-0ubuntu6) saucy; urgency=low |
13 | |
14 | * No-change rebuild against latest gnome-desktop3 |
15 | |
16 | === added file 'debian/patches/32_input_sources_switcher.patch' |
17 | --- debian/patches/32_input_sources_switcher.patch 1970-01-01 00:00:00 +0000 |
18 | +++ debian/patches/32_input_sources_switcher.patch 2013-10-29 22:30:08 +0000 |
19 | @@ -0,0 +1,345 @@ |
20 | +--- a/src/gs-lock-plug.c |
21 | ++++ b/src/gs-lock-plug.c |
22 | +@@ -36,14 +36,17 @@ |
23 | + #include <gdk/gdkx.h> |
24 | + #include <gtk/gtk.h> |
25 | + |
26 | +-#ifdef WITH_KBD_LAYOUT_INDICATOR |
27 | +-#include <libgnomekbd/gkbd-indicator.h> |
28 | +-#endif |
29 | ++#define GNOME_DESKTOP_USE_UNSTABLE_API |
30 | ++#include <libgnome-desktop/gnome-xkb-info.h> |
31 | + |
32 | + #include "gs-lock-plug.h" |
33 | + |
34 | + #include "gs-debug.h" |
35 | + |
36 | ++#define INPUT_SOURCES_SCHEMA "org.gnome.desktop.input-sources" |
37 | ++#define SOURCES_KEY "sources" |
38 | ++#define CURRENT_KEY "current" |
39 | ++ |
40 | + #define GDM_FLEXISERVER_COMMAND "gdmflexiserver" |
41 | + #define GDM_FLEXISERVER_ARGS "--startnew Standard" |
42 | + |
43 | +@@ -83,7 +86,10 @@ |
44 | + GtkWidget *auth_switch_button; |
45 | + GtkWidget *auth_logout_button; |
46 | + |
47 | +- GtkWidget *auth_prompt_kbd_layout_indicator; |
48 | ++ GSettings *input_sources_settings; |
49 | ++ GtkWidget *input_sources_label; |
50 | ++ GPtrArray *input_sources; |
51 | ++ guint input_source; |
52 | + |
53 | + int kbd_lock_mode; |
54 | + gboolean switch_enabled; |
55 | +@@ -1446,6 +1452,135 @@ |
56 | + g_free (name); |
57 | + } |
58 | + |
59 | ++struct InputSource |
60 | ++{ |
61 | ++ gchar *name; |
62 | ++ gboolean unique; |
63 | ++ guint subscript; |
64 | ++ guint index; |
65 | ++}; |
66 | ++ |
67 | ++typedef struct InputSource InputSource; |
68 | ++ |
69 | ++static void |
70 | ++input_source_free (gpointer data) |
71 | ++{ |
72 | ++ InputSource *input_source = data; |
73 | ++ g_free (input_source->name); |
74 | ++ g_free (data); |
75 | ++} |
76 | ++ |
77 | ++static void |
78 | ++input_sources_current_changed_cb (GSettings *settings, |
79 | ++ gchar *key, |
80 | ++ gpointer user_data) |
81 | ++{ |
82 | ++ GSLockPlug *plug = GS_LOCK_PLUG (user_data); |
83 | ++ guint current = g_settings_get_uint (settings, CURRENT_KEY); |
84 | ++ guint i; |
85 | ++ |
86 | ++ for (i = 0; i < plug->priv->input_sources->len; i++) { |
87 | ++ InputSource *input_source = g_ptr_array_index (plug->priv->input_sources, i); |
88 | ++ |
89 | ++ if (input_source->index == current) { |
90 | ++ if (!input_source->unique) { |
91 | ++ gchar *markup = g_markup_printf_escaped ("%s<sub><small>%u</small></sub>", input_source->name, input_source->subscript); |
92 | ++ gtk_label_set_markup (GTK_LABEL (plug->priv->input_sources_label), markup); |
93 | ++ g_free (markup); |
94 | ++ } else { |
95 | ++ gtk_label_set_text (GTK_LABEL (plug->priv->input_sources_label), input_source->name); |
96 | ++ } |
97 | ++ |
98 | ++ break; |
99 | ++ } |
100 | ++ } |
101 | ++} |
102 | ++ |
103 | ++static void |
104 | ++gs_lock_plug_init_input_sources (GSLockPlug *plug) |
105 | ++{ |
106 | ++ GnomeXkbInfo *xkb_info; |
107 | ++ GVariant *sources; |
108 | ++ GVariantIter iter; |
109 | ++ const gchar *type; |
110 | ++ const gchar *name; |
111 | ++ guint current; |
112 | ++ guint i; |
113 | ++ |
114 | ++ if (plug->priv->input_sources != NULL) |
115 | ++ return; |
116 | ++ |
117 | ++ plug->priv->input_sources_settings = g_settings_new (INPUT_SOURCES_SCHEMA); |
118 | ++ sources = g_settings_get_value (plug->priv->input_sources_settings, SOURCES_KEY); |
119 | ++ current = g_settings_get_uint (plug->priv->input_sources_settings, CURRENT_KEY); |
120 | ++ |
121 | ++ plug->priv->input_sources = g_ptr_array_new_full (g_variant_n_children (sources), input_source_free); |
122 | ++ plug->priv->input_source = 0; |
123 | ++ |
124 | ++ xkb_info = gnome_xkb_info_new (); |
125 | ++ |
126 | ++ g_variant_iter_init (&iter, sources); |
127 | ++ for (i = 0; g_variant_iter_next (&iter, "(&s&s)", &type, &name); i++) { |
128 | ++ if (g_strcmp0 (type, "xkb") == 0) { |
129 | ++ InputSource *input_source; |
130 | ++ const gchar *short_name; |
131 | ++ gint j; |
132 | ++ |
133 | ++ gnome_xkb_info_get_layout_info (xkb_info, name, NULL, &short_name, NULL, NULL); |
134 | ++ |
135 | ++ input_source = g_new0 (InputSource, 1); |
136 | ++ input_source->name = g_strdup (short_name); |
137 | ++ input_source->unique = TRUE; |
138 | ++ input_source->subscript = 1; |
139 | ++ input_source->index = i; |
140 | ++ |
141 | ++ if (g_strcmp0 (g_getenv ("XDG_CURRENT_DESKTOP"), "Unity") == 0) |
142 | ++ input_source->name[0] = g_ascii_toupper (input_source->name[0]); |
143 | ++ |
144 | ++ for (j = plug->priv->input_sources->len - 1; j >= 0; j--) { |
145 | ++ InputSource *input_source_j = g_ptr_array_index (plug->priv->input_sources, j); |
146 | ++ |
147 | ++ if (g_strcmp0 (input_source_j->name, input_source->name) == 0) { |
148 | ++ input_source_j->unique = FALSE; |
149 | ++ input_source->unique = FALSE; |
150 | ++ input_source->subscript = input_source_j->subscript + 1; |
151 | ++ break; |
152 | ++ } |
153 | ++ } |
154 | ++ |
155 | ++ if (input_source->index == current) |
156 | ++ plug->priv->input_source = plug->priv->input_sources->len; |
157 | ++ |
158 | ++ g_ptr_array_add (plug->priv->input_sources, input_source); |
159 | ++ } |
160 | ++ } |
161 | ++ |
162 | ++ g_object_unref (xkb_info); |
163 | ++ g_variant_unref (sources); |
164 | ++ |
165 | ++ g_signal_connect (plug->priv->input_sources_settings, |
166 | ++ "changed::" CURRENT_KEY, |
167 | ++ G_CALLBACK (input_sources_current_changed_cb), |
168 | ++ plug); |
169 | ++} |
170 | ++ |
171 | ++static gboolean |
172 | ++layout_indicator_clicked_cb (GtkWidget *widget, |
173 | ++ GdkEvent *event, |
174 | ++ gpointer user_data) |
175 | ++{ |
176 | ++ GSLockPlug *plug; |
177 | ++ InputSource *input_source; |
178 | ++ |
179 | ++ plug = GS_LOCK_PLUG (user_data); |
180 | ++ plug->priv->input_source++; |
181 | ++ plug->priv->input_source %= plug->priv->input_sources->len; |
182 | ++ input_source = g_ptr_array_index (plug->priv->input_sources, plug->priv->input_source); |
183 | ++ g_settings_set_uint (plug->priv->input_sources_settings, CURRENT_KEY, input_source->index); |
184 | ++ |
185 | ++ return TRUE; |
186 | ++} |
187 | ++ |
188 | + static void |
189 | + create_page_one (GSLockPlug *plug) |
190 | + { |
191 | +@@ -1453,6 +1588,7 @@ |
192 | + GtkWidget *vbox; |
193 | + GtkWidget *vbox2; |
194 | + GtkWidget *hbox; |
195 | ++ GtkWidget *hbox2; |
196 | + |
197 | + gs_profile_start ("page one"); |
198 | + |
199 | +@@ -1473,10 +1609,6 @@ |
200 | + gtk_box_pack_start (GTK_BOX (hbox), vbox2, TRUE, TRUE, 0); |
201 | + gtk_container_set_border_width (GTK_CONTAINER (vbox2), 10); |
202 | + |
203 | +-#ifdef WITH_KBD_LAYOUT_INDICATOR |
204 | +- gtk_box_pack_start (GTK_BOX (hbox), plug->priv->auth_prompt_kbd_layout_indicator, FALSE, FALSE, 0); |
205 | +-#endif |
206 | +- |
207 | + /* Change appearance if we're running under Unity */ |
208 | + if (g_getenv ("XDG_CURRENT_DESKTOP") && |
209 | + strcmp (g_getenv ("XDG_CURRENT_DESKTOP"), "Unity") == 0) { |
210 | +@@ -1491,11 +1623,38 @@ |
211 | + gtk_misc_set_alignment (GTK_MISC (plug->priv->auth_prompt_label), 0, 0); |
212 | + gtk_box_pack_start (GTK_BOX (vbox2), plug->priv->auth_prompt_label, FALSE, FALSE, 0); |
213 | + |
214 | ++ hbox2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); |
215 | + plug->priv->auth_prompt_entry = gtk_entry_new (); |
216 | +- gtk_box_pack_start (GTK_BOX (vbox2), plug->priv->auth_prompt_entry, TRUE, TRUE, 6); |
217 | + |
218 | + gtk_label_set_mnemonic_widget (GTK_LABEL (plug->priv->auth_prompt_label), |
219 | + plug->priv->auth_prompt_entry); |
220 | ++ gtk_box_pack_start (GTK_BOX (hbox2), plug->priv->auth_prompt_entry, TRUE, TRUE, 6); |
221 | ++ |
222 | ++ /* Layout indicator */ |
223 | ++#ifdef WITH_KBD_LAYOUT_INDICATOR |
224 | ++ gs_lock_plug_init_input_sources (plug); |
225 | ++ |
226 | ++ if (plug->priv->input_sources->len > 1) { |
227 | ++ GtkWidget *layout_indicator; |
228 | ++ |
229 | ++ layout_indicator = gtk_event_box_new (); |
230 | ++ plug->priv->input_sources_label = gtk_label_new (NULL); |
231 | ++ input_sources_current_changed_cb (plug->priv->input_sources_settings, CURRENT_KEY, plug); |
232 | ++ g_signal_connect (layout_indicator, "button-release-event", G_CALLBACK (layout_indicator_clicked_cb), plug); |
233 | ++ gtk_widget_set_size_request (layout_indicator, 50, 40); |
234 | ++ |
235 | ++ gtk_container_add (GTK_CONTAINER (layout_indicator), plug->priv->input_sources_label); |
236 | ++ gtk_box_pack_start (GTK_BOX (hbox2), |
237 | ++ layout_indicator, |
238 | ++ FALSE, |
239 | ++ FALSE, |
240 | ++ 6); |
241 | ++ |
242 | ++ gtk_widget_show_all (hbox2); |
243 | ++ } |
244 | ++#endif |
245 | ++ |
246 | ++ gtk_box_pack_start (GTK_BOX (vbox2), hbox2, TRUE, TRUE, 6); |
247 | + |
248 | + plug->priv->auth_capslock_label = gtk_label_new (""); |
249 | + gtk_misc_set_alignment (GTK_MISC (plug->priv->auth_capslock_label), 0, 0.5); |
250 | +@@ -1514,11 +1673,38 @@ |
251 | + gtk_misc_set_alignment (GTK_MISC (plug->priv->auth_prompt_label), 0, 0.5); |
252 | + gtk_box_pack_start (GTK_BOX (vbox2), plug->priv->auth_prompt_label, FALSE, FALSE, 0); |
253 | + |
254 | ++ hbox2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); |
255 | + plug->priv->auth_prompt_entry = gtk_entry_new (); |
256 | +- gtk_box_pack_start (GTK_BOX (vbox2), plug->priv->auth_prompt_entry, TRUE, TRUE, 0); |
257 | + |
258 | + gtk_label_set_mnemonic_widget (GTK_LABEL (plug->priv->auth_prompt_label), |
259 | + plug->priv->auth_prompt_entry); |
260 | ++ gtk_box_pack_start (GTK_BOX (hbox2), plug->priv->auth_prompt_entry, TRUE, TRUE, 6); |
261 | ++ |
262 | ++ /* Layout indicator */ |
263 | ++#ifdef WITH_KBD_LAYOUT_INDICATOR |
264 | ++ gs_lock_plug_init_input_sources (plug); |
265 | ++ |
266 | ++ if (plug->priv->input_sources->len > 1) { |
267 | ++ GtkWidget *layout_indicator; |
268 | ++ |
269 | ++ layout_indicator = gtk_event_box_new (); |
270 | ++ plug->priv->input_sources_label = gtk_label_new (NULL); |
271 | ++ input_sources_current_changed_cb (plug->priv->input_sources_settings, CURRENT_KEY, plug); |
272 | ++ g_signal_connect (layout_indicator, "button-release-event", G_CALLBACK (layout_indicator_clicked_cb), plug); |
273 | ++ gtk_widget_set_size_request (layout_indicator, 50, 40); |
274 | ++ |
275 | ++ gtk_container_add (GTK_CONTAINER (layout_indicator), plug->priv->input_sources_label); |
276 | ++ gtk_box_pack_start (GTK_BOX (hbox2), |
277 | ++ layout_indicator, |
278 | ++ FALSE, |
279 | ++ FALSE, |
280 | ++ 6); |
281 | ++ |
282 | ++ gtk_widget_show_all (hbox2); |
283 | ++ } |
284 | ++#endif |
285 | ++ |
286 | ++ gtk_box_pack_start (GTK_BOX (vbox2), hbox2, TRUE, TRUE, 0); |
287 | + |
288 | + plug->priv->auth_capslock_label = gtk_label_new (""); |
289 | + gtk_misc_set_alignment (GTK_MISC (plug->priv->auth_capslock_label), 0.5, 0.5); |
290 | +@@ -1595,8 +1781,6 @@ |
291 | + plug->priv->vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); |
292 | + gtk_container_add (GTK_CONTAINER (plug->priv->frame), plug->priv->vbox); |
293 | + |
294 | +- plug->priv->auth_prompt_kbd_layout_indicator = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); |
295 | +- |
296 | + /* Notebook */ |
297 | + plug->priv->notebook = gtk_notebook_new (); |
298 | + gtk_notebook_set_show_tabs (GTK_NOTEBOOK (plug->priv->notebook), FALSE); |
299 | +@@ -1609,33 +1793,6 @@ |
300 | + |
301 | + gtk_widget_show_all (plug->priv->frame); |
302 | + |
303 | +- /* Layout indicator */ |
304 | +-#ifdef WITH_KBD_LAYOUT_INDICATOR |
305 | +- if (plug->priv->auth_prompt_kbd_layout_indicator != NULL) { |
306 | +- XklEngine *engine; |
307 | +- |
308 | +- engine = xkl_engine_get_instance (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ())); |
309 | +- if (xkl_engine_get_num_groups (engine) > 1) { |
310 | +- GtkWidget *layout_indicator; |
311 | +- |
312 | +- layout_indicator = gkbd_indicator_new (); |
313 | +- gkbd_indicator_set_parent_tooltips (GKBD_INDICATOR (layout_indicator), TRUE); |
314 | +- gtk_box_pack_start (GTK_BOX (plug->priv->auth_prompt_kbd_layout_indicator), |
315 | +- layout_indicator, |
316 | +- FALSE, |
317 | +- FALSE, |
318 | +- 6); |
319 | +- |
320 | +- gtk_widget_show_all (layout_indicator); |
321 | +- gtk_widget_show (plug->priv->auth_prompt_kbd_layout_indicator); |
322 | +- } else { |
323 | +- gtk_widget_hide (plug->priv->auth_prompt_kbd_layout_indicator); |
324 | +- } |
325 | +- |
326 | +- g_object_unref (engine); |
327 | +- } |
328 | +-#endif |
329 | +- |
330 | + if (plug->priv->auth_switch_button != NULL) { |
331 | + if (plug->priv->switch_enabled) { |
332 | + gtk_widget_show_all (plug->priv->auth_switch_button); |
333 | +@@ -1705,6 +1862,19 @@ |
334 | + |
335 | + g_return_if_fail (plug->priv != NULL); |
336 | + |
337 | ++ if (plug->priv->input_sources != NULL) |
338 | ++ g_ptr_array_unref (plug->priv->input_sources); |
339 | ++ |
340 | ++ if (plug->priv->input_sources_label != NULL) { |
341 | ++ g_signal_handlers_disconnect_by_data (plug->priv->input_sources_label, plug); |
342 | ++ g_object_unref (plug->priv->input_sources_label); |
343 | ++ } |
344 | ++ |
345 | ++ if (plug->priv->input_sources_settings != NULL) { |
346 | ++ g_signal_handlers_disconnect_by_data (plug->priv->input_sources_settings, plug); |
347 | ++ g_object_unref (plug->priv->input_sources_settings); |
348 | ++ } |
349 | ++ |
350 | + g_free (plug->priv->logout_command); |
351 | + |
352 | + remove_response_idle (plug); |
353 | +--- a/configure.ac |
354 | ++++ b/configure.ac |
355 | +@@ -66,7 +66,8 @@ |
356 | + |
357 | + PKG_CHECK_MODULES(GNOME_SCREENSAVER_DIALOG, |
358 | + gthread-2.0 |
359 | +- gtk+-3.0 >= $GTK_REQUIRED_VERSION) |
360 | ++ gtk+-3.0 >= $GTK_REQUIRED_VERSION |
361 | ++ gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION) |
362 | + AC_SUBST(GNOME_SCREENSAVER_DIALOG_CFLAGS) |
363 | + AC_SUBST(GNOME_SCREENSAVER_DIALOG_LIBS) |
364 | + |
365 | |
366 | === modified file 'debian/patches/series' |
367 | --- debian/patches/series 2013-05-01 17:59:44 +0000 |
368 | +++ debian/patches/series 2013-10-29 22:30:08 +0000 |
369 | @@ -19,3 +19,4 @@ |
370 | 29_handle_expired_creds.patch |
371 | 30_ubuntu-lock-on-suspend_gsetting.patch |
372 | 31_lock_screen_on_suspend.patch |
373 | +32_input_sources_switcher.patch |
Looks good and works fine, thanks