Merge lp:~jamesodhunt/ubuntu/trusty/gnome-session/bug-1256262 into lp:ubuntu/trusty/gnome-session

Proposed by James Hunt
Status: Merged
Merge reported by: Dimitri John Ledkov
Merged at revision: not available
Proposed branch: lp:~jamesodhunt/ubuntu/trusty/gnome-session/bug-1256262
Merge into: lp:ubuntu/trusty/gnome-session
Diff against target: 809 lines (+10/-762)
5 files modified
.pc/103_kill_the_fail_whale.patch/gnome-session/gsm-fail-whale.c (+0/-47)
.pc/13_display_session_properties.patch/data/session-properties.desktop.in.in (+0/-15)
.pc/git_fix_wrong_unref_call.patch/gnome-session/gsm-shell.c (+0/-700)
debian/changelog (+7/-0)
debian/gnome-session.user-session.upstart (+3/-0)
To merge this branch: bzr merge lp:~jamesodhunt/ubuntu/trusty/gnome-session/bug-1256262
Reviewer Review Type Date Requested Status
Dimitri John Ledkov Approve
Review via email: mp+197663@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Dimitri John Ledkov (xnox) wrote :

"Merged" into lp:~ubuntu-desktop/gnome-session/ubuntu sans quilt brain-deadness =)

