updated on Thu Jan 26 00:18:00 UTC 2012
[aur-mirror.git] / xfce4-session-lock-screen / lockscreen.patch
blobff505eb6ac71a51a42f5037dcc8bf680484f8b92
1 diff -r -c xfce4-session-4.8.2/panel-plugin/xfsm-logout-plugin.c xfce4-session-working/panel-plugin/xfsm-logout-plugin.c
2 *** xfce4-session-4.8.2/panel-plugin/xfsm-logout-plugin.c 2011-09-13 09:17:17.000000000 -0700
3 --- xfce4-session-working/panel-plugin/xfsm-logout-plugin.c 2011-09-30 12:46:00.519182001 -0700
4 ***************
5 *** 59,64 ****
6 --- 59,66 ----
7 XFSM_SHUTDOWN_REBOOT,
8 XFSM_SHUTDOWN_SUSPEND,
9 XFSM_SHUTDOWN_HIBERNATE,
10 + XFSM_SHUTDOWN_SWITCH_USER,
11 + XFSM_SHUTDOWN_LOCK_SCREEN,
12 } XfsmShutdownType;
15 ***************
16 *** 77,82 ****
17 --- 79,86 ----
19 static void xfsm_logout_plugin_lock_screen(GtkAction *action,
20 gpointer user_data);
21 + static void xfsm_logout_plugin_switch_user(GtkAction *action,
22 + gpointer user_data);
23 static void xfsm_logout_plugin_do_something(GtkAction *action,
24 gpointer user_data);
26 ***************
27 *** 85,95 ****
28 --- 89,101 ----
30 { "session-menu", NULL, N_("Session"), NULL, NULL, NULL },
31 { "lock-screen", "system-lock-screen", N_("Loc_k screen"), NULL, NULL, G_CALLBACK(xfsm_logout_plugin_lock_screen) },
32 + { "switch-user", "system-switch-user", N_("Switch _user"), NULL, NULL, G_CALLBACK(xfsm_logout_plugin_switch_user) },
33 { "suspend", "xfsm-suspend", N_("_Suspend"), NULL, NULL, G_CALLBACK(xfsm_logout_plugin_do_something) },
34 { "hibernate", "xfsm-hibernate", N_("_Hibernate"), NULL, NULL, G_CALLBACK(xfsm_logout_plugin_do_something) },
35 { "reboot", "xfsm-reboot", N_("_Reboot"), NULL, NULL, G_CALLBACK(xfsm_logout_plugin_do_something) },
36 { "shutdown", "system-shutdown", N_("Shut _down"), NULL, NULL, G_CALLBACK(xfsm_logout_plugin_do_something) },
37 { "logout", "system-log-out", N_("_Log out"), NULL, NULL, G_CALLBACK(xfsm_logout_plugin_do_something) },
41 static const struct
42 ***************
43 *** 136,146 ****
44 "xfsm-hibernate",
45 N_("Failed to hibernate")
49 static void
50 xfsm_logout_plugin_lock_screen(GtkAction *action,
51 ! gpointer user_data)
53 GError *error = NULL;
55 --- 142,166 ----
56 "xfsm-hibernate",
57 N_("Failed to hibernate")
59 + { /* XFSM_SHUTDOWN_SWITCH_USER */
60 + NULL,
61 + NULL,
62 + N_("Switch _User"),
63 + "system-switch-user",
64 + N_("Failed to switch user")
65 + },
66 + { /* XFSM_SHUTDOWN_LOCK_SCREEN */
67 + NULL,
68 + NULL,
69 + N_("L_ock Screen"),
70 + "xfsm-switch",
71 + N_("Failed to lock screen")
72 + },
75 static void
76 xfsm_logout_plugin_lock_screen(GtkAction *action,
77 ! gpointer user_data)
79 GError *error = NULL;
81 ***************
82 *** 151,156 ****
83 --- 171,189 ----
87 + static void
88 + xfsm_logout_plugin_switch_user(GtkAction *action,
89 + gpointer user_data)
90 + {
91 + GError *error = NULL;
93 + if (!g_spawn_command_line_async("gdmflexiserver", &error)) {
94 + xfce_dialog_show_error (NULL,
95 + error,
96 + _("gdmflexiserver could not be launched"));
97 + }
98 + }
100 static gboolean
101 xfsm_logout_plugin_do_dbus_call(XfsmLogoutPlugin *logout_plugin,
102 XfsmShutdownType type,
103 ***************
104 *** 331,336 ****
105 --- 364,371 ----
106 type = XFSM_SHUTDOWN_SUSPEND;
107 else if(!strcmp(name, "hibernate"))
108 type = XFSM_SHUTDOWN_HIBERNATE;
109 + else if(!strcmp(name, "switch-user"))
110 + type = XFSM_SHUTDOWN_SWITCH_USER;
111 else {
112 g_critical(G_STRLOC ": Invalid action \"%s\"", name);
113 return;
114 diff -r -c xfce4-session-4.8.2/panel-plugin/xfsm-logout-plugin-ui.h xfce4-session-working/panel-plugin/xfsm-logout-plugin-ui.h
115 *** xfce4-session-4.8.2/panel-plugin/xfsm-logout-plugin-ui.h 2011-09-13 09:17:44.000000000 -0700
116 --- xfce4-session-working/panel-plugin/xfsm-logout-plugin-ui.h 2011-09-30 15:47:40.505398430 -0700
117 ***************
118 *** 9,18 ****
119 #endif
121 "<ui><menubar name=\"main-menubar\"><menu action=\"session-menu\"><menui"
122 ! "tem action=\"lock-screen\"/><separator/><menuitem action=\"suspend\"/><"
123 "menuitem action=\"hibernate\"/><separator/><menuitem action=\"reboot\"/"
124 ! "><menuitem action=\"shutdown\"/><separator/><menuitem action=\"logout\""
125 ! "/></menu></menubar></ui>"
128 static const unsigned logout_plugin_ui_length = 292u;
129 --- 9,19 ----
130 #endif
132 "<ui><menubar name=\"main-menubar\"><menu action=\"session-menu\"><menui"
133 ! "tem action=\"lock-screen\"/><separator/><menuitem action=\"switch-user\""
134 ! "/><separator/><menuitem action=\"logout\""
135 ! "/><separator/><menuitem action=\"suspend\"/><separator/><"
136 "menuitem action=\"hibernate\"/><separator/><menuitem action=\"reboot\"/"
137 ! "><menuitem action=\"shutdown\"/><separator/></menu></menubar></ui>"
140 static const unsigned logout_plugin_ui_length = 292u;
141 diff -r -c xfce4-session-4.8.2/panel-plugin/xfsm-logout-plugin-ui.xml xfce4-session-working/panel-plugin/xfsm-logout-plugin-ui.xml
142 *** xfce4-session-4.8.2/panel-plugin/xfsm-logout-plugin-ui.xml 2011-09-13 09:17:17.000000000 -0700
143 --- xfce4-session-working/panel-plugin/xfsm-logout-plugin-ui.xml 2011-09-30 15:54:59.703685558 -0700
144 ***************
145 *** 2,15 ****
146 <menubar name="main-menubar">
147 <menu action="session-menu">
148 <menuitem action="lock-screen"/>
149 <separator/>
150 <menuitem action="suspend"/>
151 <menuitem action="hibernate"/>
152 - <separator/>
153 - <menuitem action="reboot"/>
154 - <menuitem action="shutdown"/>
155 - <separator/>
156 - <menuitem action="logout"/>
157 </menu>
158 </menubar>
159 </ui>
160 --- 2,14 ----
161 <menubar name="main-menubar">
162 <menu action="session-menu">
163 <menuitem action="lock-screen"/>
164 + <menuitem action="switch-user"/>
165 + <menuitem action="logout"/>
166 <separator/>
167 + <menuitem action="shutdown"/>
168 + <menuitem action="reboot"/>
169 <menuitem action="suspend"/>
170 <menuitem action="hibernate"/>
171 </menu>
172 </menubar>
173 </ui>
174 diff -r -c xfce4-session-4.8.2/xfce4-session/main.c xfce4-session-working/xfce4-session/main.c
175 *** xfce4-session-4.8.2/xfce4-session/main.c 2011-09-13 09:17:17.000000000 -0700
176 --- xfce4-session-working/xfce4-session/main.c 2011-09-30 14:05:11.179381123 -0700
177 ***************
178 *** 270,275 ****
179 --- 270,281 ----
180 gtk_main ();
182 shutdown_type = xfsm_manager_get_shutdown_type (manager);
184 + if ((shutdown_type == XFSM_SHUTDOWN_LOCK_SCREEN) || (shutdown_type == XFSM_SHUTDOWN_SWITCH_USER))
186 + return EXIT_SUCCESS;
189 g_object_unref (manager);
190 g_object_unref (channel);
192 diff -r -c xfce4-session-4.8.2/xfce4-session/shutdown.c xfce4-session-working/xfce4-session/shutdown.c
193 *** xfce4-session-4.8.2/xfce4-session/shutdown.c 2011-09-13 09:17:17.000000000 -0700
194 --- xfce4-session-working/xfce4-session/shutdown.c 2011-09-30 15:57:33.306420037 -0700
195 ***************
196 *** 162,167 ****
197 --- 162,183 ----
198 gtk_dialog_response (GTK_DIALOG (shutdown_dialog), GTK_RESPONSE_OK);
201 + static void
202 + lock_screen_button_clicked (GtkWidget *b, gint *shutdownType)
204 + *shutdownType = XFSM_SHUTDOWN_LOCK_SCREEN;
206 + gtk_dialog_response (GTK_DIALOG (shutdown_dialog), GTK_RESPONSE_OK);
209 + static void
210 + switch_user_button_clicked (GtkWidget *b, gint *shutdownType)
212 + *shutdownType = XFSM_SHUTDOWN_SWITCH_USER;
214 + gtk_dialog_response (GTK_DIALOG (shutdown_dialog), GTK_RESPONSE_OK);
219 gboolean
220 ***************
221 *** 187,192 ****
222 --- 203,210 ----
223 GtkWidget *halt_button;
224 GtkWidget *suspend_button = NULL;
225 GtkWidget *hibernate_button = NULL;
226 + GtkWidget *lock_screen_button;
227 + GtkWidget *switch_user_button;
228 GtkWidget *cancel_button;
229 GtkWidget *ok_button;
230 GdkPixbuf *icon;
231 ***************
232 *** 195,200 ****
233 --- 213,221 ----
234 gboolean prompt;
235 gboolean show_suspend;
236 gboolean show_hibernate;
238 + gboolean show_switch_user;
239 + gboolean show_lock_screen;
241 gboolean show_restart;
242 gboolean show_shutdown;
243 ***************
244 *** 243,248 ****
245 --- 264,271 ----
246 prompt = xfconf_channel_get_bool (channel, "/general/PromptOnLogout", TRUE);
247 show_suspend = xfconf_channel_get_bool (channel, "/shutdown/ShowSuspend", TRUE);
248 show_hibernate = xfconf_channel_get_bool (channel, "/shutdown/ShowHibernate", TRUE);
249 + show_lock_screen = xfconf_channel_get_bool (channel, "/general/ShowLockScreen", TRUE);
250 + show_switch_user = xfconf_channel_get_bool (channel, "/general/ShowSwitchUser", TRUE);
252 /* make the session-save settings obey the kiosk settings */
253 if (!kiosk_can_save_session)
254 ***************
255 *** 389,394 ****
256 --- 412,493 ----
257 gtk_widget_show (hbox);
258 gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
260 + /* lock screen */
261 + if (kiosk_can_shutdown && show_lock_screen)
263 + lock_screen_button = gtk_button_new ();
264 + gtk_widget_show (lock_screen_button);
265 + gtk_box_pack_start (GTK_BOX (hbox), lock_screen_button, TRUE, TRUE, 0);
267 + g_signal_connect (lock_screen_button, "clicked",
268 + G_CALLBACK (lock_screen_button_clicked), shutdownType);
270 + vbox2 = gtk_vbox_new (FALSE, BORDER);
271 + gtk_container_set_border_width (GTK_CONTAINER (vbox2), BORDER);
272 + gtk_widget_show (vbox2);
273 + gtk_container_add (GTK_CONTAINER (lock_screen_button), vbox2);
275 + icon = gtk_icon_theme_load_icon (icon_theme,
276 + "stock_lock",
277 + 32,
278 + 0,
279 + NULL);
281 + if (!icon)
282 + icon = gtk_icon_theme_load_icon (icon_theme,
283 + "xfsm-lock-screen",
284 + 32,
285 + GTK_ICON_LOOKUP_GENERIC_FALLBACK,
286 + NULL);
288 + image = gtk_image_new_from_pixbuf (icon);
289 + gtk_widget_show (image);
290 + gtk_box_pack_start (GTK_BOX (vbox2), image, FALSE, FALSE, 0);
291 + g_object_unref (icon);
293 + label = gtk_label_new (_("Lock Screen"));
294 + gtk_widget_show (label);
295 + gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, FALSE, 0);
298 + /* switch user */
299 + if (kiosk_can_shutdown && show_switch_user)
301 + switch_user_button = gtk_button_new ();
302 + gtk_widget_show (switch_user_button);
303 + gtk_box_pack_start (GTK_BOX (hbox), switch_user_button, TRUE, TRUE, 0);
305 + g_signal_connect (switch_user_button, "clicked",
306 + G_CALLBACK (switch_user_button_clicked), shutdownType);
308 + vbox2 = gtk_vbox_new (FALSE, BORDER);
309 + gtk_container_set_border_width (GTK_CONTAINER (vbox2), BORDER);
310 + gtk_widget_show (vbox2);
311 + gtk_container_add (GTK_CONTAINER (switch_user_button), vbox2);
313 + icon = gtk_icon_theme_load_icon (icon_theme,
314 + "system-switch-user",
315 + 32,
316 + 0,
317 + NULL);
319 + if (!icon)
320 + icon = gtk_icon_theme_load_icon (icon_theme,
321 + "xfsm-switch",
322 + 32,
323 + GTK_ICON_LOOKUP_GENERIC_FALLBACK,
324 + NULL);
326 + image = gtk_image_new_from_pixbuf (icon);
327 + gtk_widget_show (image);
328 + gtk_box_pack_start (GTK_BOX (vbox2), image, FALSE, FALSE, 0);
329 + g_object_unref (icon);
331 + label = gtk_label_new (_("Switch User"));
332 + gtk_widget_show (label);
333 + gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, FALSE, 0);
336 /* logout */
337 logout_button = gtk_button_new ();
338 gtk_widget_show (logout_button);
339 ***************
340 *** 423,450 ****
341 gtk_widget_show (label);
342 gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, FALSE, 0);
344 ! /* reboot */
345 ! reboot_button = gtk_button_new ();
346 ! gtk_widget_show (reboot_button);
347 ! gtk_box_pack_start (GTK_BOX (hbox), reboot_button, TRUE, TRUE, 0);
349 ! g_signal_connect (reboot_button, "clicked",
350 ! G_CALLBACK (reboot_button_clicked), shutdownType);
352 vbox2 = gtk_vbox_new (FALSE, BORDER);
353 gtk_container_set_border_width (GTK_CONTAINER (vbox2), BORDER);
354 gtk_widget_show (vbox2);
355 ! gtk_container_add (GTK_CONTAINER (reboot_button), vbox2);
357 icon = gtk_icon_theme_load_icon (icon_theme,
358 ! "system-reboot",
361 NULL);
363 if (!icon)
364 icon = gtk_icon_theme_load_icon (icon_theme,
365 ! "xfsm-reboot",
367 GTK_ICON_LOOKUP_GENERIC_FALLBACK,
368 NULL);
369 --- 522,570 ----
370 gtk_widget_show (label);
371 gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, FALSE, 0);
373 ! if (!kiosk_can_shutdown || !show_shutdown)
374 ! gtk_widget_set_sensitive (halt_button, FALSE);
376 ! if (show_suspend)
377 ! g_object_get (shutdown_helper,
378 ! "user-can-suspend", &show_suspend,
379 ! NULL);
381 ! if (show_hibernate)
382 ! g_object_get (shutdown_helper,
383 ! "user-can-hibernate", &show_hibernate,
384 ! NULL);
387 ! if (kiosk_can_shutdown && (show_suspend || show_hibernate))
389 ! hbox = gtk_hbox_new (FALSE, BORDER);
390 ! gtk_widget_show (hbox);
391 ! gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
394 ! /* halt */
395 ! halt_button = gtk_button_new ();
396 ! gtk_widget_show (halt_button);
397 ! gtk_box_pack_start (GTK_BOX (hbox), halt_button, TRUE, TRUE, 0);
399 ! g_signal_connect (halt_button, "clicked",
400 ! G_CALLBACK (halt_button_clicked), shutdownType);
402 vbox2 = gtk_vbox_new (FALSE, BORDER);
403 gtk_container_set_border_width (GTK_CONTAINER (vbox2), BORDER);
404 gtk_widget_show (vbox2);
405 ! gtk_container_add (GTK_CONTAINER (halt_button), vbox2);
407 icon = gtk_icon_theme_load_icon (icon_theme,
408 ! "system-shutdown",
411 NULL);
413 if (!icon)
414 icon = gtk_icon_theme_load_icon (icon_theme,
415 ! "xfsm-shutdown",
417 GTK_ICON_LOOKUP_GENERIC_FALLBACK,
418 NULL);
419 ***************
420 *** 454,492 ****
421 gtk_box_pack_start (GTK_BOX (vbox2), image, FALSE, FALSE, 0);
422 g_object_unref (icon);
424 ! label = gtk_label_new (_("Restart"));
425 gtk_widget_show (label);
426 gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, FALSE, 0);
428 g_object_get (shutdown_helper,
429 ! "user-can-restart", &show_restart,
430 NULL);
432 ! if (!kiosk_can_shutdown || !show_restart )
433 ! gtk_widget_set_sensitive (reboot_button, FALSE);
435 ! /* halt */
436 ! halt_button = gtk_button_new ();
437 ! gtk_widget_show (halt_button);
438 ! gtk_box_pack_start (GTK_BOX (hbox), halt_button, TRUE, TRUE, 0);
440 ! g_signal_connect (halt_button, "clicked",
441 ! G_CALLBACK (halt_button_clicked), shutdownType);
443 vbox2 = gtk_vbox_new (FALSE, BORDER);
444 gtk_container_set_border_width (GTK_CONTAINER (vbox2), BORDER);
445 gtk_widget_show (vbox2);
446 ! gtk_container_add (GTK_CONTAINER (halt_button), vbox2);
448 icon = gtk_icon_theme_load_icon (icon_theme,
449 ! "system-shutdown",
452 NULL);
454 if (!icon)
455 icon = gtk_icon_theme_load_icon (icon_theme,
456 ! "xfsm-shutdown",
458 GTK_ICON_LOOKUP_GENERIC_FALLBACK,
459 NULL);
460 --- 574,609 ----
461 gtk_box_pack_start (GTK_BOX (vbox2), image, FALSE, FALSE, 0);
462 g_object_unref (icon);
464 ! label = gtk_label_new (_("Shut Down"));
465 gtk_widget_show (label);
466 gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, FALSE, 0);
468 g_object_get (shutdown_helper,
469 ! "user-can-shutdown", &show_shutdown,
470 NULL);
472 ! /* reboot */
473 ! reboot_button = gtk_button_new ();
474 ! gtk_widget_show (reboot_button);
475 ! gtk_box_pack_start (GTK_BOX (hbox), reboot_button, TRUE, TRUE, 0);
477 ! g_signal_connect (reboot_button, "clicked",
478 ! G_CALLBACK (reboot_button_clicked), shutdownType);
480 vbox2 = gtk_vbox_new (FALSE, BORDER);
481 gtk_container_set_border_width (GTK_CONTAINER (vbox2), BORDER);
482 gtk_widget_show (vbox2);
483 ! gtk_container_add (GTK_CONTAINER (reboot_button), vbox2);
485 icon = gtk_icon_theme_load_icon (icon_theme,
486 ! "system-reboot",
489 NULL);
491 if (!icon)
492 icon = gtk_icon_theme_load_icon (icon_theme,
493 ! "xfsm-reboot",
495 GTK_ICON_LOOKUP_GENERIC_FALLBACK,
496 NULL);
497 ***************
498 *** 496,529 ****
499 gtk_box_pack_start (GTK_BOX (vbox2), image, FALSE, FALSE, 0);
500 g_object_unref (icon);
502 ! label = gtk_label_new (_("Shut Down"));
503 gtk_widget_show (label);
504 gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, FALSE, 0);
506 g_object_get (shutdown_helper,
507 ! "user-can-shutdown", &show_shutdown,
508 NULL);
510 ! if (!kiosk_can_shutdown || !show_shutdown)
511 ! gtk_widget_set_sensitive (halt_button, FALSE);
513 ! if (show_suspend)
514 ! g_object_get (shutdown_helper,
515 ! "user-can-suspend", &show_suspend,
516 ! NULL);
518 ! if (show_hibernate)
519 ! g_object_get (shutdown_helper,
520 ! "user-can-hibernate", &show_hibernate,
521 ! NULL);
524 ! if (kiosk_can_shutdown && (show_suspend || show_hibernate))
526 ! hbox = gtk_hbox_new (FALSE, BORDER);
527 ! gtk_widget_show (hbox);
528 ! gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
531 /* suspend */
532 if (kiosk_can_shutdown && show_suspend)
533 --- 613,628 ----
534 gtk_box_pack_start (GTK_BOX (vbox2), image, FALSE, FALSE, 0);
535 g_object_unref (icon);
537 ! label = gtk_label_new (_("Restart"));
538 gtk_widget_show (label);
539 gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, FALSE, 0);
541 g_object_get (shutdown_helper,
542 ! "user-can-restart", &show_restart,
543 NULL);
545 ! if (!kiosk_can_shutdown || !show_restart )
546 ! gtk_widget_set_sensitive (reboot_button, FALSE);
548 /* suspend */
549 if (kiosk_can_shutdown && show_suspend)
550 ***************
551 *** 652,661 ****
552 g_object_get (shutdown_helper,
553 "require-password", &require_password,
554 NULL);
556 ! /* ask password */
557 ! if (result == GTK_RESPONSE_OK && *shutdownType != XFSM_SHUTDOWN_LOGOUT
558 ! && require_password )
560 gtk_widget_show (ok_button);
562 --- 751,759 ----
563 g_object_get (shutdown_helper,
564 "require-password", &require_password,
565 NULL);
567 ! if ((result == GTK_RESPONSE_OK && *shutdownType != XFSM_SHUTDOWN_LOGOUT
568 ! && require_password) )
570 gtk_widget_show (ok_button);
572 ***************
573 *** 790,796 ****
575 gboolean result;
576 GError *error = NULL;
578 /* kludge */
579 if (type == XFSM_SHUTDOWN_ASK)
581 --- 888,894 ----
583 gboolean result;
584 GError *error = NULL;
586 /* kludge */
587 if (type == XFSM_SHUTDOWN_ASK)
589 diff -r -c xfce4-session-4.8.2/xfce4-session/xfsm-global.h xfce4-session-working/xfce4-session/xfsm-global.h
590 *** xfce4-session-4.8.2/xfce4-session/xfsm-global.h 2011-09-13 09:17:17.000000000 -0700
591 --- xfce4-session-working/xfce4-session/xfsm-global.h 2011-09-29 19:25:34.000000000 -0700
592 ***************
593 *** 37,42 ****
594 --- 37,44 ----
595 XFSM_SHUTDOWN_REBOOT,
596 XFSM_SHUTDOWN_SUSPEND,
597 XFSM_SHUTDOWN_HIBERNATE,
598 + XFSM_SHUTDOWN_SWITCH_USER,
599 + XFSM_SHUTDOWN_LOCK_SCREEN,
600 } XfsmShutdownType;
602 typedef struct _FailsafeClient FailsafeClient;
603 diff -r -c xfce4-session-4.8.2/xfce4-session/xfsm-manager.c xfce4-session-working/xfce4-session/xfsm-manager.c
604 *** xfce4-session-4.8.2/xfce4-session/xfsm-manager.c 2011-09-13 09:17:17.000000000 -0700
605 --- xfce4-session-working/xfce4-session/xfsm-manager.c 2011-09-30 15:33:30.778711307 -0700
606 ***************
607 *** 1101,1106 ****
608 --- 1101,1120 ----
609 if (shutdown_type != XFSM_SHUTDOWN_ASK)
610 manager->shutdown_type = shutdown_type;
612 + if (manager->shutdown_type == XFSM_SHUTDOWN_LOCK_SCREEN)
614 + g_spawn_command_line_async("xflock4", NULL);
616 + return;
619 + if (manager->shutdown_type == XFSM_SHUTDOWN_SWITCH_USER)
621 + g_spawn_command_line_async("gdmflexiserver", NULL);
623 + return;
626 /* we only save the session and quit if we're actually shutting down;
627 * suspend and hibernate will (if successful) return us to
628 * exactly the same state, so there's no need to save session */
629 diff -r -c xfce4-session-4.8.2/xfce4-session/xfsm-shutdown-helper.c xfce4-session-working/xfce4-session/xfsm-shutdown-helper.c
630 *** xfce4-session-4.8.2/xfce4-session/xfsm-shutdown-helper.c 2011-09-13 09:17:17.000000000 -0700
631 --- xfce4-session-working/xfce4-session/xfsm-shutdown-helper.c 2011-09-29 17:58:07.000000000 -0700
632 ***************
633 *** 1750,1755 ****
634 --- 1750,1790 ----
639 + /**
640 + * xfsm_lock_screen:
643 + **/
645 + static void
646 + xfsm_lock_screen (void)
648 + gboolean ret = g_spawn_command_line_async ("xflock4", NULL);
650 + if ( !ret )
652 + /* this should be the default*/
653 + ret = g_spawn_command_line_async ("xdg-screensaver lock", NULL);
656 + if ( !ret )
658 + g_spawn_command_line_async ("gnome-screensaver-command -l", NULL);
661 + if ( !ret )
663 + ret = g_spawn_command_line_async ("xscreensaver-command -lock", NULL);
666 + if ( !ret )
668 + g_critical ("Connot lock screen\n");
674 * xfsm_shutdown_helper_restart:
676 diff -r -c xfce4-session-4.8.2/xfce4-session-logout/main.c xfce4-session-working/xfce4-session-logout/main.c
677 *** xfce4-session-4.8.2/xfce4-session-logout/main.c 2011-09-13 09:17:17.000000000 -0700
678 --- xfce4-session-working/xfce4-session-logout/main.c 2011-09-29 19:23:11.000000000 -0700
679 ***************
680 *** 1,25 ****
681 - /* $Id$ */
682 - /*-
683 - * Copyright (c) 2004,2008 Brian Tarricone <kelnos@xfce.org>
684 - * Copyright (c) 2004 Benedikt Meurer <benny@xfce.org>
685 - * All rights reserved.
687 - * This program is free software; you can redistribute it and/or modify
688 - * it under the terms of the GNU General Public License as published by
689 - * the Free Software Foundation; either version 2, or (at your option)
690 - * any later version.
692 - * This program is distributed in the hope that it will be useful,
693 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
694 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
695 - * GNU General Public License for more details.
697 - * You should have received a copy of the GNU General Public License
698 - * along with this program; if not, write to the Free Software
699 - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
700 - * MA 02110-1301 USA.
701 - */
703 #ifdef HAVE_CONFIG_H
704 #include <config.h>
705 #endif
706 --- 1,3 ----
707 ***************
708 *** 42,50 ****
709 #include <libxfce4util/libxfce4util.h>
712 - /* copied from xfce4-session/shutdown.h -- ORDER MATTERS. The numbers
713 - * correspond to the 'type' parameter of org.xfce.Session.Manager.Shutdown
714 - */
715 typedef enum
717 XFSM_SHUTDOWN_ASK = 0,
718 --- 20,25 ----
719 ***************
720 *** 53,58 ****
721 --- 28,35 ----
722 XFSM_SHUTDOWN_REBOOT,
723 XFSM_SHUTDOWN_SUSPEND,
724 XFSM_SHUTDOWN_HIBERNATE,
725 + XFSM_SHUTDOWN_LOCK_SCREEN,
726 + XFSM_SHUTDOWN_SWITCH_USER,
727 } XfsmShutdownType;
729 gboolean opt_logout = FALSE;
730 ***************
731 *** 60,65 ****
732 --- 37,44 ----
733 gboolean opt_reboot = FALSE;
734 gboolean opt_suspend = FALSE;
735 gboolean opt_hibernate = FALSE;
736 + gboolean opt_lock_screen = FALSE;
737 + gboolean opt_switch_user = FALSE;
738 gboolean opt_fast = FALSE;
739 gboolean opt_version = FALSE;
741 ***************
742 *** 85,90 ****
743 --- 64,77 ----
744 N_("Hibernate without displaying the logout dialog"),
745 NULL
747 + { "lock", 'k', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &opt_lock_screen,
748 + N_("Lock the screen without displaying the logout dialog"),
749 + NULL
750 + },
751 + { "switch-user", 'w', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &opt_switch_user,
752 + N_("Switch users without displaying the logout dialog"),
753 + NULL
754 + },
755 { "fast", 'f', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &opt_fast,
756 N_("Log out quickly; don't save the session"),
757 NULL
758 ***************
759 *** 154,159 ****
760 --- 141,154 ----
762 shutdown_type = XFSM_SHUTDOWN_HIBERNATE;
764 + else if (opt_lock_screen)
766 + shutdown_type = XFSM_SHUTDOWN_LOCK_SCREEN;
768 + else if (opt_switch_user)
770 + shutdown_type = XFSM_SHUTDOWN_SWITCH_USER;
772 else if (opt_version)
774 printf ("%s (Xfce %s)\n\n"