Gentoo Archives: gentoo-commits

From: "Gilles Dartiguelongue (eva)" <eva@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in gnome-base/gnome-session/files: gnome-session-2.32.1-gnome3-conditions.patch
Date: Mon, 04 Apr 2011 14:52:18
Message-Id: 20110404145208.BBAFF20057@flycatcher.gentoo.org
1 eva 11/04/04 14:52:08
2
3 Added: gnome-session-2.32.1-gnome3-conditions.patch
4 Log:
5 Add support for GNOME 3 conditions, thanks to Nirbheek, bug #361025.
6
7 (Portage version: 2.2.0_alpha29/cvs/Linux x86_64, RepoMan options: --force)
8
9 Revision Changes Path
10 1.1 gnome-base/gnome-session/files/gnome-session-2.32.1-gnome3-conditions.patch
11
12 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/gnome-base/gnome-session/files/gnome-session-2.32.1-gnome3-conditions.patch?rev=1.1&view=markup
13 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/gnome-base/gnome-session/files/gnome-session-2.32.1-gnome3-conditions.patch?rev=1.1&content-type=text/plain
14
15 Index: gnome-session-2.32.1-gnome3-conditions.patch
16 ===================================================================
17 From d27c9dfb07e0d69ff37d029e5647bd68e7db7e95 Mon Sep 17 00:00:00 2001
18 From: Nirbheek Chauhan <nirbheek@g.o>
19 Date: Mon, 4 Apr 2011 18:07:09 +0530
20 Subject: [PATCH] Don't reject GNOME 3 session autostart conditions
21
22 gnome-session-3.0 introduced a new AutostartCondition=GNOME3 directive.
23 See commit 58ebdfac for details on that.
24
25 This commit adds detection for that directive instead of disabling .desktop
26 files with that. Now, apps are autostarted if they contain:
27
28 AutostartCondition=GNOME3 is-session gnome-fallback
29 or
30 AutostartCondition=GNOME3 unless-session [something other than gnome-fallback]
31
32 And are disabled for all other cases.
33 ---
34 gnome-session/gsm-autostart-app.c | 45 +++++++++++++++++++++++++++++++-----
35 1 files changed, 38 insertions(+), 7 deletions(-)
36
37 diff --git a/gnome-session/gsm-autostart-app.c b/gnome-session/gsm-autostart-app.c
38 index 529a346..abc918f 100644
39 --- a/gnome-session/gsm-autostart-app.c
40 +++ b/gnome-session/gsm-autostart-app.c
41 @@ -40,11 +40,14 @@ enum {
42 };
43
44 enum {
45 - GSM_CONDITION_NONE = 0,
46 - GSM_CONDITION_IF_EXISTS = 1,
47 - GSM_CONDITION_UNLESS_EXISTS = 2,
48 - GSM_CONDITION_GNOME = 3,
49 - GSM_CONDITION_UNKNOWN = 4
50 + GSM_CONDITION_NONE = 0,
51 + GSM_CONDITION_IF_EXISTS = 1,
52 + GSM_CONDITION_UNLESS_EXISTS = 2,
53 + GSM_CONDITION_GNOME = 3,
54 + GSM_CONDITION_GSETTINGS = 4,
55 + GSM_CONDITION_IF_SESSION = 5,
56 + GSM_CONDITION_UNLESS_SESSION = 6,
57 + GSM_CONDITION_UNKNOWN = 7
58 };
59
60 #define GSM_SESSION_CLIENT_DBUS_INTERFACE "org.gnome.SessionClient"
61 @@ -153,15 +156,31 @@ parse_condition_string (const char *condition_string,
62 key++;
63 }
64
65 + kind = GSM_CONDITION_UNKNOWN;
66 +
67 if (!g_ascii_strncasecmp (condition_string, "if-exists", len) && key) {
68 kind = GSM_CONDITION_IF_EXISTS;
69 } else if (!g_ascii_strncasecmp (condition_string, "unless-exists", len) && key) {
70 kind = GSM_CONDITION_UNLESS_EXISTS;
71 } else if (!g_ascii_strncasecmp (condition_string, "GNOME", len)) {
72 kind = GSM_CONDITION_GNOME;
73 - } else {
74 + } else if (!g_ascii_strncasecmp (condition_string, "GNOME3", len)) {
75 + condition_string = key;
76 + space = condition_string + strcspn (condition_string, " ");
77 + len = space - condition_string;
78 + key = space;
79 + while (isspace ((unsigned char)*key)) {
80 + key++;
81 + }
82 + if (!g_ascii_strncasecmp (condition_string, "if-session", len) && key) {
83 + kind = GSM_CONDITION_IF_SESSION;
84 + } else if (!g_ascii_strncasecmp (condition_string, "unless-session", len) && key) {
85 + kind = GSM_CONDITION_UNLESS_SESSION;
86 + }
87 + }
88 +
89 + if (kind == GSM_CONDITION_UNKNOWN) {
90 key = NULL;
91 - kind = GSM_CONDITION_UNKNOWN;
92 }
93
94 if (keyp != NULL) {
95 @@ -364,6 +383,12 @@ setup_condition_monitor (GsmAutostartApp *app)
96 gconf_condition_cb,
97 app, NULL, NULL);
98 g_object_unref (client);
99 + } else if (kind == GSM_CONDITION_IF_SESSION) {
100 + /* We treat GNOME 2.32 as the same as gnome-fallback */
101 + disabled = strcmp ("gnome-fallback", key) != 0;
102 + } else if (kind == GSM_CONDITION_UNLESS_SESSION) {
103 + /* We treat GNOME 2.32 as the same as gnome-fallback */
104 + disabled = strcmp ("gnome-fallback", key) == 0;
105 } else {
106 disabled = TRUE;
107 }
108 @@ -647,6 +672,12 @@ is_conditionally_disabled (GsmApp *app)
109 g_assert (GCONF_IS_CLIENT (client));
110 disabled = !gconf_client_get_bool (client, key, NULL);
111 g_object_unref (client);
112 + } else if (kind == GSM_CONDITION_IF_SESSION) {
113 + /* We treat GNOME 2.32 as the same as gnome-fallback */
114 + disabled = strcmp ("gnome-fallback", key) != 0;
115 + } else if (kind == GSM_CONDITION_UNLESS_SESSION) {
116 + /* We treat GNOME 2.32 as the same as gnome-fallback */
117 + disabled = strcmp ("gnome-fallback", key) == 0;
118 } else {
119 disabled = TRUE;
120 }
121 --
122 1.7.3.4