ANd uploaded.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== removed file '.pc/103_kill_the_fail_whale.patch/gnome-session/gsm-fail-whale.c'
--- .pc/103_kill_the_fail_whale.patch/gnome-session/gsm-fail-whale.c 2013-06-19 10:37:29 +0000
+++ .pc/103_kill_the_fail_whale.patch/gnome-session/gsm-fail-whale.c 1970-01-01 00:00:00 +0000
@@ -1,47 +0,0 @@
1/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
2 * gsm-fail-whale.c
3 * Copyright (C) 2012 Red Hat, Inc
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation; either version 2 of the
8 * License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
18 * 02111-1307, USA.
19 */
20
21#include <config.h>
22
23#include <glib/gi18n.h>
24#include <glib/gstdio.h>
25
26#include "gsm-fail-whale.h"
27
28void
29gsm_fail_whale_dialog_we_failed (gboolean debug_mode,
30 gboolean allow_logout,
31 GsmShellExtensions *extensions)
32{
33 gint i;
34 gchar *argv[5];
35
36 i = 0;
37 argv[i++] = LIBEXECDIR "/gnome-session-failed";
38 if (debug_mode)
39 argv[i++] = "--debug";
40 if (allow_logout)
41 argv[i++] = "--allow-logout";
42 if (extensions != NULL && gsm_shell_extensions_n_extensions (extensions) > 0)
43 argv[i++] = "--extensions";
44 argv[i++] = NULL;
45
46 g_spawn_async (NULL, argv, NULL, 0, NULL, NULL, NULL, NULL);
47}
480
=== removed directory '.pc/13_display_session_properties.patch'
=== removed directory '.pc/13_display_session_properties.patch/data'
=== removed file '.pc/13_display_session_properties.patch/data/session-properties.desktop.in.in'
--- .pc/13_display_session_properties.patch/data/session-properties.desktop.in.in 2012-09-05 00:53:57 +0000
+++ .pc/13_display_session_properties.patch/data/session-properties.desktop.in.in 1970-01-01 00:00:00 +0000
@@ -1,15 +0,0 @@
1[Desktop Entry]
2_Name=Startup Applications
3_Comment=Choose what applications to start when you log in
4Exec=gnome-session-properties
5Icon=session-properties
6Terminal=false
7Type=Application
8StartupNotify=true
9Categories=GTK;GNOME;Settings;X-GNOME-PersonalSettings;
10OnlyShowIn=GNOME;Unity;
11NoDisplay=true
12X-GNOME-Bugzilla-Bugzilla=GNOME
13X-GNOME-Bugzilla-Product=gnome-session
14X-GNOME-Bugzilla-Component=gnome-session-properties
15X-GNOME-Bugzilla-Version=@VERSION@
160
=== removed directory '.pc/git_fix_wrong_unref_call.patch'
=== removed directory '.pc/git_fix_wrong_unref_call.patch/gnome-session'
=== removed file '.pc/git_fix_wrong_unref_call.patch/gnome-session/gsm-shell.c'
--- .pc/git_fix_wrong_unref_call.patch/gnome-session/gsm-shell.c 2013-10-11 15:45:25 +0000
+++ .pc/git_fix_wrong_unref_call.patch/gnome-session/gsm-shell.c 1970-01-01 00:00:00 +0000
@@ -1,700 +0,0 @@
1/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
2 *
3 * Copyright (C) 2010 Red Hat, Inc
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
8 * any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
18 * 02111-1307, USA.
19 */
20
21#include "config.h"
22
23#include <errno.h>
24#include <string.h>
25#include <unistd.h>
26
27#include <glib.h>
28#include <glib-object.h>
29#include <glib/gi18n.h>
30
31#include <dbus/dbus-glib.h>
32#include <dbus/dbus-glib-lowlevel.h>
33
34#include "gsm-inhibitor.h"
35#include "gsm-shell.h"
36
37#define SHELL_NAME "org.gnome.Shell"
38#define SHELL_PATH "/org/gnome/Shell"
39#define SHELL_INTERFACE "org.gnome.Shell"
40
41#define SHELL_END_SESSION_DIALOG_PATH "/org/gnome/SessionManager/EndSessionDialog"
42#define SHELL_END_SESSION_DIALOG_INTERFACE "org.gnome.SessionManager.EndSessionDialog"
43
44#define GSM_SHELL_DBUS_TYPE_G_OBJECT_PATH_ARRAY (dbus_g_type_get_collection ("GPtrArray", DBUS_TYPE_G_OBJECT_PATH))
45
46#define AUTOMATIC_ACTION_TIMEOUT 60
47
48#define GSM_SHELL_GET_PRIVATE(o) \
49 (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSM_TYPE_SHELL, GsmShellPrivate))
50
51struct _GsmShellPrivate
52{
53 DBusGConnection *bus_connection;
54 DBusGProxy *bus_proxy;
55 DBusGProxy *proxy;
56 DBusGProxy *end_session_dialog_proxy;
57 GsmStore *inhibitors;
58
59 guint32 is_running : 1;
60
61 DBusGProxyCall *end_session_open_call;
62 GsmShellEndSessionDialogType end_session_dialog_type;
63
64 guint update_idle_id;
65};
66
67enum {
68 PROP_0,
69 PROP_IS_RUNNING
70};
71
72enum {
73 END_SESSION_DIALOG_OPENED = 0,
74 END_SESSION_DIALOG_OPEN_FAILED,
75 END_SESSION_DIALOG_CLOSED,
76 END_SESSION_DIALOG_CANCELED,
77 END_SESSION_DIALOG_CONFIRMED_LOGOUT,
78 END_SESSION_DIALOG_CONFIRMED_SHUTDOWN,
79 END_SESSION_DIALOG_CONFIRMED_REBOOT,
80 NUMBER_OF_SIGNALS
81};
82
83static guint signals[NUMBER_OF_SIGNALS] = { 0 };
84
85static void gsm_shell_class_init (GsmShellClass *klass);
86static void gsm_shell_init (GsmShell *ck);
87static void gsm_shell_finalize (GObject *object);
88
89static void gsm_shell_disconnect_from_bus (GsmShell *shell);
90
91static DBusHandlerResult gsm_shell_bus_filter (DBusConnection *connection,
92 DBusMessage *message,
93 void *user_data);
94
95static void gsm_shell_on_name_owner_changed (DBusGProxy *bus_proxy,
96 const char *name,
97 const char *prev_owner,
98 const char *new_owner,
99 GsmShell *shell);
100static void queue_end_session_dialog_update (GsmShell *shell);
101
102G_DEFINE_TYPE (GsmShell, gsm_shell, G_TYPE_OBJECT);
103
104static void
105gsm_shell_get_property (GObject *object,
106 guint prop_id,
107 GValue *value,
108 GParamSpec *pspec)
109{
110 GsmShell *shell = GSM_SHELL (object);
111
112 switch (prop_id) {
113 case PROP_IS_RUNNING:
114 g_value_set_boolean (value,
115 shell->priv->is_running);
116 break;
117
118 default:
119 G_OBJECT_WARN_INVALID_PROPERTY_ID (object,
120 prop_id,
121 pspec);
122 }
123}
124
125static void
126gsm_shell_class_init (GsmShellClass *shell_class)
127{
128 GObjectClass *object_class;
129 GParamSpec *param_spec;
130
131 object_class = G_OBJECT_CLASS (shell_class);
132
133 object_class->finalize = gsm_shell_finalize;
134 object_class->get_property = gsm_shell_get_property;
135
136 param_spec = g_param_spec_boolean ("is-running",
137 "Is running",
138 "Whether GNOME Shell is running in the session",
139 FALSE,
140 G_PARAM_READABLE);
141
142 g_object_class_install_property (object_class, PROP_IS_RUNNING,
143 param_spec);
144
145 signals [END_SESSION_DIALOG_OPENED] =
146 g_signal_new ("end-session-dialog-opened",
147 G_OBJECT_CLASS_TYPE (object_class),
148 G_SIGNAL_RUN_LAST,
149 G_STRUCT_OFFSET (GsmShellClass, end_session_dialog_opened),
150 NULL, NULL, NULL,
151 G_TYPE_NONE, 0);
152
153 signals [END_SESSION_DIALOG_OPEN_FAILED] =
154 g_signal_new ("end-session-dialog-open-failed",
155 G_OBJECT_CLASS_TYPE (object_class),
156 G_SIGNAL_RUN_LAST,
157 G_STRUCT_OFFSET (GsmShellClass, end_session_dialog_open_failed),
158 NULL, NULL, NULL,
159 G_TYPE_NONE, 0);
160
161 signals [END_SESSION_DIALOG_CLOSED] =
162 g_signal_new ("end-session-dialog-closed",
163 G_OBJECT_CLASS_TYPE (object_class),
164 G_SIGNAL_RUN_LAST,
165 G_STRUCT_OFFSET (GsmShellClass, end_session_dialog_closed),
166 NULL, NULL, NULL,
167 G_TYPE_NONE, 0);
168
169 signals [END_SESSION_DIALOG_CANCELED] =
170 g_signal_new ("end-session-dialog-canceled",
171 G_OBJECT_CLASS_TYPE (object_class),
172 G_SIGNAL_RUN_LAST,
173 G_STRUCT_OFFSET (GsmShellClass, end_session_dialog_canceled),
174 NULL, NULL, NULL,
175 G_TYPE_NONE, 0);
176
177 signals [END_SESSION_DIALOG_CONFIRMED_LOGOUT] =
178 g_signal_new ("end-session-dialog-confirmed-logout",
179 G_OBJECT_CLASS_TYPE (object_class),
180 G_SIGNAL_RUN_LAST,
181 G_STRUCT_OFFSET (GsmShellClass, end_session_dialog_confirmed_logout),
182 NULL, NULL, NULL,
183 G_TYPE_NONE, 0);
184
185 signals [END_SESSION_DIALOG_CONFIRMED_SHUTDOWN] =
186 g_signal_new ("end-session-dialog-confirmed-shutdown",
187 G_OBJECT_CLASS_TYPE (object_class),
188 G_SIGNAL_RUN_LAST,
189 G_STRUCT_OFFSET (GsmShellClass, end_session_dialog_confirmed_shutdown),
190 NULL, NULL, NULL,
191 G_TYPE_NONE, 0);
192
193 signals [END_SESSION_DIALOG_CONFIRMED_REBOOT] =
194 g_signal_new ("end-session-dialog-confirmed-reboot",
195 G_OBJECT_CLASS_TYPE (object_class),
196 G_SIGNAL_RUN_LAST,
197 G_STRUCT_OFFSET (GsmShellClass, end_session_dialog_confirmed_reboot),
198 NULL, NULL, NULL,
199 G_TYPE_NONE, 0);
200
201 g_type_class_add_private (shell_class, sizeof (GsmShellPrivate));
202}
203
204static DBusHandlerResult
205gsm_shell_bus_filter (DBusConnection *connection,
206 DBusMessage *message,
207 void *user_data)
208{
209 GsmShell *shell;
210
211 shell = GSM_SHELL (user_data);
212
213 if (dbus_message_is_signal (message,
214 DBUS_INTERFACE_LOCAL, "Disconnected") &&
215 strcmp (dbus_message_get_path (message), DBUS_PATH_LOCAL) == 0) {
216 gsm_shell_disconnect_from_bus (shell);
217 /* let other filters get this disconnected signal, so that they
218 * can handle it too */
219 }
220
221 return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
222}
223
224static gboolean
225gsm_shell_ensure_connection (GsmShell *shell,
226 GError **error)
227{
228 GError *connection_error;
229 gboolean is_running;
230
231 connection_error = NULL;
232
233 if (shell->priv->bus_connection == NULL) {
234 DBusConnection *connection;
235
236 shell->priv->bus_connection = dbus_g_bus_get (DBUS_BUS_SESSION,
237 &connection_error);
238
239 if (shell->priv->bus_connection == NULL) {
240 g_propagate_error (error, connection_error);
241 is_running = FALSE;
242 goto out;
243 }
244
245 connection = dbus_g_connection_get_connection (shell->priv->bus_connection);
246 dbus_connection_set_exit_on_disconnect (connection, FALSE);
247 dbus_connection_add_filter (connection,
248 gsm_shell_bus_filter,
249 shell, NULL);
250 }
251
252 if (shell->priv->bus_proxy == NULL) {
253 shell->priv->bus_proxy =
254 dbus_g_proxy_new_for_name_owner (shell->priv->bus_connection,
255 DBUS_SERVICE_DBUS,
256 DBUS_PATH_DBUS,
257 DBUS_INTERFACE_DBUS,
258 &connection_error);
259
260 if (shell->priv->bus_proxy == NULL) {
261 g_propagate_error (error, connection_error);
262 is_running = FALSE;
263 goto out;
264 }
265
266 dbus_g_proxy_add_signal (shell->priv->bus_proxy,
267 "NameOwnerChanged",
268 G_TYPE_STRING,
269 G_TYPE_STRING,
270 G_TYPE_STRING,
271 G_TYPE_INVALID);
272
273 dbus_g_proxy_connect_signal (shell->priv->bus_proxy,
274 "NameOwnerChanged",
275 G_CALLBACK (gsm_shell_on_name_owner_changed),
276 shell, NULL);
277 }
278
279 if (shell->priv->proxy == NULL) {
280 shell->priv->proxy =
281 dbus_g_proxy_new_for_name_owner (shell->priv->bus_connection,
282 SHELL_NAME,
283 SHELL_PATH,
284 SHELL_INTERFACE,
285 &connection_error);
286
287 if (shell->priv->proxy == NULL) {
288 g_propagate_error (error, connection_error);
289 is_running = FALSE;
290 goto out;
291 }
292 }
293
294 g_debug ("GsmShell: Connected to the shell");
295
296 is_running = TRUE;
297
298 out:
299 if (shell->priv->is_running != is_running) {
300 shell->priv->is_running = is_running;
301 g_object_notify (G_OBJECT (shell), "is-running");
302 }
303
304 if (!is_running) {
305 g_debug ("GsmShell: Not connected to the shell");
306
307 if (shell->priv->bus_connection == NULL) {
308 g_clear_object (&shell->priv->bus_proxy);
309 g_clear_object (&shell->priv->proxy);
310 } else if (shell->priv->bus_proxy == NULL) {
311 g_clear_object (&shell->priv->proxy);
312 }
313 }
314
315 return is_running;
316}
317
318static void
319gsm_shell_on_name_owner_changed (DBusGProxy *bus_proxy,
320 const char *name,
321 const char *prev_owner,
322 const char *new_owner,
323 GsmShell *shell)
324{
325 if (name != NULL && strcmp (name, SHELL_NAME) != 0) {
326 return;
327 }
328
329 g_clear_object (&shell->priv->proxy);
330
331 gsm_shell_ensure_connection (shell, NULL);
332}
333
334static void
335gsm_shell_init (GsmShell *shell)
336{
337 shell->priv = GSM_SHELL_GET_PRIVATE (shell);
338
339 gsm_shell_ensure_connection (shell, NULL);
340}
341
342static void
343gsm_shell_disconnect_from_bus (GsmShell *shell)
344{
345 g_clear_object (&shell->priv->bus_proxy);
346 g_clear_object (&shell->priv->proxy);
347
348 if (shell->priv->bus_connection != NULL) {
349 DBusConnection *connection;
350 connection = dbus_g_connection_get_connection (shell->priv->bus_connection);
351 dbus_connection_remove_filter (connection,
352 gsm_shell_bus_filter,
353 shell);
354
355 dbus_g_connection_unref (shell->priv->bus_connection);
356 shell->priv->bus_connection = NULL;
357 }
358}
359
360static void
361gsm_shell_finalize (GObject *object)
362{
363 GsmShell *shell;
364 GObjectClass *parent_class;
365
366 shell = GSM_SHELL (object);
367
368 parent_class = G_OBJECT_CLASS (gsm_shell_parent_class);
369
370 g_object_unref (shell->priv->inhibitors);
371
372 gsm_shell_disconnect_from_bus (shell);
373
374 if (parent_class->finalize != NULL) {
375 parent_class->finalize (object);
376 }
377}
378
379GsmShell *
380gsm_shell_new (void)
381{
382 GsmShell *shell;
383
384 shell = g_object_new (GSM_TYPE_SHELL, NULL);
385
386 return shell;
387}
388
389GsmShell *
390gsm_get_shell (void)
391{
392 static GsmShell *shell = NULL;
393
394 if (shell == NULL) {
395 shell = gsm_shell_new ();
396 }
397
398 return g_object_ref (shell);
399}
400
401gboolean
402gsm_shell_is_running (GsmShell *shell)
403{
404 gsm_shell_ensure_connection (shell, NULL);
405
406 return shell->priv->is_running;
407}
408
409static gboolean
410add_inhibitor_to_array (const char *id,
411 GsmInhibitor *inhibitor,
412 GPtrArray *array)
413{
414
415 g_ptr_array_add (array,
416 g_strdup (gsm_inhibitor_peek_id (inhibitor)));
417 return FALSE;
418}
419
420static GPtrArray *
421get_array_from_store (GsmStore *inhibitors)
422{
423 GPtrArray *array;
424
425 array = g_ptr_array_new ();
426
427 gsm_store_foreach (inhibitors,
428 (GsmStoreFunc) add_inhibitor_to_array,
429 array);
430
431 return array;
432}
433
434static void
435on_open_finished (DBusGProxy *proxy,
436 DBusGProxyCall *call,
437 GsmShell *shell)
438{
439 GError *error;
440 gboolean res;
441
442 g_assert (shell->priv->end_session_open_call == call);
443
444 error = NULL;
445 res = dbus_g_proxy_end_call (proxy,
446 call,
447 &error,
448 G_TYPE_INVALID);
449 shell->priv->end_session_open_call = NULL;
450
451 if (shell->priv->update_idle_id != 0) {
452 g_source_remove (shell->priv->update_idle_id);
453 shell->priv->update_idle_id = 0;
454 }
455
456 if (!res) {
457 g_warning ("Unable to open shell end session dialog");
458 g_signal_emit (G_OBJECT (shell), signals[END_SESSION_DIALOG_OPEN_FAILED], 0);
459 return;
460 }
461
462 g_signal_emit (G_OBJECT (shell), signals[END_SESSION_DIALOG_OPENED], 0);
463}
464
465static void
466on_end_session_dialog_closed (DBusGProxy *proxy,
467 GsmShell *shell)
468{
469 if (shell->priv->update_idle_id != 0) {
470 g_source_remove (shell->priv->update_idle_id);
471 shell->priv->update_idle_id = 0;
472 }
473
474 g_signal_handlers_disconnect_by_func (shell->priv->inhibitors,
475 G_CALLBACK (queue_end_session_dialog_update),
476 shell);
477
478 g_signal_emit (G_OBJECT (shell), signals[END_SESSION_DIALOG_CLOSED], 0);
479}
480
481static void
482on_end_session_dialog_canceled (DBusGProxy *proxy,
483 GsmShell *shell)
484{
485 if (shell->priv->update_idle_id != 0) {
486 g_source_remove (shell->priv->update_idle_id);
487 shell->priv->update_idle_id = 0;
488 }
489
490 g_signal_handlers_disconnect_by_func (shell->priv->inhibitors,
491 G_CALLBACK (queue_end_session_dialog_update),
492 shell);
493
494 g_signal_emit (G_OBJECT (shell), signals[END_SESSION_DIALOG_CANCELED], 0);
495}
496
497static void
498on_end_session_dialog_confirmed_logout (DBusGProxy *proxy,
499 GsmShell *shell)
500{
501 if (shell->priv->update_idle_id != 0) {
502 g_source_remove (shell->priv->update_idle_id);
503 shell->priv->update_idle_id = 0;
504 }
505
506 g_signal_emit (G_OBJECT (shell), signals[END_SESSION_DIALOG_CONFIRMED_LOGOUT], 0);
507}
508
509static void
510on_end_session_dialog_confirmed_shutdown (DBusGProxy *proxy,
511 GsmShell *shell)
512{
513 if (shell->priv->update_idle_id != 0) {
514 g_source_remove (shell->priv->update_idle_id);
515 shell->priv->update_idle_id = 0;
516 }
517
518 g_signal_emit (G_OBJECT (shell), signals[END_SESSION_DIALOG_CONFIRMED_SHUTDOWN], 0);
519}
520
521static void
522on_end_session_dialog_confirmed_reboot (DBusGProxy *proxy,
523 GsmShell *shell)
524{
525 if (shell->priv->update_idle_id != 0) {
526 g_source_remove (shell->priv->update_idle_id);
527 shell->priv->update_idle_id = 0;
528 }
529
530 g_signal_emit (G_OBJECT (shell), signals[END_SESSION_DIALOG_CONFIRMED_REBOOT], 0);
531}
532
533static void
534on_end_session_dialog_proxy_destroyed (DBusGProxy *proxy,
535 GsmShell *shell)
536{
537 /* FIXME - is this right? */
538 if (shell->priv->end_session_dialog_proxy != NULL) {
539 g_object_unref (shell->priv->proxy);
540 shell->priv->end_session_dialog_proxy = NULL;
541 }
542}
543
544static gboolean
545on_need_end_session_dialog_update (GsmShell *shell)
546{
547 /* No longer need an update */
548 if (shell->priv->update_idle_id == 0)
549 return FALSE;
550
551 shell->priv->update_idle_id = 0;
552
553 gsm_shell_open_end_session_dialog (shell,
554 shell->priv->end_session_dialog_type,
555 shell->priv->inhibitors);
556 return FALSE;
557}
558
559static void
560queue_end_session_dialog_update (GsmShell *shell)
561{
562 if (shell->priv->update_idle_id != 0)
563 return;
564
565 shell->priv->update_idle_id = g_idle_add ((GSourceFunc) on_need_end_session_dialog_update,
566 shell);
567}
568
569gboolean
570gsm_shell_open_end_session_dialog (GsmShell *shell,
571 GsmShellEndSessionDialogType type,
572 GsmStore *inhibitors)
573{
574 DBusGProxyCall *call;
575 GPtrArray *inhibitor_array;
576 GError *error;
577
578 error = NULL;
579 if (!gsm_shell_ensure_connection (shell, &error)) {
580 g_warning ("Could not connect to the shell: %s",
581 error->message);
582 g_error_free (error);
583 return FALSE;
584 }
585
586 if (shell->priv->end_session_open_call != NULL) {
587 g_return_val_if_fail (shell->priv->end_session_dialog_type == type,
588 FALSE);
589
590 return TRUE;
591 }
592
593 if (shell->priv->end_session_dialog_proxy == NULL) {
594 DBusGProxy *proxy;
595
596 proxy = dbus_g_proxy_new_for_name (shell->priv->bus_connection,
597 SHELL_NAME,
598 SHELL_END_SESSION_DIALOG_PATH,
599 SHELL_END_SESSION_DIALOG_INTERFACE);
600
601 g_assert (proxy != NULL);
602
603 shell->priv->end_session_dialog_proxy = proxy;
604
605 g_signal_connect (proxy, "destroy",
606 G_CALLBACK (on_end_session_dialog_proxy_destroyed),
607 shell);
608
609 dbus_g_proxy_add_signal (shell->priv->end_session_dialog_proxy,
610 "Closed", G_TYPE_INVALID);
611 dbus_g_proxy_connect_signal (shell->priv->end_session_dialog_proxy,
612 "Closed",
613 G_CALLBACK (on_end_session_dialog_closed),
614 shell, NULL);
615
616 dbus_g_proxy_add_signal (shell->priv->end_session_dialog_proxy,
617 "Canceled", G_TYPE_INVALID);
618 dbus_g_proxy_connect_signal (shell->priv->end_session_dialog_proxy,
619 "Canceled",
620 G_CALLBACK (on_end_session_dialog_canceled),
621 shell, NULL);
622 dbus_g_proxy_add_signal (shell->priv->end_session_dialog_proxy,
623 "ConfirmedLogout", G_TYPE_INVALID);
624 dbus_g_proxy_connect_signal (shell->priv->end_session_dialog_proxy,
625 "ConfirmedLogout",
626 G_CALLBACK (on_end_session_dialog_confirmed_logout),
627 shell, NULL);
628 dbus_g_proxy_add_signal (shell->priv->end_session_dialog_proxy,
629 "ConfirmedShutdown", G_TYPE_INVALID);
630 dbus_g_proxy_connect_signal (shell->priv->end_session_dialog_proxy,
631 "ConfirmedShutdown",
632 G_CALLBACK (on_end_session_dialog_confirmed_shutdown),
633 shell, NULL);
634 dbus_g_proxy_add_signal (shell->priv->end_session_dialog_proxy,
635 "ConfirmedReboot", G_TYPE_INVALID);
636 dbus_g_proxy_connect_signal (shell->priv->end_session_dialog_proxy,
637 "ConfirmedReboot",
638 G_CALLBACK (on_end_session_dialog_confirmed_reboot),
639 shell, NULL);
640 }
641
642 inhibitor_array = get_array_from_store (inhibitors);
643
644 call = dbus_g_proxy_begin_call_with_timeout (shell->priv->end_session_dialog_proxy,
645 "Open",
646 (DBusGProxyCallNotify)
647 on_open_finished,
648 shell,
649 NULL,
650 INT_MAX,
651 G_TYPE_UINT,
652 (guint) type,
653 G_TYPE_UINT,
654 (guint) 0,
655 G_TYPE_UINT,
656 AUTOMATIC_ACTION_TIMEOUT,
657 GSM_SHELL_DBUS_TYPE_G_OBJECT_PATH_ARRAY,
658 inhibitor_array,
659 G_TYPE_INVALID);
660 g_ptr_array_foreach (inhibitor_array, (GFunc) g_free, NULL);
661 g_ptr_array_free (inhibitor_array, TRUE);
662
663 if (call == NULL) {
664 g_warning ("Unable to make Open call");
665 return FALSE;
666 }
667
668 g_object_ref (inhibitors);
669
670 if (shell->priv->inhibitors != NULL) {
671 g_signal_handlers_disconnect_by_func (shell->priv->inhibitors,
672 G_CALLBACK (queue_end_session_dialog_update),
673 shell);
674 g_object_unref (shell->priv->inhibitors);
675 }
676
677 shell->priv->inhibitors = inhibitors;
678
679 g_signal_connect_swapped (inhibitors, "added",
680 G_CALLBACK (queue_end_session_dialog_update),
681 shell);
682
683 g_signal_connect_swapped (inhibitors, "removed",
684 G_CALLBACK (queue_end_session_dialog_update),
685 shell);
686
687 shell->priv->end_session_open_call = call;
688 shell->priv->end_session_dialog_type = type;
689
690 return TRUE;
691}
692
693void
694gsm_shell_close_end_session_dialog (GsmShell *shell)
695{
696 if (!shell->priv->end_session_dialog_proxy)
697 return;
698
699 dbus_g_proxy_call_no_reply (shell->priv->end_session_dialog_proxy, "Close", G_TYPE_INVALID);
700}
7010
=== modified file 'debian/changelog'
--- debian/changelog 2013-10-11 15:45:25 +0000
+++ debian/changelog 2013-12-04 09:35:55 +0000
@@ -1,3 +1,10 @@
1gnome-session (3.9.90-0ubuntu4) UNRELEASED; urgency=low
2
3 * debian/gnome-session.user-session.upstart: Unset Upstart event
4 variables to avoid stop(8) from stopping the users session (LP: #1256262).
5
6 -- James Hunt <james.hunt@ubuntu.com> Wed, 04 Dec 2013 09:31:07 +0000
7
1gnome-session (3.9.90-0ubuntu3) saucy; urgency=low8gnome-session (3.9.90-0ubuntu3) saucy; urgency=low
29
3 * debian/patches/git_fix_wrong_unref_call.patch: 10 * debian/patches/git_fix_wrong_unref_call.patch:
411
=== modified file 'debian/gnome-session.user-session.upstart'
--- debian/gnome-session.user-session.upstart 2013-05-22 12:55:52 +0000
+++ debian/gnome-session.user-session.upstart 2013-12-04 09:35:55 +0000
@@ -9,7 +9,10 @@
9emits desktop-start9emits desktop-start
10emits desktop-end10emits desktop-end
1111
12script
13unset UPSTART_EVENTS UPSTART_INSTANCE UPSTART_JOB
12exec gnome-session --session=$DESKTOP_SESSION14exec gnome-session --session=$DESKTOP_SESSION
15end script
1316
14post-start exec initctl emit desktop-start DESKTOP_SESSION=$DESKTOP_SESSION17post-start exec initctl emit desktop-start DESKTOP_SESSION=$DESKTOP_SESSION
1518

Subscribers

People subscribed via source and target branches

to all changes: