Merge lp:~matttbe/ubuntu/saucy/gnome-session/lp1191290 into lp:ubuntu/saucy/gnome-session

Proposed by Matthieu Baerts
Status: Merged
Merge reported by: Jeremy Bicha
Merged at revision: not available
Proposed branch: lp:~matttbe/ubuntu/saucy/gnome-session/lp1191290
Merge into: lp:ubuntu/saucy/gnome-session
Diff against target: 496 lines (+449/-0)
6 files modified
.pc/107_add_xdg_menu_prefix.patch/gnome-session/main.c (+413/-0)
.pc/applied-patches (+1/-0)
debian/changelog (+8/-0)
debian/patches/107_add_xdg_menu_prefix.patch (+21/-0)
debian/patches/series (+1/-0)
gnome-session/main.c (+5/-0)
To merge this branch: bzr merge lp:~matttbe/ubuntu/saucy/gnome-session/lp1191290
Reviewer Review Type Date Requested Status
Jeremy Bicha Abstain
Review via email: mp+169621@code.launchpad.net

Description of the change

Hello,

This new version add $XDG_MENU_PREFIX environment variable according to Desktop Menu Specification.
This change is needed because gnome-menus (version 3.8.0-1ubuntu3) has now added 'gnome-' prefix to the applications.menu file: https://bazaar.launchpad.net/~ubuntu-branches/ubuntu/saucy/gnome-menus/saucy/revision/136/debian/gnome-menus.maintscript

This 'bug' seems to/will be fixed with gnome-session 3.8 but it's just to be sure that anything is broken ;)

Note: I set you (jbicha) has reviewer because the latest version of gnome-menus was modified by you but I can set ubuntu-sponsors team if you prefer.

To post a comment you must log in.
Revision history for this message
Jeremy Bicha (jbicha) wrote :

Like I said in the bug report, can we wait a few more days to get gnome-session 3.8 in instead of backporting patches?

If you want to try the new gnome-session out, see https://launchpad.net/~ubuntu-desktop/+archive/ppa/ (but note that the desktop ppa is used for testing things to make sure they are ready for the regular archives.)

review: Abstain
Revision history for this message
Matthieu Baerts (matttbe) wrote :

> Like I said in the bug report, can we wait a few more days to get gnome-session 3.8 in instead of backporting patches?

