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

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

Subscribers

People subscribed via source and target branches