To other people: I answer to Jeremy on the bug report. (lp: #1191290).

And I confirm that this patch is no longer needed with the version 3.8 so I guess it's not a problem to wait a few more days, not so many people should have problem with that.

Revision history for this message
Jeremy Bicha (jbicha) wrote :

I'm marking this as merged since I uploaded gnome-session 3.8 to Saucy today. It may take another couple days for it to migrate from -proposed to the regular Saucy archives because we're waiting on the latest GTK 3.8 to build on armhf and we need to figure out how to best handle migrating users from gnome-session-fallback to the renamed gnome-session-flashback.

Revision history for this message
Matthieu Baerts (matttbe) wrote :

Ok!
Thank you for all these details ;)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added directory '.pc/107_add_xdg_menu_prefix.patch'
=== added directory '.pc/107_add_xdg_menu_prefix.patch/gnome-session'
=== added file '.pc/107_add_xdg_menu_prefix.patch/gnome-session/main.c'
--- .pc/107_add_xdg_menu_prefix.patch/gnome-session/main.c 1970-01-01 00:00:00 +0000
+++ .pc/107_add_xdg_menu_prefix.patch/gnome-session/main.c 2013-06-15 14:10:34 +0000
@@ -0,0 +1,413 @@
1/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
2 *
3 * Copyright (C) 2006 Novell, Inc.
4 * Copyright (C) 2008 Red Hat, Inc.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; either version 2 of the
9 * License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
19 * 02111-1307, USA.
20 */
21
22#include <config.h>
23
24#include <libintl.h>
25#include <signal.h>
26#include <stdlib.h>
27#include <string.h>
28#include <unistd.h>
29#include <errno.h>
30
31#include <glib/gi18n.h>
32#include <glib.h>
33#include <gtk/gtk.h>
34
35#include <dbus/dbus.h>
36#include <dbus/dbus-glib.h>
37#include <dbus/dbus-glib-bindings.h>
38#include <dbus/dbus-glib-lowlevel.h>
39
40#include "gdm-signal-handler.h"
41#include "gdm-log.h"
42
43#include "gsm-util.h"
44#include "gsm-manager.h"
45#include "gsm-session-fill.h"
46#include "gsm-store.h"
47#include "gsm-system.h"
48#include "gsm-xsmp-server.h"
49#include "gsm-fail-whale-dialog.h"
50
51#define GSM_DBUS_NAME "org.gnome.SessionManager"
52
53static gboolean failsafe = FALSE;
54static gboolean show_version = FALSE;
55static gboolean debug = FALSE;
56static gboolean please_fail = FALSE;
57
58static DBusGProxy *bus_proxy = NULL;
59
60static void shutdown_cb (gpointer data);
61
62static void
63on_bus_name_lost (DBusGProxy *bus_proxy,
64 const char *name,
65 gpointer data)
66{
67 g_warning ("Lost name on bus: %s, exiting", name);
68 exit (1);
69}
70
71static gboolean
72acquire_name_on_proxy (DBusGProxy *bus_proxy,
73 const char *name)
74{
75 GError *error;
76 guint result;
77 gboolean res;
78 gboolean ret;
79
80 ret = FALSE;
81
82 if (bus_proxy == NULL) {
83 goto out;
84 }
85
86 error = NULL;
87 res = dbus_g_proxy_call (bus_proxy,
88 "RequestName",
89 &error,
90 G_TYPE_STRING, name,
91 G_TYPE_UINT, 0,
92 G_TYPE_INVALID,
93 G_TYPE_UINT, &result,
94 G_TYPE_INVALID);
95 if (! res) {
96 if (error != NULL) {
97 g_warning ("Failed to acquire %s: %s", name, error->message);
98 g_error_free (error);
99 } else {
100 g_warning ("Failed to acquire %s", name);
101 }
102 goto out;
103 }
104
105 if (result != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) {
106 if (error != NULL) {
107 g_warning ("Failed to acquire %s: %s", name, error->message);
108 g_error_free (error);
109 } else {
110 g_warning ("Failed to acquire %s", name);
111 }
112 goto out;
113 }
114
115 /* register for name lost */
116 dbus_g_proxy_add_signal (bus_proxy,
117 "NameLost",
118 G_TYPE_STRING,
119 G_TYPE_INVALID);
120 dbus_g_proxy_connect_signal (bus_proxy,
121 "NameLost",
122 G_CALLBACK (on_bus_name_lost),
123 NULL,
124 NULL);
125
126
127 ret = TRUE;
128
129 out:
130 return ret;
131}
132
133static gboolean
134acquire_name (void)
135{
136 GError *error;
137 DBusGConnection *connection;
138
139 error = NULL;
140 connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
141 if (connection == NULL) {
142 gsm_util_init_error (TRUE,
143 "Could not connect to session bus: %s",
144 error->message);
145 return FALSE;
146 }
147
148 bus_proxy = dbus_g_proxy_new_for_name_owner (connection,
149 DBUS_SERVICE_DBUS,
150 DBUS_PATH_DBUS,
151 DBUS_INTERFACE_DBUS,
152 &error);
153 if (error != NULL) {
154 gsm_util_init_error (TRUE,
155 "Could not connect to session bus: %s",
156 error->message);
157 return FALSE;
158 }
159
160 g_signal_connect_swapped (bus_proxy,
161 "destroy",
162 G_CALLBACK (shutdown_cb),
163 NULL);
164
165 if (! acquire_name_on_proxy (bus_proxy, GSM_DBUS_NAME) ) {
166 gsm_util_init_error (TRUE,
167 "%s",
168 "Could not acquire name on session bus");
169 return FALSE;
170 }
171
172 return TRUE;
173}
174
175static gboolean
176signal_cb (int signo,
177 gpointer data)
178{
179 int ret;
180 GsmManager *manager;
181
182 g_debug ("Got callback for signal %d", signo);
183
184 ret = TRUE;
185
186 switch (signo) {
187 case SIGFPE:
188 case SIGPIPE:
189 /* let the fatal signals interrupt us */
190 g_debug ("Caught signal %d, shutting down abnormally.", signo);
191 ret = FALSE;
192 break;
193 case SIGINT:
194 case SIGTERM:
195 manager = (GsmManager *)data;
196 gsm_manager_logout (manager, GSM_MANAGER_LOGOUT_MODE_FORCE, NULL);
197
198 /* let the fatal signals interrupt us */
199 g_debug ("Caught signal %d, shutting down normally.", signo);
200 ret = TRUE;
201 break;
202 case SIGHUP:
203 g_debug ("Got HUP signal");
204 ret = TRUE;
205 break;
206 case SIGUSR1:
207 g_debug ("Got USR1 signal");
208 ret = TRUE;
209 gdm_log_toggle_debug ();
210 break;
211 default:
212 g_debug ("Caught unhandled signal %d", signo);
213 ret = TRUE;
214
215 break;
216 }
217
218 return ret;
219}
220
221static void
222shutdown_cb (gpointer data)
223{
224 GsmManager *manager = (GsmManager *)data;
225 g_debug ("Calling shutdown callback function");
226
227 /*
228 * When the signal handler gets a shutdown signal, it calls
229 * this function to inform GsmManager to not restart
230 * applications in the off chance a handler is already queued
231 * to dispatch following the below call to gtk_main_quit.
232 */
233 gsm_manager_set_phase (manager, GSM_MANAGER_PHASE_EXIT);
234
235 gtk_main_quit ();
236}
237
238static gboolean
239require_dbus_session (int argc,
240 char **argv,
241 GError **error)
242{
243 char **new_argv;
244 int i;
245
246 if (g_getenv ("DBUS_SESSION_BUS_ADDRESS"))
247 return TRUE;
248
249 /* Just a sanity check to prevent infinite recursion if
250 * dbus-launch fails to set DBUS_SESSION_BUS_ADDRESS
251 */
252 g_return_val_if_fail (!g_str_has_prefix (argv[0], "dbus-launch"),
253 TRUE);
254
255 /* +2 for our new arguments, +1 for NULL */
256 new_argv = g_malloc (argc + 3 * sizeof (*argv));
257
258 new_argv[0] = "dbus-launch";
259 new_argv[1] = "--exit-with-session";
260 for (i = 0; i < argc; i++) {
261 new_argv[i + 2] = argv[i];
262 }
263 new_argv[i + 2] = NULL;
264
265 if (!execvp ("dbus-launch", new_argv)) {
266 g_set_error (error,
267 G_SPAWN_ERROR,
268 G_SPAWN_ERROR_FAILED,
269 "No session bus and could not exec dbus-launch: %s",
270 g_strerror (errno));
271 return FALSE;
272 }
273
274 /* Should not be reached */
275 return TRUE;
276}
277
278int
279main (int argc, char **argv)
280{
281 struct sigaction sa;
282 GError *error;
283 char *display_str;
284 GsmManager *manager;
285 GsmStore *client_store;
286 GsmXsmpServer *xsmp_server;
287 GdmSignalHandler *signal_handler;
288 static char **override_autostart_dirs = NULL;
289 static char *session_name = NULL;
290 static GOptionEntry entries[] = {
291 { "autostart", 'a', 0, G_OPTION_ARG_STRING_ARRAY, &override_autostart_dirs, N_("Override standard autostart directories"), N_("AUTOSTART_DIR") },
292 { "session", 0, 0, G_OPTION_ARG_STRING, &session_name, N_("Session to use"), N_("SESSION_NAME") },
293 { "debug", 0, 0, G_OPTION_ARG_NONE, &debug, N_("Enable debugging code"), NULL },
294 { "failsafe", 'f', 0, G_OPTION_ARG_NONE, &failsafe, N_("Do not load user-specified applications"), NULL },
295 { "version", 0, 0, G_OPTION_ARG_NONE, &show_version, N_("Version of this application"), NULL },
296 /* Translators: the 'fail whale' is the black dialog we show when something goes seriously wrong */
297 { "whale", 0, 0, G_OPTION_ARG_NONE, &please_fail, N_("Show the fail whale dialog for testing"), NULL },
298 { NULL, 0, 0, 0, NULL, NULL, NULL }
299 };
300
301 /* Make sure that we have a session bus */
302 if (!require_dbus_session (argc, argv, &error)) {
303 gsm_util_init_error (TRUE, "%s", error->message);
304 }
305
306 bindtextdomain (GETTEXT_PACKAGE, LOCALE_DIR);
307 bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
308 textdomain (GETTEXT_PACKAGE);
309
310 sa.sa_handler = SIG_IGN;
311 sa.sa_flags = 0;
312 sigemptyset (&sa.sa_mask);
313 sigaction (SIGPIPE, &sa, 0);
314
315 error = NULL;
316 gtk_init_with_args (&argc, &argv,
317 (char *) _(" - the GNOME session manager"),
318 entries, GETTEXT_PACKAGE,
319 &error);
320 if (error != NULL) {
321 g_warning ("%s", error->message);
322 exit (1);
323 }
324
325 if (show_version) {
326 g_print ("%s %s\n", argv [0], VERSION);
327 exit (1);
328 }
329
330 if (please_fail) {
331 gsm_fail_whale_dialog_we_failed (TRUE, TRUE, NULL);
332 gtk_main ();
333 exit (1);
334 }
335
336 gdm_log_init ();
337 gdm_log_set_debug (debug);
338
339 /* Set DISPLAY explicitly for all our children, in case --display
340 * was specified on the command line.
341 */
342 display_str = gdk_get_display ();
343 gsm_util_setenv ("DISPLAY", display_str);
344 g_free (display_str);
345
346 /* Some third-party programs rely on GNOME_DESKTOP_SESSION_ID to
347 * detect if GNOME is running. We keep this for compatibility reasons.
348 */
349 gsm_util_setenv ("GNOME_DESKTOP_SESSION_ID", "this-is-deprecated");
350
351 client_store = gsm_store_new ();
352
353 /* Talk to logind before acquiring a name, since it does synchronous
354 * calls at initialization time that invoke a main loop and if we
355 * already owned a name, then we would service too early during
356 * that main loop.
357 */
358 g_object_unref (gsm_get_system ());
359
360 xsmp_server = gsm_xsmp_server_new (client_store);
361
362 if (!acquire_name ()) {
363 gsm_fail_whale_dialog_we_failed (TRUE, TRUE, NULL);
364 gtk_main ();
365 exit (1);
366 }
367
368 manager = gsm_manager_new (client_store, failsafe);
369 /*
370 signal_handler = gdm_signal_handler_new ();
371 gdm_signal_handler_add_fatal (signal_handler);
372 gdm_signal_handler_add (signal_handler, SIGFPE, signal_cb, NULL);
373 gdm_signal_handler_add (signal_handler, SIGHUP, signal_cb, NULL);
374 gdm_signal_handler_add (signal_handler, SIGUSR1, signal_cb, NULL);
375 gdm_signal_handler_add (signal_handler, SIGTERM, signal_cb, manager);
376 gdm_signal_handler_add (signal_handler, SIGINT, signal_cb, manager);
377 gdm_signal_handler_set_fatal_func (signal_handler, shutdown_cb, manager);
378 */
379 if (IS_STRING_EMPTY (session_name))
380 session_name = _gsm_manager_get_default_session (manager);
381
382 gsm_util_set_autostart_dirs (override_autostart_dirs);
383
384 if (!gsm_session_fill (manager, session_name)) {
385 gsm_util_init_error (TRUE, "Failed to load session \"%s\"", session_name ? session_name : "(null)");
386 }
387
388 gsm_xsmp_server_start (xsmp_server);
389 gsm_manager_start (manager);
390
391 gtk_main ();
392
393 if (xsmp_server != NULL) {
394 g_object_unref (xsmp_server);
395 }
396
397 if (manager != NULL) {
398 g_debug ("Unreffing manager");
399 g_object_unref (manager);
400 }
401
402 if (client_store != NULL) {
403 g_object_unref (client_store);
404 }
405
406 if (bus_proxy != NULL) {
407 g_object_unref (bus_proxy);
408 }
409
410 gdm_log_shutdown ();
411
412 return 0;
413}
0414
=== modified file '.pc/applied-patches'
--- .pc/applied-patches 2013-04-29 10:05:07 +0000
+++ .pc/applied-patches 2013-06-15 14:10:34 +0000
@@ -17,3 +17,4 @@
17104_dont_show_fallback_warning.patch17104_dont_show_fallback_warning.patch
18105_hide_session_startup_help.patch18105_hide_session_startup_help.patch
19106_display_gnome-session-properties.patch19106_display_gnome-session-properties.patch
20107_add_xdg_menu_prefix.patch
2021
=== modified file 'debian/changelog'
--- debian/changelog 2013-05-22 12:55:52 +0000
+++ debian/changelog 2013-06-15 14:10:34 +0000
@@ -1,3 +1,11 @@
1gnome-session (3.6.2-0ubuntu8) saucy; urgency=low
2
3 * debian/patches/107_add_xdg_menu_prefix.patch: (LP: #1191290)
4 - Set XDG_MENU_PREFIX according to Desktop Menu Specification because
5 Gnome-menus has added 'gnome-' prefix to the applications.menu file
6
7 -- Matthieu Baerts (matttbe) <matttbe@ubuntu.com> Sat, 15 Jun 2013 15:54:54 +0200
8
1gnome-session (3.6.2-0ubuntu7) saucy; urgency=low9gnome-session (3.6.2-0ubuntu7) saucy; urgency=low
210
3 * Have the upstart job start for any gnome-session, not just 'ubuntu' -11 * Have the upstart job start for any gnome-session, not just 'ubuntu' -
412
=== added file 'debian/patches/107_add_xdg_menu_prefix.patch'
--- debian/patches/107_add_xdg_menu_prefix.patch 1970-01-01 00:00:00 +0000
+++ debian/patches/107_add_xdg_menu_prefix.patch 2013-06-15 14:10:34 +0000
@@ -0,0 +1,21 @@
1From: Matthieu Baerts <matttbe@gmail.com>
2Subject: Set XDG_MENU_PREFIX according to Desktop Menu Specification
3Bug: https://bugs.launchpad.net/ubuntu/+source/gnome-menus/+bug/1191290
4Forwarded: no
5
6Index: gnome-session/gnome-session/main.c
7===================================================================
8--- gnome-session.orig/gnome-session/main.c 2013-06-15 15:41:52.314641000 +0200
9+++ gnome-session/gnome-session/main.c 2013-06-15 15:49:20.693234175 +0200
10@@ -348,6 +348,11 @@
11 */
12 gsm_util_setenv ("GNOME_DESKTOP_SESSION_ID", "this-is-deprecated");
13
14+ /* Set XDG_MENU_PREFIX according to Desktop Menu Specification.
15+ * gnome-menus has added 'gnome-' prefix to the applications.menu file
16+ */
17+ gsm_util_setenv ("XDG_MENU_PREFIX", "gnome-");
18+
19 client_store = gsm_store_new ();
20
21 /* Talk to logind before acquiring a name, since it does synchronous
022
=== modified file 'debian/patches/series'
--- debian/patches/series 2013-04-29 10:05:07 +0000
+++ debian/patches/series 2013-06-15 14:10:34 +0000
@@ -20,4 +20,5 @@
20104_dont_show_fallback_warning.patch20104_dont_show_fallback_warning.patch
21105_hide_session_startup_help.patch21105_hide_session_startup_help.patch
22106_display_gnome-session-properties.patch22106_display_gnome-session-properties.patch
23107_add_xdg_menu_prefix.patch
2324
2425
=== modified file 'gnome-session/main.c'
--- gnome-session/main.c 2012-11-13 14:06:21 +0000
+++ gnome-session/main.c 2013-06-15 14:10:34 +0000
@@ -348,6 +348,11 @@
348 */348 */
349 gsm_util_setenv ("GNOME_DESKTOP_SESSION_ID", "this-is-deprecated");349 gsm_util_setenv ("GNOME_DESKTOP_SESSION_ID", "this-is-deprecated");
350350
351 /* Set XDG_MENU_PREFIX according to Desktop Menu Specification.
352 * gnome-menus has added 'gnome-' prefix to the applications.menu file
353 */
354 gsm_util_setenv ("XDG_MENU_PREFIX", "gnome-");
355
351 client_store = gsm_store_new ();356 client_store = gsm_store_new ();
352357
353 /* Talk to logind before acquiring a name, since it does synchronous358 /* Talk to logind before acquiring a name, since it does synchronous

Subscribers

People subscribed via source and target branches