Merge lp:~darkxst/gnome-session/3.14 into lp:~ubuntu-desktop/gnome-session/ubuntu
- 3.14
- Merge into ubuntu
Proposed by
Tim Lunn
Status: | Merged |
---|---|
Merged at revision: | 320 |
Proposed branch: | lp:~darkxst/gnome-session/3.14 |
Merge into: | lp:~ubuntu-desktop/gnome-session/ubuntu |
Diff against target: |
6468 lines (+4434/-1736) 22 files modified
debian/changelog (+167/-0) debian/control (+13/-15) debian/control.in (+12/-10) debian/defaults.list (+198/-200) debian/gnome-session-common.dirs (+1/-0) debian/gnome-session-common.install (+1/-0) debian/gnome-session.install (+2/-0) debian/patches/01_gnome-wm.patch (+0/-11) debian/patches/02_fallback_desktop.patch (+0/-12) debian/patches/03_fallback_desktop_makefile.patch (+0/-13) debian/patches/101_screen_lock_on_suspend.patch (+0/-92) debian/patches/10_session_save.patch (+0/-536) debian/patches/12_no_gdm_fallback.patch (+0/-27) debian/patches/13_display_session_properties.patch (+4/-4) debian/patches/50_ubuntu_sessions.patch (+23/-13) debian/patches/52_xdg_current_desktop.patch (+0/-46) debian/patches/80_new_upstream_session_dialog.patch (+0/-699) debian/patches/95_dbus_request_shutdown.patch (+12/-18) debian/patches/git_fix_wrong_unref_call.patch (+0/-32) debian/patches/revert_remove_gnome_session_properties.patch (+3992/-0) debian/patches/series (+1/-6) debian/rules (+8/-2) |
To merge this branch: | bzr merge lp:~darkxst/gnome-session/3.14 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Martin Pitt | Approve | ||
Review via email: mp+240212@code.launchpad.net |
Commit message
Description of the change
gnome-session-
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'debian/changelog' | |||
2 | --- debian/changelog 2014-10-15 10:18:16 +0000 | |||
3 | +++ debian/changelog 2014-10-31 04:52:33 +0000 | |||
4 | @@ -1,3 +1,142 @@ | |||
5 | 1 | gnome-session (3.14.0-2ubuntu1) UNRELEASED; urgency=medium | ||
6 | 2 | |||
7 | 3 | * Merge from Debian, Remaining Changes: | ||
8 | 4 | - debian/control.in: | ||
9 | 5 | + Recommend session-migration | ||
10 | 6 | * don't depend on xwayland | ||
11 | 7 | - debian/gnome-session.install: Don't install wayland session for now | ||
12 | 8 | since its not yet possible to run it | ||
13 | 9 | - Split ubuntu-session out of gnome-session. | ||
14 | 10 | - Add upstart user session | ||
15 | 11 | - debian/gnome-session-bin.postinst, debian/gnome-session-bin.prerm: | ||
16 | 12 | Moved registering gnome-session binary as a session manager to | ||
17 | 13 | gnome-session-bin package | ||
18 | 14 | - don't install defaults.list (installed by desktop-file-utils in ubuntu): | ||
19 | 15 | debian/gnome-session-common.dirs and gnome-session-common.install | ||
20 | 16 | - debian/patches/22_support_autostart_delay.patch: | ||
21 | 17 | Bugzilla patch to support adding a delay to autostart apps, using | ||
22 | 18 | a "X-GNOME-Autostart-Delay" key in the desktop file | ||
23 | 19 | - debian/patches/50_ubuntu_sessions.patch: | ||
24 | 20 | + Add Ubuntu session | ||
25 | 21 | + gnome-shell.desktop adds --session=gnome now that the "ubuntu" session | ||
26 | 22 | is the default. Use TryExec to test if gnome-shell is installed. | ||
27 | 23 | - debian/patches/51_remove_session_saving_from_gui.patch: | ||
28 | 24 | add GNOME_SESSION_SAVE environment variable for people wanting to | ||
29 | 25 | use the save session still, knowing that it can break your system | ||
30 | 26 | if used unwisely (LP: #771896) | ||
31 | 27 | - debian/patches/52_xdg_current_desktop.patch: | ||
32 | 28 | Set XDG_CURRENT_DESKTOP inside gnome-session based on a | ||
33 | 29 | new key 'DesktopName' in gnome-session .desktop files. | ||
34 | 30 | - debian/patches/53_add_sessionmigration.patch, debian/control: | ||
35 | 31 | recommends and launch the session-migration if present at the start | ||
36 | 32 | of the session. This sync tool is running different session migration | ||
37 | 33 | scripts that can be provided in various desktop packages. | ||
38 | 34 | - debian/patches/95_dbus_request_shutdown.patch: | ||
39 | 35 | Add "RequestShutdown" and "RequestReboot" DBus methods to allow other | ||
40 | 36 | applications to shutdown or reboot the machine via the session manager. | ||
41 | 37 | - debian/patches/103_kill_the_fail_whale.patch: | ||
42 | 38 | Kill the Fail Whale as it tends to be more annoying than helpful | ||
43 | 39 | * debian/patches/revert_remove_gnome_session_properties.patch | ||
44 | 40 | * Dropped Changes: | ||
45 | 41 | * debian/patches/52_xdg_current_desktop.patch: Dropped Upsream includes a | ||
46 | 42 | fallback to set this now. | ||
47 | 43 | * Remove patches that have been disabled since 3.8 | ||
48 | 44 | |||
49 | 45 | -- Tim Lunn <tim@feathertop.org> Fri, 31 Oct 2014 09:57:57 +1100 | ||
50 | 46 | |||
51 | 47 | gnome-session (3.14.0-2) unstable; urgency=medium | ||
52 | 48 | |||
53 | 49 | * Update debian/defaults.list to catch up with times: | ||
54 | 50 | - Drop swfdec-player which is long gone. | ||
55 | 51 | - Update File-Roller to new .desktop file name. | ||
56 | 52 | - Update GEdit to new .desktop file name. | ||
57 | 53 | - Update Font Viewer to new .desktop file name. | ||
58 | 54 | - Update Nautilus to new .desktop file name. | ||
59 | 55 | - Update Totem to new .desktop file name. | ||
60 | 56 | (Closes: #763595) | ||
61 | 57 | Note: This breaks the defaults for those who install the new | ||
62 | 58 | gnome-session-common and keep their << 3.14 application | ||
63 | 59 | packages (partial upgrades). | ||
64 | 60 | |||
65 | 61 | -- Andreas Henriksson <andreas@fatal.se> Wed, 01 Oct 2014 16:11:51 +0200 | ||
66 | 62 | |||
67 | 63 | gnome-session (3.14.0-1) unstable; urgency=medium | ||
68 | 64 | |||
69 | 65 | * New upstream release. | ||
70 | 66 | * Upload to unstable. | ||
71 | 67 | |||
72 | 68 | -- Andreas Henriksson <andreas@fatal.se> Mon, 22 Sep 2014 20:42:37 +0200 | ||
73 | 69 | |||
74 | 70 | gnome-session (3.13.3-1) experimental; urgency=medium | ||
75 | 71 | |||
76 | 72 | [ Andreas Henriksson ] | ||
77 | 73 | * New upstream development release. | ||
78 | 74 | |||
79 | 75 | [ Josselin Mouette ] | ||
80 | 76 | * Fix typos in defaults.list. Closes: #759429. | ||
81 | 77 | |||
82 | 78 | -- Andreas Henriksson <andreas@fatal.se> Fri, 05 Sep 2014 15:09:51 -0700 | ||
83 | 79 | |||
84 | 80 | gnome-session (3.12.1-4) experimental; urgency=medium | ||
85 | 81 | |||
86 | 82 | * gnome-session: Install wayland session files. | ||
87 | 83 | * gnome-session-bin: add xwayland dependency on linux-any. | ||
88 | 84 | |||
89 | 85 | -- Andreas Henriksson <andreas@fatal.se> Sat, 02 Aug 2014 17:22:46 +0200 | ||
90 | 86 | |||
91 | 87 | gnome-session (3.12.1-3) unstable; urgency=medium | ||
92 | 88 | |||
93 | 89 | [ Laurent Bigonville ] | ||
94 | 90 | * debian/control.in: Recommends libpam-systemd instead of systemd on linux | ||
95 | 91 | architectures and add recommends against consolekit on non linux arch. | ||
96 | 92 | Also move the Recommends to the arch any package. | ||
97 | 93 | |||
98 | 94 | [ Andreas Henriksson ] | ||
99 | 95 | * Drop build-dependency on libupower-glib-dev (<< 0.99.0) [!linux-any] | ||
100 | 96 | - This can no longer be fulfilled anyway. | ||
101 | 97 | * Upload to unstable. | ||
102 | 98 | |||
103 | 99 | -- Andreas Henriksson <andreas@fatal.se> Mon, 14 Jul 2014 23:57:59 +0200 | ||
104 | 100 | |||
105 | 101 | gnome-session (3.12.1-2) experimental; urgency=medium | ||
106 | 102 | |||
107 | 103 | * Enable systemd support on linux architectures only | ||
108 | 104 | |||
109 | 105 | -- Laurent Bigonville <bigon@debian.org> Sun, 04 May 2014 15:02:14 +0200 | ||
110 | 106 | |||
111 | 107 | gnome-session (3.12.1-1) experimental; urgency=medium | ||
112 | 108 | |||
113 | 109 | * New upstream release | ||
114 | 110 | |||
115 | 111 | -- Sjoerd Simons <sjoerd@debian.org> Sun, 27 Apr 2014 18:03:58 +0200 | ||
116 | 112 | |||
117 | 113 | gnome-session (3.12.0-1) experimental; urgency=medium | ||
118 | 114 | |||
119 | 115 | * New upstream release. | ||
120 | 116 | * Require upower build-dependency to be lower then 0.99.x and | ||
121 | 117 | only on non-linux. | ||
122 | 118 | - The new upower 0.99.x does not implement the used interfaces. | ||
123 | 119 | - Functionality is available via logind. | ||
124 | 120 | * Drop installing /usr/share/applications | ||
125 | 121 | - new upstream no longer ships gnome-session-properties | ||
126 | 122 | * Bump build-dependency on libglib2.0-dev to >= 2.39.90 | ||
127 | 123 | - using g_subprocess requires a recent glib. | ||
128 | 124 | * Bump Standards-Version to 3.9.5 | ||
129 | 125 | |||
130 | 126 | -- Andreas Henriksson <andreas@fatal.se> Wed, 26 Mar 2014 22:51:00 +0100 | ||
131 | 127 | |||
132 | 128 | gnome-session (3.10.1-1) experimental; urgency=low | ||
133 | 129 | |||
134 | 130 | * New upstream release | ||
135 | 131 | * debian/patches/13_display_session_properties.patch | ||
136 | 132 | + Dropped. gnome-session-properties has been dropped upstream | ||
137 | 133 | * debian/rules, debian/control.in: Explicitely enabled systemd support and | ||
138 | 134 | recommend systemd for logind. Recommends is enough as gnome-session should | ||
139 | 135 | fall back to consolekit | ||
140 | 136 | * debian/control.in: Update build-depends | ||
141 | 137 | |||
142 | 138 | -- Sjoerd Simons <sjoerd@debian.org> Fri, 01 Nov 2013 23:04:59 +0100 | ||
143 | 139 | |||
144 | 1 | gnome-session (3.9.90-0ubuntu16) utopic; urgency=medium | 140 | gnome-session (3.9.90-0ubuntu16) utopic; urgency=medium |
145 | 2 | 141 | ||
146 | 3 | * set GNOME_SHELL_SESSION_MODE for gnome-classic sessions (LP: #1381297) | 142 | * set GNOME_SHELL_SESSION_MODE for gnome-classic sessions (LP: #1381297) |
147 | @@ -136,6 +275,34 @@ | |||
148 | 136 | 275 | ||
149 | 137 | -- Jeremy Bicha <jbicha@ubuntu.com> Mon, 26 Aug 2013 08:47:31 -0400 | 276 | -- Jeremy Bicha <jbicha@ubuntu.com> Mon, 26 Aug 2013 08:47:31 -0400 |
150 | 138 | 277 | ||
151 | 278 | gnome-session (3.8.4-3) unstable; urgency=medium | ||
152 | 279 | |||
153 | 280 | * debian/control.in: | ||
154 | 281 | +Break gdm3 < 3.8. Closes: #726498. | ||
155 | 282 | |||
156 | 283 | -- Emilio Pozuelo Monfort <pochu@debian.org> Sat, 26 Oct 2013 16:12:19 +0200 | ||
157 | 284 | |||
158 | 285 | gnome-session (3.8.4-2) unstable; urgency=low | ||
159 | 286 | |||
160 | 287 | * Upload to unstable. | ||
161 | 288 | |||
162 | 289 | -- Emilio Pozuelo Monfort <pochu@debian.org> Sun, 13 Oct 2013 17:27:19 +0200 | ||
163 | 290 | |||
164 | 291 | gnome-session (3.8.4-1) experimental; urgency=low | ||
165 | 292 | |||
166 | 293 | [ Jeremy Bicha ] | ||
167 | 294 | * New upstream release | ||
168 | 295 | * debian/control.in: | ||
169 | 296 | - Don't recommend gnome-power-manager | ||
170 | 297 | * Completely drop gnome-session-fallback (moved to gnome-panel source) | ||
171 | 298 | |||
172 | 299 | [ Michael Biebl ] | ||
173 | 300 | * Drop Build-Depends on libnotify-dev. No longer necessary after | ||
174 | 301 | debian/patches/04_fallback_warning_notify.patch has been removed. | ||
175 | 302 | * Bump Standards-Version to 3.9.4. No further changes. | ||
176 | 303 | |||
177 | 304 | -- Michael Biebl <biebl@debian.org> Fri, 11 Oct 2013 17:07:46 +0200 | ||
178 | 305 | |||
179 | 139 | gnome-session (3.8.2.1-1ubuntu5) saucy; urgency=low | 306 | gnome-session (3.8.2.1-1ubuntu5) saucy; urgency=low |
180 | 140 | 307 | ||
181 | 141 | * debian/patches/50_ubuntu_sessions.patch: | 308 | * debian/patches/50_ubuntu_sessions.patch: |
182 | 142 | 309 | ||
183 | === modified file 'debian/control' | |||
184 | --- debian/control 2014-09-30 17:01:54 +0000 | |||
185 | +++ debian/control 2014-10-31 04:52:33 +0000 | |||
186 | @@ -1,31 +1,22 @@ | |||
187 | 1 | # This file is autogenerated. DO NOT EDIT! | ||
188 | 2 | # | ||
189 | 3 | # Modifications should be made to debian/control.in instead. | ||
190 | 4 | # This file is regenerated automatically in the clean target. | ||
191 | 5 | Source: gnome-session | 1 | Source: gnome-session |
192 | 6 | Section: gnome | 2 | Section: gnome |
193 | 7 | Priority: optional | 3 | Priority: optional |
194 | 8 | Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com> | 4 | Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com> |
195 | 9 | XSBC-Original-Maintainer: Debian GNOME Maintainers <pkg-gnome-maintainers@lists.alioth.debian.org> | 5 | XSBC-Original-Maintainer: Debian GNOME Maintainers <pkg-gnome-maintainers@lists.alioth.debian.org> |
198 | 10 | Uploaders: Debian GNOME Maintainers <pkg-gnome-maintainers@lists.alioth.debian.org> | 6 | Uploaders: @GNOME_TEAM@ |
199 | 11 | Standards-Version: 3.9.3 | 7 | Standards-Version: 3.9.5 |
200 | 12 | Build-Depends: cdbs (>= 0.4.41), | 8 | Build-Depends: cdbs (>= 0.4.41), |
201 | 13 | dh-autoreconf, | 9 | dh-autoreconf, |
202 | 14 | debhelper (>= 8), | 10 | debhelper (>= 8), |
203 | 15 | gnome-pkg-tools (>= 0.13), | 11 | gnome-pkg-tools (>= 0.13), |
204 | 16 | gnome-common, | 12 | gnome-common, |
205 | 17 | intltool (>= 0.40.6), | 13 | intltool (>= 0.40.6), |
207 | 18 | libglib2.0-dev (>= 2.34.0), | 14 | libglib2.0-dev (>= 2.39.90), |
208 | 19 | libgtk-3-dev (>= 2.90.7), | 15 | libgtk-3-dev (>= 2.90.7), |
209 | 20 | libupower-glib-dev (>= 0.9.0), | ||
210 | 21 | libdbus-glib-1-dev (>= 0.76), | 16 | libdbus-glib-1-dev (>= 0.76), |
211 | 22 | libjson-glib-dev (>= 0.10), | 17 | libjson-glib-dev (>= 0.10), |
214 | 23 | libnotify-dev (>= 0.7), | 18 | libgnome-desktop-3-dev (>= 3.9.91), |
213 | 24 | libgnome-desktop-3-dev (>= 3.7.90), | ||
215 | 25 | libsm-dev, | 19 | libsm-dev, |
216 | 26 | libsystemd-daemon-dev, | ||
217 | 27 | libsystemd-journal-dev, | ||
218 | 28 | libsystemd-login-dev (>= 183), | ||
219 | 29 | libice-dev, | 20 | libice-dev, |
220 | 30 | libx11-dev, | 21 | libx11-dev, |
221 | 31 | libxt-dev, | 22 | libxt-dev, |
222 | @@ -37,13 +28,17 @@ | |||
223 | 37 | libxrender-dev, | 28 | libxrender-dev, |
224 | 38 | xmlto, | 29 | xmlto, |
225 | 39 | xsltproc, | 30 | xsltproc, |
227 | 40 | xtrans-dev | 31 | xtrans-dev, |
228 | 32 | libsystemd-login-dev (>= 183) [linux-any], | ||
229 | 33 | libsystemd-daemon-dev [linux-any], | ||
230 | 34 | libsystemd-journal-dev [linux-any] | ||
231 | 41 | Vcs-Bzr: http://bazaar.launchpad.net/~ubuntu-desktop/gnome-session/ubuntu | 35 | Vcs-Bzr: http://bazaar.launchpad.net/~ubuntu-desktop/gnome-session/ubuntu |
232 | 42 | 36 | ||
233 | 43 | Package: gnome-session | 37 | Package: gnome-session |
234 | 44 | Architecture: all | 38 | Architecture: all |
235 | 45 | Depends: ${misc:Depends}, | 39 | Depends: ${misc:Depends}, |
236 | 46 | gnome-settings-daemon (>= 3.0), | 40 | gnome-settings-daemon (>= 3.0), |
237 | 41 | gnome-shell (>= 3.0), | ||
238 | 47 | gnome-session-bin (>= ${binary:Version}), | 42 | gnome-session-bin (>= ${binary:Version}), |
239 | 48 | gnome-session-bin (<< ${gnome:NextVersion}), | 43 | gnome-session-bin (<< ${gnome:NextVersion}), |
240 | 49 | gnome-session-common (= ${binary:Version}) | 44 | gnome-session-common (= ${binary:Version}) |
241 | @@ -92,8 +87,11 @@ | |||
242 | 92 | ${misc:Depends}, | 87 | ${misc:Depends}, |
243 | 93 | dbus-x11, | 88 | dbus-x11, |
244 | 94 | gsettings-desktop-schemas, | 89 | gsettings-desktop-schemas, |
246 | 95 | upower (>= 0.9.0) | 90 | upower (>= 0.9.0), |
247 | 91 | xwayland [linux-any] | ||
248 | 92 | Recommends: libpam-systemd [linux-any], consolekit [!linux-any] | ||
249 | 96 | Conflicts: gnome-session (<< 3.9.90-0ubuntu8) | 93 | Conflicts: gnome-session (<< 3.9.90-0ubuntu8) |
250 | 94 | Breaks: gdm (<< 3.8) | ||
251 | 97 | Description: GNOME Session Manager - Minimal runtime | 95 | Description: GNOME Session Manager - Minimal runtime |
252 | 98 | The GNOME Session Manager is in charge of starting the core components | 96 | The GNOME Session Manager is in charge of starting the core components |
253 | 99 | of the GNOME desktop, and applications that should be launched at | 97 | of the GNOME desktop, and applications that should be launched at |
254 | 100 | 98 | ||
255 | === modified file 'debian/control.in' | |||
256 | --- debian/control.in 2014-02-20 07:56:43 +0000 | |||
257 | +++ debian/control.in 2014-10-31 04:52:33 +0000 | |||
258 | @@ -4,24 +4,19 @@ | |||
259 | 4 | Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com> | 4 | Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com> |
260 | 5 | XSBC-Original-Maintainer: Debian GNOME Maintainers <pkg-gnome-maintainers@lists.alioth.debian.org> | 5 | XSBC-Original-Maintainer: Debian GNOME Maintainers <pkg-gnome-maintainers@lists.alioth.debian.org> |
261 | 6 | Uploaders: @GNOME_TEAM@ | 6 | Uploaders: @GNOME_TEAM@ |
263 | 7 | Standards-Version: 3.9.3 | 7 | Standards-Version: 3.9.5 |
264 | 8 | Build-Depends: cdbs (>= 0.4.41), | 8 | Build-Depends: cdbs (>= 0.4.41), |
265 | 9 | dh-autoreconf, | 9 | dh-autoreconf, |
266 | 10 | debhelper (>= 8), | 10 | debhelper (>= 8), |
267 | 11 | gnome-pkg-tools (>= 0.13), | 11 | gnome-pkg-tools (>= 0.13), |
268 | 12 | gnome-common, | 12 | gnome-common, |
269 | 13 | intltool (>= 0.40.6), | 13 | intltool (>= 0.40.6), |
271 | 14 | libglib2.0-dev (>= 2.34.0), | 14 | libglib2.0-dev (>= 2.39.90), |
272 | 15 | libgtk-3-dev (>= 2.90.7), | 15 | libgtk-3-dev (>= 2.90.7), |
273 | 16 | libupower-glib-dev (>= 0.9.0), | ||
274 | 17 | libdbus-glib-1-dev (>= 0.76), | 16 | libdbus-glib-1-dev (>= 0.76), |
275 | 18 | libjson-glib-dev (>= 0.10), | 17 | libjson-glib-dev (>= 0.10), |
278 | 19 | libnotify-dev (>= 0.7), | 18 | libgnome-desktop-3-dev (>= 3.9.91), |
277 | 20 | libgnome-desktop-3-dev (>= 3.7.90), | ||
279 | 21 | libsm-dev, | 19 | libsm-dev, |
280 | 22 | libsystemd-daemon-dev, | ||
281 | 23 | libsystemd-journal-dev, | ||
282 | 24 | libsystemd-login-dev (>= 183), | ||
283 | 25 | libice-dev, | 20 | libice-dev, |
284 | 26 | libx11-dev, | 21 | libx11-dev, |
285 | 27 | libxt-dev, | 22 | libxt-dev, |
286 | @@ -33,13 +28,17 @@ | |||
287 | 33 | libxrender-dev, | 28 | libxrender-dev, |
288 | 34 | xmlto, | 29 | xmlto, |
289 | 35 | xsltproc, | 30 | xsltproc, |
291 | 36 | xtrans-dev | 31 | xtrans-dev, |
292 | 32 | libsystemd-login-dev (>= 183) [linux-any], | ||
293 | 33 | libsystemd-daemon-dev [linux-any], | ||
294 | 34 | libsystemd-journal-dev [linux-any] | ||
295 | 37 | Vcs-Bzr: http://bazaar.launchpad.net/~ubuntu-desktop/gnome-session/ubuntu | 35 | Vcs-Bzr: http://bazaar.launchpad.net/~ubuntu-desktop/gnome-session/ubuntu |
296 | 38 | 36 | ||
297 | 39 | Package: gnome-session | 37 | Package: gnome-session |
298 | 40 | Architecture: all | 38 | Architecture: all |
299 | 41 | Depends: ${misc:Depends}, | 39 | Depends: ${misc:Depends}, |
300 | 42 | gnome-settings-daemon (>= 3.0), | 40 | gnome-settings-daemon (>= 3.0), |
301 | 41 | gnome-shell (>= 3.0), | ||
302 | 43 | gnome-session-bin (>= ${binary:Version}), | 42 | gnome-session-bin (>= ${binary:Version}), |
303 | 44 | gnome-session-bin (<< ${gnome:NextVersion}), | 43 | gnome-session-bin (<< ${gnome:NextVersion}), |
304 | 45 | gnome-session-common (= ${binary:Version}) | 44 | gnome-session-common (= ${binary:Version}) |
305 | @@ -88,8 +87,11 @@ | |||
306 | 88 | ${misc:Depends}, | 87 | ${misc:Depends}, |
307 | 89 | dbus-x11, | 88 | dbus-x11, |
308 | 90 | gsettings-desktop-schemas, | 89 | gsettings-desktop-schemas, |
310 | 91 | upower (>= 0.9.0) | 90 | upower (>= 0.9.0), |
311 | 91 | # xwayland [linux-any] | ||
312 | 92 | Recommends: libpam-systemd [linux-any], consolekit [!linux-any] | ||
313 | 92 | Conflicts: gnome-session (<< 3.9.90-0ubuntu8) | 93 | Conflicts: gnome-session (<< 3.9.90-0ubuntu8) |
314 | 94 | Breaks: gdm (<< 3.8) | ||
315 | 93 | Description: GNOME Session Manager - Minimal runtime | 95 | Description: GNOME Session Manager - Minimal runtime |
316 | 94 | The GNOME Session Manager is in charge of starting the core components | 96 | The GNOME Session Manager is in charge of starting the core components |
317 | 95 | of the GNOME desktop, and applications that should be launched at | 97 | of the GNOME desktop, and applications that should be launched at |
318 | 96 | 98 | ||
319 | === modified file 'debian/defaults.list' | |||
320 | --- debian/defaults.list 2014-09-11 20:52:35 +0000 | |||
321 | +++ debian/defaults.list 2014-10-31 04:52:33 +0000 | |||
322 | @@ -64,84 +64,84 @@ | |||
323 | 64 | application/mbox=evolution.desktop | 64 | application/mbox=evolution.desktop |
324 | 65 | message/rfc822=evolution.desktop | 65 | message/rfc822=evolution.desktop |
325 | 66 | x-scheme-handler/mailto=evolution.desktop | 66 | x-scheme-handler/mailto=evolution.desktop |
404 | 67 | application/x-7z-compressed=file-roller.desktop | 67 | application/x-7z-compressed=org.gnome.FileRoller.desktop |
405 | 68 | application/x-7z-compressed-tar=file-roller.desktop | 68 | application/x-7z-compressed-tar=org.gnome.FileRoller.desktop |
406 | 69 | application/x-ace=file-roller.desktop | 69 | application/x-ace=org.gnome.FileRoller.desktop |
407 | 70 | application/x-alz=file-roller.desktop | 70 | application/x-alz=org.gnome.FileRoller.desktop |
408 | 71 | application/x-ar=file-roller.desktop | 71 | application/x-ar=org.gnome.FileRoller.desktop |
409 | 72 | application/x-arj=file-roller.desktop | 72 | application/x-arj=org.gnome.FileRoller.desktop |
410 | 73 | application/x-bzip=file-roller.desktop | 73 | application/x-bzip=org.gnome.FileRoller.desktop |
411 | 74 | application/x-bzip-compressed-tar=file-roller.desktop | 74 | application/x-bzip-compressed-tar=org.gnome.FileRoller.desktop |
412 | 75 | application/x-bzip1=file-roller.desktop | 75 | application/x-bzip1=org.gnome.FileRoller.desktop |
413 | 76 | application/x-bzip1-compressed-tar=file-roller.desktop | 76 | application/x-bzip1-compressed-tar=org.gnome.FileRoller.desktop |
414 | 77 | application/x-cabinet=file-roller.desktop | 77 | application/x-cabinet=org.gnome.FileRoller.desktop |
415 | 78 | application/x-cd-image=file-roller.desktop | 78 | application/x-cd-image=org.gnome.FileRoller.desktop |
416 | 79 | application/x-compress=file-roller.desktop | 79 | application/x-compress=org.gnome.FileRoller.desktop |
417 | 80 | application/x-compressed-tar=file-roller.desktop | 80 | application/x-compressed-tar=org.gnome.FileRoller.desktop |
418 | 81 | application/x-cpio=file-roller.desktop | 81 | application/x-cpio=org.gnome.FileRoller.desktop |
419 | 82 | application/x-deb=file-roller.desktop | 82 | application/x-deb=org.gnome.FileRoller.desktop |
420 | 83 | application/x-ear=file-roller.desktop | 83 | application/x-ear=org.gnome.FileRoller.desktop |
421 | 84 | application/x-gtar=file-roller.desktop | 84 | application/x-gtar=org.gnome.FileRoller.desktop |
422 | 85 | application/x-gzip=file-roller.desktop | 85 | application/x-gzip=org.gnome.FileRoller.desktop |
423 | 86 | application/x-java-archive=file-roller.desktop | 86 | application/x-java-archive=org.gnome.FileRoller.desktop |
424 | 87 | application/x-lha=file-roller.desktop | 87 | application/x-lha=org.gnome.FileRoller.desktop |
425 | 88 | application/x-lhz=file-roller.desktop | 88 | application/x-lhz=org.gnome.FileRoller.desktop |
426 | 89 | application/x-lzip=file-roller.desktop | 89 | application/x-lzip=org.gnome.FileRoller.desktop |
427 | 90 | application/x-lzip-compressed-tar=file-roller.desktop | 90 | application/x-lzip-compressed-tar=org.gnome.FileRoller.desktop |
428 | 91 | application/x-lzma=file-roller.desktop | 91 | application/x-lzma=org.gnome.FileRoller.desktop |
429 | 92 | application/x-lzma-compressed-tar=file-roller.desktop | 92 | application/x-lzma-compressed-tar=org.gnome.FileRoller.desktop |
430 | 93 | application/x-lzop=file-roller.desktop | 93 | application/x-lzop=org.gnome.FileRoller.desktop |
431 | 94 | application/x-lzop-compressed-tar=file-roller.desktop | 94 | application/x-lzop-compressed-tar=org.gnome.FileRoller.desktop |
432 | 95 | application/x-rar=file-roller.desktop | 95 | application/x-rar=org.gnome.FileRoller.desktop |
433 | 96 | application/x-rar-compressed=file-roller.desktop | 96 | application/x-rar-compressed=org.gnome.FileRoller.desktop |
434 | 97 | application/x-rpm=file-roller.desktop | 97 | application/x-rpm=org.gnome.FileRoller.desktop |
435 | 98 | application/x-rzip=file-roller.desktop | 98 | application/x-rzip=org.gnome.FileRoller.desktop |
436 | 99 | application/x-tar=file-roller.desktop | 99 | application/x-tar=org.gnome.FileRoller.desktop |
437 | 100 | application/x-tarz=file-roller.desktop | 100 | application/x-tarz=org.gnome.FileRoller.desktop |
438 | 101 | application/x-stuffit=file-roller.desktop | 101 | application/x-stuffit=org.gnome.FileRoller.desktop |
439 | 102 | application/x-war=file-roller.desktop | 102 | application/x-war=org.gnome.FileRoller.desktop |
440 | 103 | application/x-xz=file-roller.desktop | 103 | application/x-xz=org.gnome.FileRoller.desktop |
441 | 104 | application/x-xz-compressed-tar=file-roller.desktop | 104 | application/x-xz-compressed-tar=org.gnome.FileRoller.desktop |
442 | 105 | application/x-zip=file-roller.desktop | 105 | application/x-zip=org.gnome.FileRoller.desktop |
443 | 106 | application/x-zip-compressed=file-roller.desktop | 106 | application/x-zip-compressed=org.gnome.FileRoller.desktop |
444 | 107 | application/x-zoo=file-roller.desktop | 107 | application/x-zoo=org.gnome.FileRoller.desktop |
445 | 108 | application/zip=file-roller.desktop | 108 | application/zip=org.gnome.FileRoller.desktop |
446 | 109 | multipart/x-zip=file-roller.desktop | 109 | multipart/x-zip=org.gnome.FileRoller.desktop |
447 | 110 | text/plain=gedit.desktop | 110 | text/plain=org.gnome.gedit.desktop |
448 | 111 | text/css=gedit.desktop | 111 | text/css=org.gnome.gedit.desktop |
449 | 112 | text/javascript=gedit.desktop | 112 | text/javascript=org.gnome.gedit.desktop |
450 | 113 | text/mathml=gedit.desktop | 113 | text/mathml=org.gnome.gedit.desktop |
451 | 114 | text/x-c++hdr=gedit.desktop | 114 | text/x-c++hdr=org.gnome.gedit.desktop |
452 | 115 | text/x-c++src=gedit.desktop | 115 | text/x-c++src=org.gnome.gedit.desktop |
453 | 116 | text/x-csrc=gedit.desktop | 116 | text/x-csrc=org.gnome.gedit.desktop |
454 | 117 | text/x-chdr=gedit.desktop | 117 | text/x-chdr=org.gnome.gedit.desktop |
455 | 118 | text/x-dtd=gedit.desktop | 118 | text/x-dtd=org.gnome.gedit.desktop |
456 | 119 | text/x-java=gedit.desktop | 119 | text/x-java=org.gnome.gedit.desktop |
457 | 120 | text/x-javascript=gedit.desktop | 120 | text/x-javascript=org.gnome.gedit.desktop |
458 | 121 | text/x-makefile=gedit.desktop | 121 | text/x-makefile=org.gnome.gedit.desktop |
459 | 122 | text/x-moc=gedit.desktop | 122 | text/x-moc=org.gnome.gedit.desktop |
460 | 123 | text/x-pascal=gedit.desktop | 123 | text/x-pascal=org.gnome.gedit.desktop |
461 | 124 | text/x-patch=gedit.desktop | 124 | text/x-patch=org.gnome.gedit.desktop |
462 | 125 | text/x-perl=gedit.desktop | 125 | text/x-perl=org.gnome.gedit.desktop |
463 | 126 | text/x-php=gedit.desktop | 126 | text/x-php=org.gnome.gedit.desktop |
464 | 127 | text/x-python=gedit.desktop | 127 | text/x-python=org.gnome.gedit.desktop |
465 | 128 | text/x-sql=gedit.desktop | 128 | text/x-sql=org.gnome.gedit.desktop |
466 | 129 | text/x-tcl=gedit.desktop | 129 | text/x-tcl=org.gnome.gedit.desktop |
467 | 130 | text/x-tex=gedit.desktop | 130 | text/x-tex=org.gnome.gedit.desktop |
468 | 131 | text/xml=gedit.desktop | 131 | text/xml=org.gnome.gedit.desktop |
469 | 132 | application/javascript=gedit.desktop | 132 | application/javascript=org.gnome.gedit.desktop |
470 | 133 | application/x-cgi=gedit.desktop | 133 | application/x-cgi=org.gnome.gedit.desktop |
471 | 134 | application/x-javascript=gedit.desktop | 134 | application/x-javascript=org.gnome.gedit.desktop |
472 | 135 | application/x-perl=gedit.desktop | 135 | application/x-perl=org.gnome.gedit.desktop |
473 | 136 | application/x-php=gedit.desktop | 136 | application/x-php=org.gnome.gedit.desktop |
474 | 137 | application/x-python=gedit.desktop | 137 | application/x-python=org.gnome.gedit.desktop |
475 | 138 | application/x-shellscript=gedit.desktop | 138 | application/x-shellscript=org.gnome.gedit.desktop |
476 | 139 | application/xml=gedit.desktop | 139 | application/xml=org.gnome.gedit.desktop |
477 | 140 | application/xml-dtd=gedit.desktop | 140 | application/xml-dtd=org.gnome.gedit.desktop |
478 | 141 | application/x-font-ttf=gnome-font-viewer.desktop | 141 | application/x-font-ttf=org.gnome.font-viewer.desktop |
479 | 142 | application/x-font-pcf=gnome-font-viewer.desktop | 142 | application/x-font-pcf=org.gnome.font-viewer.desktop |
480 | 143 | application/x-font-type1=gnome-font-viewer.desktop | 143 | application/x-font-type1=org.gnome.font-viewer.desktop |
481 | 144 | application/x-font-otf=gnome-font-viewer.desktop | 144 | application/x-font-otf=org.gnome.font-viewer.desktop |
482 | 145 | application/x-gnumeric=gnumeric.desktop | 145 | application/x-gnumeric=gnumeric.desktop |
483 | 146 | application/tab-separated-values=gnumeric.desktop | 146 | application/tab-separated-values=gnumeric.desktop |
484 | 147 | text/tab-separated-values=gnumeric.desktop | 147 | text/tab-separated-values=gnumeric.desktop |
485 | @@ -218,130 +218,128 @@ | |||
486 | 218 | application/vnd.openxmlformats-officedocument.wordprocessingml.template=libreoffice-writer.desktop | 218 | application/vnd.openxmlformats-officedocument.wordprocessingml.template=libreoffice-writer.desktop |
487 | 219 | application/vnd.ms-word.template.macroenabled.12=libreoffice-writer.desktop | 219 | application/vnd.ms-word.template.macroenabled.12=libreoffice-writer.desktop |
488 | 220 | x-content/software=nautilus-autorun-software.desktop | 220 | x-content/software=nautilus-autorun-software.desktop |
491 | 221 | inode/directory=nautilus.desktop | 221 | inode/directory=org.gnome.Nautilus.desktop |
492 | 222 | application/x-gnome-saved-search=nautilus.desktop | 222 | application/x-gnome-saved-search=org.gnome.Nautilus.desktop |
493 | 223 | x-content/audio-player=rhythmbox.desktop | 223 | x-content/audio-player=rhythmbox.desktop |
494 | 224 | x-content/audio-cdda=sound-juicer.desktop | 224 | x-content/audio-cdda=sound-juicer.desktop |
615 | 225 | application/x-shockwave-flash=swfdec-player.desktop | 225 | application/mxf=org.gnome.Totem.desktop |
616 | 226 | application/futuresplash=swfdec-player.desktop | 226 | application/ogg=org.gnome.Totem.desktop |
617 | 227 | application/mxf=totem.desktop | 227 | application/ram=org.gnome.Totem.desktop |
618 | 228 | application/ogg=totem.desktop | 228 | application/sdp=org.gnome.Totem.desktop |
619 | 229 | application/ram=totem.desktop | 229 | application/smil=org.gnome.Totem.desktop |
620 | 230 | application/sdp=totem.desktop | 230 | application/smil+xml=org.gnome.Totem.desktop |
621 | 231 | application/smil=totem.desktop | 231 | application/vnd.ms-wpl=org.gnome.Totem.desktop |
622 | 232 | application/smil+xml=totem.desktop | 232 | application/vnd.rn-realmedia=org.gnome.Totem.desktop |
623 | 233 | application/vnd.ms-wpl=totem.desktop | 233 | application/x-extension-m4a=org.gnome.Totem.desktop |
624 | 234 | application/vnd.rn-realmedia=totem.desktop | 234 | application/x-extension-mp4=org.gnome.Totem.desktop |
625 | 235 | application/x-extension-m4a=totem.desktop | 235 | application/x-flac=org.gnome.Totem.desktop |
626 | 236 | application/x-extension-mp4=totem.desktop | 236 | application/x-flash-video=org.gnome.Totem.desktop |
627 | 237 | application/x-flac=totem.desktop | 237 | application/x-matroska=org.gnome.Totem.desktop |
628 | 238 | application/x-flash-video=totem.desktop | 238 | application/x-netshow-channel=org.gnome.Totem.desktop |
629 | 239 | application/x-matroska=totem.desktop | 239 | application/x-ogg=org.gnome.Totem.desktop |
630 | 240 | application/x-netshow-channel=totem.desktop | 240 | application/x-quicktime-media-link=org.gnome.Totem.desktop |
631 | 241 | application/x-ogg=totem.desktop | 241 | application/x-quicktimeplayer=org.gnome.Totem.desktop |
632 | 242 | application/x-quicktime-media-link=totem.desktop | 242 | application/x-shorten=org.gnome.Totem.desktop |
633 | 243 | application/x-quicktimeplayer=totem.desktop | 243 | application/x-smil=org.gnome.Totem.desktop |
634 | 244 | application/x-shorten=totem.desktop | 244 | application/xspf+xml=org.gnome.Totem.desktop |
635 | 245 | application/x-smil=totem.desktop | 245 | audio/3gpp=org.gnome.Totem.desktop |
636 | 246 | application/xspf+xml=totem.desktop | 246 | audio/ac3=org.gnome.Totem.desktop |
637 | 247 | audio/3gpp=totem.desktop | 247 | audio/AMR=org.gnome.Totem.desktop |
638 | 248 | audio/ac3=totem.desktop | 248 | audio/AMR-WB=org.gnome.Totem.desktop |
639 | 249 | audio/AMR=totem.desktop | 249 | audio/basic=org.gnome.Totem.desktop |
640 | 250 | audio/AMR-WB=totem.desktop | 250 | audio/flac=org.gnome.Totem.desktop |
641 | 251 | audio/basic=totem.desktop | 251 | audio/midi=org.gnome.Totem.desktop |
642 | 252 | audio/flac=totem.desktop | 252 | audio/mp4=org.gnome.Totem.desktop |
643 | 253 | audio/midi=totem.desktop | 253 | audio/mpeg=org.gnome.Totem.desktop |
644 | 254 | audio/mp4=totem.desktop | 254 | audio/mpegurl=org.gnome.Totem.desktop |
645 | 255 | audio/mpeg=totem.desktop | 255 | audio/ogg=org.gnome.Totem.desktop |
646 | 256 | audio/mpegurl=totem.desktop | 256 | audio/prs.sid=org.gnome.Totem.desktop |
647 | 257 | audio/ogg=totem.desktop | 257 | audio/vnd.rn-realaudio=org.gnome.Totem.desktop |
648 | 258 | audio/prs.sid=totem.desktop | 258 | audio/x-ape=org.gnome.Totem.desktop |
649 | 259 | audio/vnd.rn-realaudio=totem.desktop | 259 | audio/x-flac=org.gnome.Totem.desktop |
650 | 260 | audio/x-ape=totem.desktop | 260 | audio/x-gsm=org.gnome.Totem.desktop |
651 | 261 | audio/x-flac=totem.desktop | 261 | audio/x-it=org.gnome.Totem.desktop |
652 | 262 | audio/x-gsm=totem.desktop | 262 | audio/x-m4a=org.gnome.Totem.desktop |
653 | 263 | audio/x-it=totem.desktop | 263 | audio/x-matroska=org.gnome.Totem.desktop |
654 | 264 | audio/x-m4a=totem.desktop | 264 | audio/x-mod=org.gnome.Totem.desktop |
655 | 265 | audio/x-matroska=totem.desktop | 265 | audio/x-mp3=org.gnome.Totem.desktop |
656 | 266 | audio/x-mod=totem.desktop | 266 | audio/x-mpeg=org.gnome.Totem.desktop |
657 | 267 | audio/x-mp3=totem.desktop | 267 | audio/x-mpegurl=org.gnome.Totem.desktop |
658 | 268 | audio/x-mpeg=totem.desktop | 268 | audio/x-ms-asf=org.gnome.Totem.desktop |
659 | 269 | audio/x-mpegurl=totem.desktop | 269 | audio/x-ms-asx=org.gnome.Totem.desktop |
660 | 270 | audio/x-ms-asf=totem.desktop | 270 | audio/x-ms-wax=org.gnome.Totem.desktop |
661 | 271 | audio/x-ms-asx=totem.desktop | 271 | audio/x-ms-wma=org.gnome.Totem.desktop |
662 | 272 | audio/x-ms-wax=totem.desktop | 272 | audio/x-musepack=org.gnome.Totem.desktop |
663 | 273 | audio/x-ms-wma=totem.desktop | 273 | audio/x-pn-aiff=org.gnome.Totem.desktop |
664 | 274 | audio/x-musepack=totem.desktop | 274 | audio/x-pn-au=org.gnome.Totem.desktop |
665 | 275 | audio/x-pn-aiff=totem.desktop | 275 | audio/x-pn-realaudio=org.gnome.Totem.desktop |
666 | 276 | audio/x-pn-au=totem.desktop | 276 | audio/x-pn-realaudio-plugin=org.gnome.Totem.desktop |
667 | 277 | audio/x-pn-realaudio=totem.desktop | 277 | audio/x-pn-wav=org.gnome.Totem.desktop |
668 | 278 | audio/x-pn-realaudio-plugin=totem.desktop | 278 | audio/x-pn-windows-acm=org.gnome.Totem.desktop |
669 | 279 | audio/x-pn-wav=totem.desktop | 279 | audio/x-realaudio=org.gnome.Totem.desktop |
670 | 280 | audio/x-pn-windows-acm=totem.desktop | 280 | audio/x-real-audio=org.gnome.Totem.desktop |
671 | 281 | audio/x-realaudio=totem.desktop | 281 | audio/x-sbc=org.gnome.Totem.desktop |
672 | 282 | audio/x-real-audio=totem.desktop | 282 | audio/x-scpls=org.gnome.Totem.desktop |
673 | 283 | audio/x-sbc=totem.desktop | 283 | audio/x-speex=org.gnome.Totem.desktop |
674 | 284 | audio/x-scpls=totem.desktop | 284 | audio/x-tta=org.gnome.Totem.desktop |
675 | 285 | audio/x-speex=totem.desktop | 285 | audio/x-vorbis=org.gnome.Totem.desktop |
676 | 286 | audio/x-tta=totem.desktop | 286 | audio/x-vorbis+ogg=org.gnome.Totem.desktop |
677 | 287 | audio/x-vorbis=totem.desktop | 287 | audio/x-wav=org.gnome.Totem.desktop |
678 | 288 | audio/x-vorbis+ogg=totem.desktop | 288 | audio/x-wavpack=org.gnome.Totem.desktop |
679 | 289 | audio/x-wav=totem.desktop | 289 | audio/x-xm=org.gnome.Totem.desktop |
680 | 290 | audio/x-wavpack=totem.desktop | 290 | image/vnd.rn-realpix=org.gnome.Totem.desktop |
681 | 291 | audio/x-xm=totem.desktop | 291 | image/x-pict=org.gnome.Totem.desktop |
682 | 292 | image/vnd.rn-realpix=totem.desktop | 292 | misc/ultravox=org.gnome.Totem.desktop |
683 | 293 | image/x-pict=totem.desktop | 293 | text/google-video-pointer=org.gnome.Totem.desktop |
684 | 294 | misc/ultravox=totem.desktop | 294 | text/x-google-video-pointer=org.gnome.Totem.desktop |
685 | 295 | text/google-video-pointer=totem.desktop | 295 | video/3gpp=org.gnome.Totem.desktop |
686 | 296 | text/x-google-video-pointer=totem.desktop | 296 | video/dv=org.gnome.Totem.desktop |
687 | 297 | video/3gpp=totem.desktop | 297 | video/fli=org.gnome.Totem.desktop |
688 | 298 | video/dv=totem.desktop | 298 | video/flv=org.gnome.Totem.desktop |
689 | 299 | video/fli=totem.desktop | 299 | video/mp2t=org.gnome.Totem.desktop |
690 | 300 | video/flv=totem.desktop | 300 | video/mp4=org.gnome.Totem.desktop |
691 | 301 | video/mp2t=totem.desktop | 301 | video/mp4v-es=org.gnome.Totem.desktop |
692 | 302 | video/mp4=totem.desktop | 302 | video/mpeg=org.gnome.Totem.desktop |
693 | 303 | video/mp4v-es=totem.desktop | 303 | video/msvideo=org.gnome.Totem.desktop |
694 | 304 | video/mpeg=totem.desktop | 304 | video/ogg=org.gnome.Totem.desktop |
695 | 305 | video/msvideo=totem.desktop | 305 | video/quicktime=org.gnome.Totem.desktop |
696 | 306 | video/ogg=totem.desktop | 306 | video/vivo=org.gnome.Totem.desktop |
697 | 307 | video/quicktime=totem.desktop | 307 | video/vnd.divx=org.gnome.Totem.desktop |
698 | 308 | video/vivo=totem.desktop | 308 | video/vnd.rn-realvideo=org.gnome.Totem.desktop |
699 | 309 | video/vnd.divx=totem.desktop | 309 | video/vnd.vivo=org.gnome.Totem.desktop |
700 | 310 | video/vnd.rn-realvideo=totem.desktop | 310 | video/webm=org.gnome.Totem.desktop |
701 | 311 | video/vnd.vivo=totem.desktop | 311 | video/x-anim=org.gnome.Totem.desktop |
702 | 312 | video/webm=totem.desktop | 312 | video/x-avi=org.gnome.Totem.desktop |
703 | 313 | video/x-anim=totem.desktop | 313 | video/x-flc=org.gnome.Totem.desktop |
704 | 314 | video/x-avi=totem.desktop | 314 | video/x-fli=org.gnome.Totem.desktop |
705 | 315 | video/x-flc=totem.desktop | 315 | video/x-flic=org.gnome.Totem.desktop |
706 | 316 | video/x-fli=totem.desktop | 316 | video/x-flv=org.gnome.Totem.desktop |
707 | 317 | video/x-flic=totem.desktop | 317 | video/x-m4v=org.gnome.Totem.desktop |
708 | 318 | video/x-flv=totem.desktop | 318 | video/x-matroska=org.gnome.Totem.desktop |
709 | 319 | video/x-m4v=totem.desktop | 319 | video/x-mpeg=org.gnome.Totem.desktop |
710 | 320 | video/x-matroska=totem.desktop | 320 | video/x-ms-asf=org.gnome.Totem.desktop |
711 | 321 | video/x-mpeg=totem.desktop | 321 | video/x-ms-asx=org.gnome.Totem.desktop |
712 | 322 | video/x-ms-asf=totem.desktop | 322 | video/x-msvideo=org.gnome.Totem.desktop |
713 | 323 | video/x-ms-asx=totem.desktop | 323 | video/x-ms-wm=org.gnome.Totem.desktop |
714 | 324 | video/x-msvideo=totem.desktop | 324 | video/x-ms-wmv=org.gnome.Totem.desktop |
715 | 325 | video/x-ms-wm=totem.desktop | 325 | video/x-ms-wmx=org.gnome.Totem.desktop |
716 | 326 | video/x-ms-wmv=totem.desktop | 326 | video/x-ms-wvx=org.gnome.Totem.desktop |
717 | 327 | video/x-ms-wmx=totem.desktop | 327 | video/x-nsv=org.gnome.Totem.desktop |
718 | 328 | video/x-ms-wvx=totem.desktop | 328 | video/x-ogm+ogg=org.gnome.Totem.desktop |
719 | 329 | video/x-nsv=totem.desktop | 329 | video/x-theora+ogg=org.gnome.Totem.desktop |
720 | 330 | video/x-ogm+ogg=totem.desktop | 330 | video/x-totem-stream=org.gnome.Totem.desktop |
721 | 331 | video/x-theora+ogg=totem.desktop | 331 | x-content/video-dvd=org.gnome.Totem.desktop |
722 | 332 | video/x-totem-stream=totem.desktop | 332 | x-content/video-vcd=org.gnome.Totem.desktop |
723 | 333 | x-content/video-dvd=totem.desktop | 333 | x-content/video-svcd=org.gnome.Totem.desktop |
724 | 334 | x-content/video-vcd=totem.desktop | 334 | x-scheme-handler/pnm=org.gnome.Totem.desktop |
725 | 335 | x-content/video-svcd=totem.desktop | 335 | x-scheme-handler/mms=org.gnome.Totem.desktop |
726 | 336 | x-scheme-handler/pnm=totem.desktop | 336 | x-scheme-handler/net=org.gnome.Totem.desktop |
727 | 337 | x-scheme-handler/mms=totem.desktop | 337 | x-scheme-handler/rtp=org.gnome.Totem.desktop |
728 | 338 | x-scheme-handler/net=totem.desktop | 338 | x-scheme-handler/rtsp=org.gnome.Totem.desktop |
729 | 339 | x-scheme-handler/rtp=totem.desktop | 339 | x-scheme-handler/mmsh=org.gnome.Totem.desktop |
730 | 340 | x-scheme-handler/rtsp=totem.desktop | 340 | x-scheme-handler/uvox=org.gnome.Totem.desktop |
731 | 341 | x-scheme-handler/mmsh=totem.desktop | 341 | x-scheme-handler/icy=org.gnome.Totem.desktop |
732 | 342 | x-scheme-handler/uvox=totem.desktop | 342 | x-scheme-handler/icyx=org.gnome.Totem.desktop |
613 | 343 | x-scheme-handler/icy=totem.desktop | ||
614 | 344 | x-scheme-handler/icyx=totem.desktop | ||
733 | 345 | x-scheme-handler/ghelp=yelp.desktop | 343 | x-scheme-handler/ghelp=yelp.desktop |
734 | 346 | x-scheme-handler/help=yelp.desktop | 344 | x-scheme-handler/help=yelp.desktop |
735 | 347 | x-scheme-handler/info=yelp.desktop | 345 | x-scheme-handler/info=yelp.desktop |
736 | 348 | 346 | ||
737 | === added file 'debian/gnome-session-common.dirs' | |||
738 | --- debian/gnome-session-common.dirs 1970-01-01 00:00:00 +0000 | |||
739 | +++ debian/gnome-session-common.dirs 2014-10-31 04:52:33 +0000 | |||
740 | @@ -0,0 +1,1 @@ | |||
741 | 1 | usr/share/gnome/applications | ||
742 | 0 | 2 | ||
743 | === modified file 'debian/gnome-session-common.install' | |||
744 | --- debian/gnome-session-common.install 2012-05-07 02:35:47 +0000 | |||
745 | +++ debian/gnome-session-common.install 2014-10-31 04:52:33 +0000 | |||
746 | @@ -3,3 +3,4 @@ | |||
747 | 3 | usr/share/locale | 3 | usr/share/locale |
748 | 4 | debian/55gnome-session_gnomerc etc/X11/Xsession.d | 4 | debian/55gnome-session_gnomerc etc/X11/Xsession.d |
749 | 5 | #debian/defaults.list etc/gnome | 5 | #debian/defaults.list etc/gnome |
750 | 6 | |||
751 | 6 | 7 | ||
752 | === modified file 'debian/gnome-session.install' | |||
753 | --- debian/gnome-session.install 2014-02-20 02:02:54 +0000 | |||
754 | +++ debian/gnome-session.install 2014-10-31 04:52:33 +0000 | |||
755 | @@ -1,3 +1,5 @@ | |||
756 | 1 | usr/share/doc | 1 | usr/share/doc |
757 | 2 | usr/share/xsessions/gnome.desktop | 2 | usr/share/xsessions/gnome.desktop |
758 | 3 | usr/share/gnome-session/sessions/gnome.session | 3 | usr/share/gnome-session/sessions/gnome.session |
759 | 4 | #usr/share/gnome-session/sessions/gnome-wayland.session | ||
760 | 5 | #usr/share/wayland-sessions/gnome-wayland.desktop | ||
761 | 4 | 6 | ||
762 | === removed file 'debian/patches/01_gnome-wm.patch' | |||
763 | --- debian/patches/01_gnome-wm.patch 2011-05-23 14:00:56 +0000 | |||
764 | +++ debian/patches/01_gnome-wm.patch 1970-01-01 00:00:00 +0000 | |||
765 | @@ -1,11 +0,0 @@ | |||
766 | 1 | Index: gnome-session-3.0.0/data/gnome-fallback.session.desktop.in.in | ||
767 | 2 | =================================================================== | ||
768 | 3 | --- gnome-session-3.0.0.orig/data/gnome-fallback.session.desktop.in.in 2011-04-20 21:19:19.751604438 +0200 | ||
769 | 4 | +++ gnome-session-3.0.0/data/gnome-fallback.session.desktop.in.in 2011-04-20 21:19:24.495627620 +0200 | ||
770 | 5 | @@ -2,5 +2,5 @@ | ||
771 | 6 | _Name=GNOME fallback | ||
772 | 7 | RequiredComponents=gnome-panel;gnome-settings-daemon; | ||
773 | 8 | RequiredProviders=windowmanager;notifications; | ||
774 | 9 | -DefaultProvider-windowmanager=metacity | ||
775 | 10 | +DefaultProvider-windowmanager=gnome-wm | ||
776 | 11 | DefaultProvider-notifications=notification-daemon | ||
777 | 12 | 0 | ||
778 | === removed file 'debian/patches/02_fallback_desktop.patch' | |||
779 | --- debian/patches/02_fallback_desktop.patch 2012-05-07 02:35:47 +0000 | |||
780 | +++ debian/patches/02_fallback_desktop.patch 1970-01-01 00:00:00 +0000 | |||
781 | @@ -1,12 +0,0 @@ | |||
782 | 1 | Index: gnome-session-3.0.2/data/gnome-fallback.desktop.in | ||
783 | 2 | =================================================================== | ||
784 | 3 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 | ||
785 | 4 | +++ gnome-session-3.0.2/data/gnome-fallback.desktop.in 2011-11-04 20:06:03.653307488 +0100 | ||
786 | 5 | @@ -0,0 +1,7 @@ | ||
787 | 6 | +[Desktop Entry] | ||
788 | 7 | +_Name=GNOME Classic | ||
789 | 8 | +_Comment=This session logs you into GNOME | ||
790 | 9 | +Exec=gnome-session-fallback | ||
791 | 10 | +TryExec=gnome-session | ||
792 | 11 | +Icon= | ||
793 | 12 | +Type=Application | ||
794 | 13 | 0 | ||
795 | === removed file 'debian/patches/03_fallback_desktop_makefile.patch' | |||
796 | --- debian/patches/03_fallback_desktop_makefile.patch 2012-05-07 02:35:47 +0000 | |||
797 | +++ debian/patches/03_fallback_desktop_makefile.patch 1970-01-01 00:00:00 +0000 | |||
798 | @@ -1,13 +0,0 @@ | |||
799 | 1 | Index: gnome-session-3.4.0/data/Makefile.am | ||
800 | 2 | =================================================================== | ||
801 | 3 | --- gnome-session-3.4.0.orig/data/Makefile.am 2011-10-21 16:35:39.000000000 +0200 | ||
802 | 4 | +++ gnome-session-3.4.0/data/Makefile.am 2012-04-06 23:20:36.422851504 +0200 | ||
803 | 5 | @@ -9,7 +9,7 @@ | ||
804 | 6 | hwcompat_DATA = hardware-compatibility | ||
805 | 7 | |||
806 | 8 | xsessiondir = $(datadir)/xsessions | ||
807 | 9 | -xsession_in_files = gnome.desktop.in | ||
808 | 10 | +xsession_in_files = gnome.desktop.in gnome-fallback.desktop.in | ||
809 | 11 | xsession_DATA = $(xsession_in_files:.desktop.in=.desktop) | ||
810 | 12 | |||
811 | 13 | desktopdir = $(datadir)/applications | ||
812 | 14 | 0 | ||
813 | === removed file 'debian/patches/101_screen_lock_on_suspend.patch' | |||
814 | --- debian/patches/101_screen_lock_on_suspend.patch 2010-12-06 12:26:37 +0000 | |||
815 | +++ debian/patches/101_screen_lock_on_suspend.patch 1970-01-01 00:00:00 +0000 | |||
816 | @@ -1,92 +0,0 @@ | |||
817 | 1 | Description: Use the same logic as gnome-power-manager for deciding the "screen lock on suspend" policy. This restores the Jaunty behaviour rather than just using the screensaver settings, which is surprising for users | ||
818 | 2 | Bug: https://bugzilla.gnome.org/show_bug.cgi?id=598118 | ||
819 | 3 | Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/karmic/+source/gnome-session/+bug/446191 | ||
820 | 4 | |||
821 | 5 | Index: gnome-session-2.32.1/gnome-session/gsm-manager.c | ||
822 | 6 | =================================================================== | ||
823 | 7 | --- gnome-session-2.32.1.orig/gnome-session/gsm-manager.c 2010-12-06 13:26:17.733212002 +0100 | ||
824 | 8 | +++ gnome-session-2.32.1/gnome-session/gsm-manager.c 2010-12-06 13:26:17.829212002 +0100 | ||
825 | 9 | @@ -85,6 +85,9 @@ | ||
826 | 10 | #define KEY_AUTOSAVE KEY_GNOME_SESSION_DIR "/auto_save_session" | ||
827 | 11 | |||
828 | 12 | #define KEY_SLEEP_LOCK "/apps/gnome-screensaver/lock_enabled" | ||
829 | 13 | +#define KEY_SLEEP_LOCK_USE_SCREENSAVER "/apps/gnome-power-manager/lock/use_screensaver_settings" | ||
830 | 14 | +#define GPM_CONF_LOCK_ON_SUSPEND "/apps/gnome-power-manager/lock/suspend" | ||
831 | 15 | +#define GPM_CONF_LOCK_ON_HIBERNATE "/apps/gnome-power-manager/lock/hibernate" | ||
832 | 16 | |||
833 | 17 | typedef enum | ||
834 | 18 | { | ||
835 | 19 | @@ -975,18 +978,33 @@ | ||
836 | 20 | } | ||
837 | 21 | |||
838 | 22 | static gboolean | ||
839 | 23 | -sleep_lock_is_enabled (GsmManager *manager) | ||
840 | 24 | +sleep_lock_is_enabled (GsmManager *manager, | ||
841 | 25 | + const gchar *policy) | ||
842 | 26 | { | ||
843 | 27 | - GError *error; | ||
844 | 28 | - gboolean enable_lock; | ||
845 | 29 | + GError *error; | ||
846 | 30 | + gboolean enable_lock; | ||
847 | 31 | + gboolean use_ss_setting; | ||
848 | 32 | + const gchar *real_policy; | ||
849 | 33 | |||
850 | 34 | error = NULL; | ||
851 | 35 | + use_ss_setting = gconf_client_get_bool (manager->priv->gconf_client, | ||
852 | 36 | + KEY_SLEEP_LOCK_USE_SCREENSAVER, &error); | ||
853 | 37 | + if (error) { | ||
854 | 38 | + g_warning ("Error retrieving configuration key '%s': %s", | ||
855 | 39 | + KEY_SLEEP_LOCK_USE_SCREENSAVER, error->message); | ||
856 | 40 | + g_error_free (error); | ||
857 | 41 | + | ||
858 | 42 | + use_ss_setting = FALSE; | ||
859 | 43 | + } | ||
860 | 44 | + | ||
861 | 45 | + real_policy = (use_ss_setting ? KEY_SLEEP_LOCK : policy); | ||
862 | 46 | + | ||
863 | 47 | enable_lock = gconf_client_get_bool (manager->priv->gconf_client, | ||
864 | 48 | - KEY_SLEEP_LOCK, &error); | ||
865 | 49 | + real_policy, &error); | ||
866 | 50 | |||
867 | 51 | if (error) { | ||
868 | 52 | g_warning ("Error retrieving configuration key '%s': %s", | ||
869 | 53 | - KEY_SLEEP_LOCK, error->message); | ||
870 | 54 | + real_policy, error->message); | ||
871 | 55 | g_error_free (error); | ||
872 | 56 | |||
873 | 57 | /* If we fail to query gconf key, just enable locking */ | ||
874 | 58 | @@ -997,13 +1015,14 @@ | ||
875 | 59 | } | ||
876 | 60 | |||
877 | 61 | static void | ||
878 | 62 | -manager_perhaps_lock (GsmManager *manager) | ||
879 | 63 | +manager_perhaps_lock (GsmManager *manager, | ||
880 | 64 | + const gchar *policy) | ||
881 | 65 | { | ||
882 | 66 | GError *error; | ||
883 | 67 | gboolean ret; | ||
884 | 68 | |||
885 | 69 | /* only lock if gnome-screensaver is set to lock */ | ||
886 | 70 | - if (!sleep_lock_is_enabled (manager)) { | ||
887 | 71 | + if (!sleep_lock_is_enabled (manager, policy)) { | ||
888 | 72 | return; | ||
889 | 73 | } | ||
890 | 74 | |||
891 | 75 | @@ -1035,7 +1054,7 @@ | ||
892 | 76 | if (can_hibernate) { | ||
893 | 77 | |||
894 | 78 | /* lock the screen before we suspend */ | ||
895 | 79 | - manager_perhaps_lock (manager); | ||
896 | 80 | + manager_perhaps_lock (manager, GPM_CONF_LOCK_ON_HIBERNATE); | ||
897 | 81 | |||
898 | 82 | error = NULL; | ||
899 | 83 | ret = up_client_hibernate_sync (manager->priv->up_client, NULL, &error); | ||
900 | 84 | @@ -1059,7 +1078,7 @@ | ||
901 | 85 | if (can_suspend) { | ||
902 | 86 | |||
903 | 87 | /* lock the screen before we suspend */ | ||
904 | 88 | - manager_perhaps_lock (manager); | ||
905 | 89 | + manager_perhaps_lock (manager, GPM_CONF_LOCK_ON_SUSPEND); | ||
906 | 90 | |||
907 | 91 | error = NULL; | ||
908 | 92 | ret = up_client_suspend_sync (manager->priv->up_client, NULL, &error); | ||
909 | 93 | 0 | ||
910 | === removed file 'debian/patches/10_session_save.patch' | |||
911 | --- debian/patches/10_session_save.patch 2011-05-23 14:00:56 +0000 | |||
912 | +++ debian/patches/10_session_save.patch 1970-01-01 00:00:00 +0000 | |||
913 | @@ -1,536 +0,0 @@ | |||
914 | 1 | Based on the patch in GNOME #575544 | ||
915 | 2 | |||
916 | 3 | Index: gnome-session-3.0.0/gnome-session/gsm-manager.c | ||
917 | 4 | =================================================================== | ||
918 | 5 | --- gnome-session-3.0.0.orig/gnome-session/gsm-manager.c 2011-03-30 09:47:33.000000000 +0200 | ||
919 | 6 | +++ gnome-session-3.0.0/gnome-session/gsm-manager.c 2011-04-20 21:13:32.237905522 +0200 | ||
920 | 7 | @@ -79,6 +79,7 @@ | ||
921 | 8 | * let's make this fairly long. | ||
922 | 9 | */ | ||
923 | 10 | #define GSM_MANAGER_PHASE_TIMEOUT 30 /* seconds */ | ||
924 | 11 | +#define GSM_MANAGER_SAVE_SESSION_TIMEOUT 2 | ||
925 | 12 | |||
926 | 13 | #define GDM_FLEXISERVER_COMMAND "gdmflexiserver" | ||
927 | 14 | #define GDM_FLEXISERVER_ARGS "--startnew Standard" | ||
928 | 15 | @@ -1405,6 +1406,69 @@ query_end_session_complete (GsmManager * | ||
929 | 16 | |||
930 | 17 | } | ||
931 | 18 | |||
932 | 19 | +static gboolean | ||
933 | 20 | +_client_request_save (GsmClient *client, | ||
934 | 21 | + ClientEndSessionData *data) | ||
935 | 22 | +{ | ||
936 | 23 | + gboolean ret; | ||
937 | 24 | + GError *error; | ||
938 | 25 | + | ||
939 | 26 | + error = NULL; | ||
940 | 27 | + ret = gsm_client_request_save (client, data->flags, &error); | ||
941 | 28 | + if (ret) { | ||
942 | 29 | + g_debug ("GsmManager: adding client to query clients: %s", gsm_client_peek_id (client)); | ||
943 | 30 | + data->manager->priv->query_clients = g_slist_prepend (data->manager->priv->query_clients, | ||
944 | 31 | + client); | ||
945 | 32 | + } else if (error) { | ||
946 | 33 | + g_debug ("GsmManager: unable to query client: %s", error->message); | ||
947 | 34 | + g_error_free (error); | ||
948 | 35 | + } | ||
949 | 36 | + | ||
950 | 37 | + return FALSE; | ||
951 | 38 | +} | ||
952 | 39 | + | ||
953 | 40 | +static gboolean | ||
954 | 41 | +_client_request_save_helper (const char *id, | ||
955 | 42 | + GsmClient *client, | ||
956 | 43 | + ClientEndSessionData *data) | ||
957 | 44 | +{ | ||
958 | 45 | + return _client_request_save (client, data); | ||
959 | 46 | +} | ||
960 | 47 | + | ||
961 | 48 | +static void | ||
962 | 49 | +query_save_session_complete (GsmManager *manager) | ||
963 | 50 | +{ | ||
964 | 51 | + GError *error = NULL; | ||
965 | 52 | + | ||
966 | 53 | + if (g_slist_length (manager->priv->next_query_clients) > 0) { | ||
967 | 54 | + ClientEndSessionData data; | ||
968 | 55 | + | ||
969 | 56 | + data.manager = manager; | ||
970 | 57 | + data.flags = GSM_CLIENT_END_SESSION_FLAG_LAST; | ||
971 | 58 | + | ||
972 | 59 | + g_slist_foreach (manager->priv->next_query_clients, | ||
973 | 60 | + (GFunc)_client_request_save, | ||
974 | 61 | + &data); | ||
975 | 62 | + | ||
976 | 63 | + g_slist_free (manager->priv->next_query_clients); | ||
977 | 64 | + manager->priv->next_query_clients = NULL; | ||
978 | 65 | + | ||
979 | 66 | + return; | ||
980 | 67 | + } | ||
981 | 68 | + | ||
982 | 69 | + if (manager->priv->query_timeout_id > 0) { | ||
983 | 70 | + g_source_remove (manager->priv->query_timeout_id); | ||
984 | 71 | + manager->priv->query_timeout_id = 0; | ||
985 | 72 | + } | ||
986 | 73 | + | ||
987 | 74 | + gsm_session_save (manager->priv->clients, &error); | ||
988 | 75 | + | ||
989 | 76 | + if (error) { | ||
990 | 77 | + g_warning ("Error saving session: %s", error->message); | ||
991 | 78 | + g_error_free (error); | ||
992 | 79 | + } | ||
993 | 80 | +} | ||
994 | 81 | + | ||
995 | 82 | static guint32 | ||
996 | 83 | generate_cookie (void) | ||
997 | 84 | { | ||
998 | 85 | @@ -1485,6 +1549,21 @@ _on_query_end_session_timeout (GsmManage | ||
999 | 86 | return FALSE; | ||
1000 | 87 | } | ||
1001 | 88 | |||
1002 | 89 | +static gboolean | ||
1003 | 90 | +_on_query_save_session_timeout (GsmManager *manager) | ||
1004 | 91 | +{ | ||
1005 | 92 | + manager->priv->query_timeout_id = 0; | ||
1006 | 93 | + | ||
1007 | 94 | + g_debug ("GsmManager: query to save session timed out"); | ||
1008 | 95 | + | ||
1009 | 96 | + g_slist_free (manager->priv->query_clients); | ||
1010 | 97 | + manager->priv->query_clients = NULL; | ||
1011 | 98 | + | ||
1012 | 99 | + query_save_session_complete (manager); | ||
1013 | 100 | + | ||
1014 | 101 | + return FALSE; | ||
1015 | 102 | +} | ||
1016 | 103 | + | ||
1017 | 104 | static void | ||
1018 | 105 | do_phase_query_end_session (GsmManager *manager) | ||
1019 | 106 | { | ||
1020 | 107 | @@ -2160,13 +2239,32 @@ _handle_client_end_session_response (Gsm | ||
1021 | 108 | gboolean cancel, | ||
1022 | 109 | const char *reason) | ||
1023 | 110 | { | ||
1024 | 111 | - /* just ignore if received outside of shutdown */ | ||
1025 | 112 | - if (manager->priv->phase < GSM_MANAGER_PHASE_QUERY_END_SESSION) { | ||
1026 | 113 | + /* just ignore if we are not yet running */ | ||
1027 | 114 | + if (manager->priv->phase < GSM_MANAGER_PHASE_RUNNING) { | ||
1028 | 115 | return; | ||
1029 | 116 | } | ||
1030 | 117 | |||
1031 | 118 | g_debug ("GsmManager: Response from end session request: is-ok=%d do-last=%d cancel=%d reason=%s", is_ok, do_last, cancel, reason ? reason :""); | ||
1032 | 119 | |||
1033 | 120 | + if (manager->priv->phase == GSM_MANAGER_PHASE_RUNNING) { | ||
1034 | 121 | + /* Ignore responses when no requests were sent */ | ||
1035 | 122 | + if (manager->priv->query_clients == NULL) { | ||
1036 | 123 | + return; | ||
1037 | 124 | + } | ||
1038 | 125 | + | ||
1039 | 126 | + manager->priv->query_clients = g_slist_remove (manager->priv->query_clients, client); | ||
1040 | 127 | + | ||
1041 | 128 | + if (do_last) { | ||
1042 | 129 | + manager->priv->next_query_clients = g_slist_prepend (manager->priv->next_query_clients, | ||
1043 | 130 | + client); | ||
1044 | 131 | + } | ||
1045 | 132 | + | ||
1046 | 133 | + if (manager->priv->query_clients == NULL) { | ||
1047 | 134 | + query_save_session_complete (manager); | ||
1048 | 135 | + } | ||
1049 | 136 | + return; | ||
1050 | 137 | + } | ||
1051 | 138 | + | ||
1052 | 139 | if (cancel) { | ||
1053 | 140 | cancel_end_session (manager); | ||
1054 | 141 | return; | ||
1055 | 142 | @@ -2281,6 +2379,15 @@ on_xsmp_client_logout_request (GsmXSMPCl | ||
1056 | 143 | } | ||
1057 | 144 | |||
1058 | 145 | static void | ||
1059 | 146 | +on_xsmp_client_save_request (GsmXSMPClient *client, | ||
1060 | 147 | + gboolean show_dialog, | ||
1061 | 148 | + GsmManager *manager) | ||
1062 | 149 | +{ | ||
1063 | 150 | + g_debug ("GsmManager: save_request"); | ||
1064 | 151 | + gsm_manager_save_session (manager, NULL); | ||
1065 | 152 | +} | ||
1066 | 153 | + | ||
1067 | 154 | +static void | ||
1068 | 155 | on_store_client_added (GsmStore *store, | ||
1069 | 156 | const char *id, | ||
1070 | 157 | GsmManager *manager) | ||
1071 | 158 | @@ -2301,6 +2408,10 @@ on_store_client_added (GsmStore *store | ||
1072 | 159 | "logout-request", | ||
1073 | 160 | G_CALLBACK (on_xsmp_client_logout_request), | ||
1074 | 161 | manager); | ||
1075 | 162 | + g_signal_connect (client, | ||
1076 | 163 | + "save-request", | ||
1077 | 164 | + G_CALLBACK (on_xsmp_client_save_request), | ||
1078 | 165 | + manager); | ||
1079 | 166 | } | ||
1080 | 167 | |||
1081 | 168 | g_signal_connect (client, | ||
1082 | 169 | @@ -3324,6 +3435,41 @@ gsm_manager_shutdown (GsmManager *manage | ||
1083 | 170 | } | ||
1084 | 171 | |||
1085 | 172 | gboolean | ||
1086 | 173 | +gsm_manager_save_session (GsmManager *manager, | ||
1087 | 174 | + GError **error) | ||
1088 | 175 | +{ | ||
1089 | 176 | + ClientEndSessionData data; | ||
1090 | 177 | + | ||
1091 | 178 | + g_debug ("GsmManager: SaveSession called"); | ||
1092 | 179 | + | ||
1093 | 180 | + g_return_val_if_fail (GSM_IS_MANAGER (manager), FALSE); | ||
1094 | 181 | + | ||
1095 | 182 | + if (manager->priv->phase != GSM_MANAGER_PHASE_RUNNING) { | ||
1096 | 183 | + g_set_error (error, | ||
1097 | 184 | + GSM_MANAGER_ERROR, | ||
1098 | 185 | + GSM_MANAGER_ERROR_NOT_IN_RUNNING, | ||
1099 | 186 | + "SaveSession interface is only available during the Running phase"); | ||
1100 | 187 | + return FALSE; | ||
1101 | 188 | + } | ||
1102 | 189 | + | ||
1103 | 190 | + data.manager = manager; | ||
1104 | 191 | + data.flags = 0; | ||
1105 | 192 | + gsm_store_foreach (manager->priv->clients, | ||
1106 | 193 | + (GsmStoreFunc)_client_request_save_helper, | ||
1107 | 194 | + &data); | ||
1108 | 195 | + | ||
1109 | 196 | + if (manager->priv->query_clients) { | ||
1110 | 197 | + manager->priv->query_timeout_id = g_timeout_add_seconds (GSM_MANAGER_SAVE_SESSION_TIMEOUT, | ||
1111 | 198 | + (GSourceFunc)_on_query_save_session_timeout, | ||
1112 | 199 | + manager); | ||
1113 | 200 | + return TRUE; | ||
1114 | 201 | + } else { | ||
1115 | 202 | + g_debug ("GsmManager: Nothing to save"); | ||
1116 | 203 | + return FALSE; | ||
1117 | 204 | + } | ||
1118 | 205 | +} | ||
1119 | 206 | + | ||
1120 | 207 | +gboolean | ||
1121 | 208 | gsm_manager_can_shutdown (GsmManager *manager, | ||
1122 | 209 | gboolean *shutdown_available, | ||
1123 | 210 | GError **error) | ||
1124 | 211 | Index: gnome-session-3.0.0/gnome-session/gsm-manager.h | ||
1125 | 212 | =================================================================== | ||
1126 | 213 | --- gnome-session-3.0.0.orig/gnome-session/gsm-manager.h 2011-03-22 21:31:43.000000000 +0100 | ||
1127 | 214 | +++ gnome-session-3.0.0/gnome-session/gsm-manager.h 2011-04-20 21:12:54.057718875 +0200 | ||
1128 | 215 | @@ -164,6 +164,9 @@ gboolean gsm_manager_is_inhib | ||
1129 | 216 | gboolean gsm_manager_shutdown (GsmManager *manager, | ||
1130 | 217 | GError **error); | ||
1131 | 218 | |||
1132 | 219 | +gboolean gsm_manager_save_session (GsmManager *manager, | ||
1133 | 220 | + GError **error); | ||
1134 | 221 | + | ||
1135 | 222 | gboolean gsm_manager_can_shutdown (GsmManager *manager, | ||
1136 | 223 | gboolean *shutdown_available, | ||
1137 | 224 | GError **error); | ||
1138 | 225 | Index: gnome-session-3.0.0/gnome-session/gsm-xsmp-client.c | ||
1139 | 226 | =================================================================== | ||
1140 | 227 | --- gnome-session-3.0.0.orig/gnome-session/gsm-xsmp-client.c 2011-03-22 21:31:43.000000000 +0100 | ||
1141 | 228 | +++ gnome-session-3.0.0/gnome-session/gsm-xsmp-client.c 2011-04-20 21:12:54.057718875 +0200 | ||
1142 | 229 | @@ -68,6 +68,7 @@ enum { | ||
1143 | 230 | enum { | ||
1144 | 231 | REGISTER_REQUEST, | ||
1145 | 232 | LOGOUT_REQUEST, | ||
1146 | 233 | + SAVE_REQUEST, | ||
1147 | 234 | LAST_SIGNAL | ||
1148 | 235 | }; | ||
1149 | 236 | |||
1150 | 237 | @@ -501,6 +502,30 @@ xsmp_cancel_end_session (GsmClient *clie | ||
1151 | 238 | return TRUE; | ||
1152 | 239 | } | ||
1153 | 240 | |||
1154 | 241 | +static gboolean | ||
1155 | 242 | +xsmp_request_save (GsmClient *client, | ||
1156 | 243 | + guint flags, | ||
1157 | 244 | + GError **error) | ||
1158 | 245 | +{ | ||
1159 | 246 | + GsmXSMPClient *xsmp = (GsmXSMPClient *) client; | ||
1160 | 247 | + | ||
1161 | 248 | + g_debug ("GsmXSMPClient: xsmp_request_save ('%s')", xsmp->priv->description); | ||
1162 | 249 | + | ||
1163 | 250 | + if (xsmp->priv->conn == NULL) { | ||
1164 | 251 | + g_set_error (error, | ||
1165 | 252 | + GSM_CLIENT_ERROR, | ||
1166 | 253 | + GSM_CLIENT_ERROR_NOT_REGISTERED, | ||
1167 | 254 | + "Client is not registered"); | ||
1168 | 255 | + return FALSE; | ||
1169 | 256 | + } | ||
1170 | 257 | + | ||
1171 | 258 | + if (flags & GSM_CLIENT_END_SESSION_FLAG_LAST) | ||
1172 | 259 | + xsmp_save_yourself_phase2 (client); | ||
1173 | 260 | + else | ||
1174 | 261 | + do_save_yourself (xsmp, SmSaveLocal, FALSE); | ||
1175 | 262 | + | ||
1176 | 263 | + return TRUE; | ||
1177 | 264 | +} | ||
1178 | 265 | static char * | ||
1179 | 266 | get_desktop_file_path (GsmXSMPClient *client) | ||
1180 | 267 | { | ||
1181 | 268 | @@ -970,6 +995,7 @@ gsm_xsmp_client_class_init (GsmXSMPClien | ||
1182 | 269 | object_class->get_property = gsm_xsmp_client_get_property; | ||
1183 | 270 | object_class->set_property = gsm_xsmp_client_set_property; | ||
1184 | 271 | |||
1185 | 272 | + client_class->impl_request_save = xsmp_request_save; | ||
1186 | 273 | client_class->impl_save = xsmp_save; | ||
1187 | 274 | client_class->impl_stop = xsmp_stop; | ||
1188 | 275 | client_class->impl_query_end_session = xsmp_query_end_session; | ||
1189 | 276 | @@ -997,6 +1023,17 @@ gsm_xsmp_client_class_init (GsmXSMPClien | ||
1190 | 277 | NULL, | ||
1191 | 278 | NULL, | ||
1192 | 279 | g_cclosure_marshal_VOID__BOOLEAN, | ||
1193 | 280 | + G_TYPE_NONE, | ||
1194 | 281 | + 1, G_TYPE_BOOLEAN); | ||
1195 | 282 | + | ||
1196 | 283 | + signals[SAVE_REQUEST] = | ||
1197 | 284 | + g_signal_new ("save-request", | ||
1198 | 285 | + G_OBJECT_CLASS_TYPE (object_class), | ||
1199 | 286 | + G_SIGNAL_RUN_LAST, | ||
1200 | 287 | + G_STRUCT_OFFSET (GsmXSMPClientClass, save_request), | ||
1201 | 288 | + NULL, | ||
1202 | 289 | + NULL, | ||
1203 | 290 | + g_cclosure_marshal_VOID__BOOLEAN, | ||
1204 | 291 | G_TYPE_NONE, | ||
1205 | 292 | 1, G_TYPE_BOOLEAN); | ||
1206 | 293 | |||
1207 | 294 | Index: gnome-session-3.0.0/gnome-session/gsm-xsmp-client.h | ||
1208 | 295 | =================================================================== | ||
1209 | 296 | --- gnome-session-3.0.0.orig/gnome-session/gsm-xsmp-client.h 2010-02-09 14:22:01.000000000 +0100 | ||
1210 | 297 | +++ gnome-session-3.0.0/gnome-session/gsm-xsmp-client.h 2011-04-20 21:12:54.061718891 +0200 | ||
1211 | 298 | @@ -54,7 +54,8 @@ struct _GsmXSMPClientClass | ||
1212 | 299 | char **client_id); | ||
1213 | 300 | gboolean (*logout_request) (GsmXSMPClient *client, | ||
1214 | 301 | gboolean prompt); | ||
1215 | 302 | - | ||
1216 | 303 | + gboolean (*save_request) (GsmXSMPClient *client, | ||
1217 | 304 | + gboolean prompt); | ||
1218 | 305 | |||
1219 | 306 | void (*saved_state) (GsmXSMPClient *client); | ||
1220 | 307 | |||
1221 | 308 | Index: gnome-session-3.0.0/gnome-session/org.gnome.SessionManager.xml | ||
1222 | 309 | =================================================================== | ||
1223 | 310 | --- gnome-session-3.0.0.orig/gnome-session/org.gnome.SessionManager.xml 2010-02-09 14:22:01.000000000 +0100 | ||
1224 | 311 | +++ gnome-session-3.0.0/gnome-session/org.gnome.SessionManager.xml 2011-04-20 21:12:54.061718891 +0200 | ||
1225 | 312 | @@ -256,6 +256,14 @@ | ||
1226 | 313 | </doc:doc> | ||
1227 | 314 | </method> | ||
1228 | 315 | |||
1229 | 316 | + <method name="SaveSession"> | ||
1230 | 317 | + <doc:doc> | ||
1231 | 318 | + <doc:description> | ||
1232 | 319 | + <doc:para>Request to save session</doc:para> | ||
1233 | 320 | + </doc:description> | ||
1234 | 321 | + </doc:doc> | ||
1235 | 322 | + </method> | ||
1236 | 323 | + | ||
1237 | 324 | <method name="CanShutdown"> | ||
1238 | 325 | <arg name="is_available" direction="out" type="b"> | ||
1239 | 326 | <doc:doc> | ||
1240 | 327 | Index: gnome-session-3.0.0/capplet/gsm-properties-dialog.c | ||
1241 | 328 | =================================================================== | ||
1242 | 329 | --- gnome-session-3.0.0.orig/capplet/gsm-properties-dialog.c 2011-03-22 21:31:42.000000000 +0100 | ||
1243 | 330 | +++ gnome-session-3.0.0/capplet/gsm-properties-dialog.c 2011-04-20 21:12:54.061718891 +0200 | ||
1244 | 331 | @@ -33,6 +33,12 @@ | ||
1245 | 332 | #include "gsm-util.h" | ||
1246 | 333 | #include "gsp-app.h" | ||
1247 | 334 | #include "gsp-app-manager.h" | ||
1248 | 335 | +#include <dbus/dbus-glib.h> | ||
1249 | 336 | +#include <dbus/dbus-glib-lowlevel.h> | ||
1250 | 337 | + | ||
1251 | 338 | +#define GSM_SERVICE_DBUS "org.gnome.SessionManager" | ||
1252 | 339 | +#define GSM_PATH_DBUS "/org/gnome/SessionManager" | ||
1253 | 340 | +#define GSM_INTERFACE_DBUS "org.gnome.SessionManager" | ||
1254 | 341 | |||
1255 | 342 | #define GSM_PROPERTIES_DIALOG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSM_TYPE_PROPERTIES_DIALOG, GsmPropertiesDialogPrivate)) | ||
1256 | 343 | |||
1257 | 344 | @@ -43,6 +49,7 @@ | ||
1258 | 345 | #define CAPPLET_DELETE_WIDGET_NAME "session_properties_delete_button" | ||
1259 | 346 | #define CAPPLET_EDIT_WIDGET_NAME "session_properties_edit_button" | ||
1260 | 347 | #define CAPPLET_SAVE_WIDGET_NAME "session_properties_save_button" | ||
1261 | 348 | +#define CAPPLET_SESSION_SAVED_WIDGET_NAME "session_properties_session_saved_label" | ||
1262 | 349 | #define CAPPLET_REMEMBER_WIDGET_NAME "session_properties_remember_toggle" | ||
1263 | 350 | |||
1264 | 351 | #define STARTUP_APP_ICON "system-run" | ||
1265 | 352 | @@ -455,10 +462,64 @@ on_row_activated (GtkTreeView *t | ||
1266 | 353 | } | ||
1267 | 354 | |||
1268 | 355 | static void | ||
1269 | 356 | +session_saved_message (GsmPropertiesDialog *dialog, | ||
1270 | 357 | + const char *msg, | ||
1271 | 358 | + gboolean is_error) | ||
1272 | 359 | +{ | ||
1273 | 360 | + GtkLabel *label; | ||
1274 | 361 | + gchar *markup; | ||
1275 | 362 | + label = GTK_LABEL (gtk_builder_get_object (dialog->priv->xml, CAPPLET_SESSION_SAVED_WIDGET_NAME)); | ||
1276 | 363 | + if (is_error) | ||
1277 | 364 | + markup = g_markup_printf_escaped ("<span foreground=\"red\">%s</span>", msg); | ||
1278 | 365 | + else | ||
1279 | 366 | + markup = g_markup_escape_text (msg, -1); | ||
1280 | 367 | + gtk_label_set_markup (label, markup); | ||
1281 | 368 | + g_free (markup); | ||
1282 | 369 | +} | ||
1283 | 370 | + | ||
1284 | 371 | +static void | ||
1285 | 372 | +session_saved_cb (DBusGProxy *proxy, | ||
1286 | 373 | + DBusGProxyCall *call_id, | ||
1287 | 374 | + void *user_data) | ||
1288 | 375 | +{ | ||
1289 | 376 | + gboolean res; | ||
1290 | 377 | + GsmPropertiesDialog *dialog = user_data; | ||
1291 | 378 | + | ||
1292 | 379 | + res = dbus_g_proxy_end_call (proxy, call_id, NULL, G_TYPE_INVALID); | ||
1293 | 380 | + if (res) | ||
1294 | 381 | + session_saved_message (dialog, _("Your session has been saved."), FALSE); | ||
1295 | 382 | + else | ||
1296 | 383 | + session_saved_message (dialog, _("Failed to save session"), TRUE); | ||
1297 | 384 | + | ||
1298 | 385 | + g_object_unref (proxy); | ||
1299 | 386 | +} | ||
1300 | 387 | + | ||
1301 | 388 | +static void | ||
1302 | 389 | on_save_session_clicked (GtkWidget *widget, | ||
1303 | 390 | GsmPropertiesDialog *dialog) | ||
1304 | 391 | { | ||
1305 | 392 | - g_debug ("Session saving is not implemented yet!"); | ||
1306 | 393 | + DBusGConnection *conn; | ||
1307 | 394 | + DBusGProxy *proxy; | ||
1308 | 395 | + DBusGProxyCall *call; | ||
1309 | 396 | + | ||
1310 | 397 | + conn = dbus_g_bus_get (DBUS_BUS_SESSION, NULL); | ||
1311 | 398 | + if (conn == NULL) { | ||
1312 | 399 | + session_saved_message (dialog, _("Could not connect to the session bus"), TRUE); | ||
1313 | 400 | + return; | ||
1314 | 401 | + } | ||
1315 | 402 | + | ||
1316 | 403 | + proxy = dbus_g_proxy_new_for_name (conn, GSM_SERVICE_DBUS, GSM_PATH_DBUS, GSM_INTERFACE_DBUS); | ||
1317 | 404 | + if (proxy == NULL) { | ||
1318 | 405 | + session_saved_message (dialog, _("Could not connect to the session manager"), TRUE); | ||
1319 | 406 | + return; | ||
1320 | 407 | + } | ||
1321 | 408 | + | ||
1322 | 409 | + call = dbus_g_proxy_begin_call (proxy, "SaveSession", session_saved_cb, dialog, NULL, G_TYPE_INVALID); | ||
1323 | 410 | + if (call == NULL) { | ||
1324 | 411 | + session_saved_message (dialog, _("Failed to save session"), TRUE); | ||
1325 | 412 | + g_object_unref (proxy); | ||
1326 | 413 | + return; | ||
1327 | 414 | + } | ||
1328 | 415 | } | ||
1329 | 416 | |||
1330 | 417 | static void | ||
1331 | 418 | Index: gnome-session-3.0.0/configure.ac | ||
1332 | 419 | =================================================================== | ||
1333 | 420 | --- gnome-session-3.0.0.orig/configure.ac 2011-03-30 09:47:33.000000000 +0200 | ||
1334 | 421 | +++ gnome-session-3.0.0/configure.ac 2011-04-20 21:12:54.061718891 +0200 | ||
1335 | 422 | @@ -63,6 +63,7 @@ PKG_CHECK_MODULES(GNOME_SESSION, | ||
1336 | 423 | PKG_CHECK_MODULES(SESSION_PROPERTIES, | ||
1337 | 424 | glib-2.0 >= $GLIB_REQUIRED | ||
1338 | 425 | gtk+-3.0 >= $GTK3_REQUIRED | ||
1339 | 426 | + dbus-glib-1 >= $DBUS_GLIB_REQUIRED | ||
1340 | 427 | ) | ||
1341 | 428 | |||
1342 | 429 | PKG_CHECK_MODULES(SM, sm) | ||
1343 | 430 | Index: gnome-session-3.0.0/gnome-session/gsm-client.h | ||
1344 | 431 | =================================================================== | ||
1345 | 432 | --- gnome-session-3.0.0.orig/gnome-session/gsm-client.h 2010-02-09 14:22:01.000000000 +0100 | ||
1346 | 433 | +++ gnome-session-3.0.0/gnome-session/gsm-client.h 2011-04-20 21:12:54.061718891 +0200 | ||
1347 | 434 | @@ -92,6 +92,9 @@ struct _GsmClientClass | ||
1348 | 435 | GError **error); | ||
1349 | 436 | gboolean (*impl_stop) (GsmClient *client, | ||
1350 | 437 | GError **error); | ||
1351 | 438 | + gboolean (*impl_request_save) (GsmClient *client, | ||
1352 | 439 | + guint flags, | ||
1353 | 440 | + GError **error); | ||
1354 | 441 | GKeyFile * (*impl_save) (GsmClient *client, | ||
1355 | 442 | GError **error); | ||
1356 | 443 | }; | ||
1357 | 444 | @@ -137,6 +140,9 @@ gboolean gsm_client_cancel_ | ||
1358 | 445 | |||
1359 | 446 | void gsm_client_disconnected (GsmClient *client); | ||
1360 | 447 | |||
1361 | 448 | +gboolean gsm_client_request_save (GsmClient *client, | ||
1362 | 449 | + guint flags, | ||
1363 | 450 | + GError **error); | ||
1364 | 451 | GKeyFile *gsm_client_save (GsmClient *client, | ||
1365 | 452 | GError **error); | ||
1366 | 453 | /* exported to bus */ | ||
1367 | 454 | Index: gnome-session-3.0.0/gnome-session/gsm-dbus-client.c | ||
1368 | 455 | =================================================================== | ||
1369 | 456 | --- gnome-session-3.0.0.orig/gnome-session/gsm-dbus-client.c 2011-03-22 21:31:43.000000000 +0100 | ||
1370 | 457 | +++ gnome-session-3.0.0/gnome-session/gsm-dbus-client.c 2011-04-20 21:12:54.061718891 +0200 | ||
1371 | 458 | @@ -412,6 +412,19 @@ gsm_dbus_client_finalize (GObject *objec | ||
1372 | 459 | G_OBJECT_CLASS (gsm_dbus_client_parent_class)->finalize (object); | ||
1373 | 460 | } | ||
1374 | 461 | |||
1375 | 462 | +static gboolean | ||
1376 | 463 | +dbus_client_request_save (GsmClient *client, | ||
1377 | 464 | + guint flags, | ||
1378 | 465 | + GError **error) | ||
1379 | 466 | +{ | ||
1380 | 467 | + g_debug ("GsmDBusClient: sending save request to client with id %s", | ||
1381 | 468 | + gsm_client_peek_id (client)); | ||
1382 | 469 | + | ||
1383 | 470 | + /* FIXME: The protocol does not support this */ | ||
1384 | 471 | + | ||
1385 | 472 | + return FALSE; | ||
1386 | 473 | +} | ||
1387 | 474 | + | ||
1388 | 475 | static GKeyFile * | ||
1389 | 476 | dbus_client_save (GsmClient *client, | ||
1390 | 477 | GError **error) | ||
1391 | 478 | @@ -664,6 +677,7 @@ gsm_dbus_client_class_init (GsmDBusClien | ||
1392 | 479 | object_class->set_property = gsm_dbus_client_set_property; | ||
1393 | 480 | object_class->dispose = gsm_dbus_client_dispose; | ||
1394 | 481 | |||
1395 | 482 | + client_class->impl_request_save = dbus_client_request_save; | ||
1396 | 483 | client_class->impl_save = dbus_client_save; | ||
1397 | 484 | client_class->impl_stop = dbus_client_stop; | ||
1398 | 485 | client_class->impl_query_end_session = dbus_client_query_end_session; | ||
1399 | 486 | Index: gnome-session-3.0.0/gnome-session/gsm-client.c | ||
1400 | 487 | =================================================================== | ||
1401 | 488 | --- gnome-session-3.0.0.orig/gnome-session/gsm-client.c 2010-02-09 14:22:01.000000000 +0100 | ||
1402 | 489 | +++ gnome-session-3.0.0/gnome-session/gsm-client.c 2011-04-20 21:12:54.061718891 +0200 | ||
1403 | 490 | @@ -510,6 +510,16 @@ gsm_client_disconnected (GsmClient *clie | ||
1404 | 491 | g_signal_emit (client, signals[DISCONNECTED], 0); | ||
1405 | 492 | } | ||
1406 | 493 | |||
1407 | 494 | +gboolean | ||
1408 | 495 | +gsm_client_request_save (GsmClient *client, | ||
1409 | 496 | + guint flags, | ||
1410 | 497 | + GError **error) | ||
1411 | 498 | +{ | ||
1412 | 499 | + g_return_val_if_fail (GSM_IS_CLIENT (client), FALSE); | ||
1413 | 500 | + | ||
1414 | 501 | + return GSM_CLIENT_GET_CLASS (client)->impl_request_save (client, flags, error); | ||
1415 | 502 | +} | ||
1416 | 503 | + | ||
1417 | 504 | GKeyFile * | ||
1418 | 505 | gsm_client_save (GsmClient *client, | ||
1419 | 506 | GError **error) | ||
1420 | 507 | Index: gnome-session-3.0.0/data/session-properties.ui | ||
1421 | 508 | =================================================================== | ||
1422 | 509 | --- gnome-session-3.0.0.orig/data/session-properties.ui 2011-03-22 21:31:43.000000000 +0100 | ||
1423 | 510 | +++ gnome-session-3.0.0/data/session-properties.ui 2011-04-20 21:12:54.061718891 +0200 | ||
1424 | 511 | @@ -148,6 +148,7 @@ | ||
1425 | 512 | <property name="visible">True</property> | ||
1426 | 513 | <child> | ||
1427 | 514 | <object class="GtkButton" id="session_properties_save_button"> | ||
1428 | 515 | + <property name="visible">True</property> | ||
1429 | 516 | <property name="can_focus">True</property> | ||
1430 | 517 | <property name="receives_default">True</property> | ||
1431 | 518 | <child> | ||
1432 | 519 | @@ -191,6 +192,17 @@ | ||
1433 | 520 | <property name="position">1</property> | ||
1434 | 521 | </packing> | ||
1435 | 522 | </child> | ||
1436 | 523 | + <child> | ||
1437 | 524 | + <object class="GtkLabel" id="session_properties_session_saved_label"> | ||
1438 | 525 | + <property name="visible">True</property> | ||
1439 | 526 | + <property name="wrap">True</property> | ||
1440 | 527 | + </object> | ||
1441 | 528 | + <packing> | ||
1442 | 529 | + <property name="expand">False</property> | ||
1443 | 530 | + <property name="fill">False</property> | ||
1444 | 531 | + <property name="position">2</property> | ||
1445 | 532 | + </packing> | ||
1446 | 533 | + </child> | ||
1447 | 534 | </object> | ||
1448 | 535 | <packing> | ||
1449 | 536 | <property name="position">1</property> | ||
1450 | 537 | 0 | ||
1451 | === removed file 'debian/patches/12_no_gdm_fallback.patch' | |||
1452 | --- debian/patches/12_no_gdm_fallback.patch 2012-07-29 14:22:20 +0000 | |||
1453 | +++ debian/patches/12_no_gdm_fallback.patch 1970-01-01 00:00:00 +0000 | |||
1454 | @@ -1,27 +0,0 @@ | |||
1455 | 1 | Debian #572085 | ||
1456 | 2 | |||
1457 | 3 | Don’t fall back to GDM when ConsoleKit fails. If CK is not available, it | ||
1458 | 4 | will not be attempted anyway. | ||
1459 | 5 | |||
1460 | 6 | Index: gnome-session-3.5.4/gnome-session/gsm-manager.c | ||
1461 | 7 | =================================================================== | ||
1462 | 8 | --- gnome-session-3.5.4.orig/gnome-session/gsm-manager.c 2012-07-19 13:41:23.511406643 +1200 | ||
1463 | 9 | +++ gnome-session-3.5.4/gnome-session/gsm-manager.c 2012-07-19 13:41:50.227405715 +1200 | ||
1464 | 10 | @@ -492,7 +492,7 @@ | ||
1465 | 11 | g_signal_connect (manager->priv->system, | ||
1466 | 12 | "request-completed", | ||
1467 | 13 | G_CALLBACK (quit_request_completed), | ||
1468 | 14 | - GINT_TO_POINTER (GDM_LOGOUT_ACTION_REBOOT)); | ||
1469 | 15 | + GINT_TO_POINTER (GDM_LOGOUT_ACTION_NONE)); | ||
1470 | 16 | gsm_system_attempt_restart (manager->priv->system); | ||
1471 | 17 | break; | ||
1472 | 18 | case GSM_MANAGER_LOGOUT_REBOOT_GDM: | ||
1473 | 19 | @@ -506,7 +506,7 @@ | ||
1474 | 20 | g_signal_connect (manager->priv->system, | ||
1475 | 21 | "request-completed", | ||
1476 | 22 | G_CALLBACK (quit_request_completed), | ||
1477 | 23 | - GINT_TO_POINTER (GDM_LOGOUT_ACTION_SHUTDOWN)); | ||
1478 | 24 | + GINT_TO_POINTER (GDM_LOGOUT_ACTION_NONE)); | ||
1479 | 25 | gsm_system_attempt_stop (manager->priv->system); | ||
1480 | 26 | break; | ||
1481 | 27 | case GSM_MANAGER_LOGOUT_SHUTDOWN_GDM: | ||
1482 | 28 | 0 | ||
1483 | === modified file 'debian/patches/13_display_session_properties.patch' | |||
1484 | --- debian/patches/13_display_session_properties.patch 2013-06-08 23:25:03 +0000 | |||
1485 | +++ debian/patches/13_display_session_properties.patch 2014-10-31 04:52:33 +0000 | |||
1486 | @@ -4,11 +4,11 @@ | |||
1487 | 4 | the builtian search. | 4 | the builtian search. |
1488 | 5 | Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=683814 | 5 | Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=683814 |
1489 | 6 | 6 | ||
1491 | 7 | Index: gnome-session-3.4.2.1/data/session-properties.desktop.in.in | 7 | Index: gnome-session/data/gnome-session-properties.desktop.in.in |
1492 | 8 | =================================================================== | 8 | =================================================================== |
1496 | 9 | --- gnome-session-3.4.2.1.orig/data/session-properties.desktop.in.in 2012-05-17 20:26:07.000000000 +0200 | 9 | --- gnome-session.orig/data/gnome-session-properties.desktop.in.in |
1497 | 10 | +++ gnome-session-3.4.2.1/data/session-properties.desktop.in.in 2012-08-07 01:08:23.755210722 +0200 | 10 | +++ gnome-session/data/gnome-session-properties.desktop.in.in |
1498 | 11 | @@ -8,7 +8,6 @@ | 11 | @@ -8,7 +8,6 @@ Type=Application |
1499 | 12 | StartupNotify=true | 12 | StartupNotify=true |
1500 | 13 | Categories=GTK;GNOME;Settings;X-GNOME-PersonalSettings; | 13 | Categories=GTK;GNOME;Settings;X-GNOME-PersonalSettings; |
1501 | 14 | OnlyShowIn=GNOME;Unity; | 14 | OnlyShowIn=GNOME;Unity; |
1502 | 15 | 15 | ||
1503 | === modified file 'debian/patches/50_ubuntu_sessions.patch' | |||
1504 | --- debian/patches/50_ubuntu_sessions.patch 2014-06-04 12:26:37 +0000 | |||
1505 | +++ debian/patches/50_ubuntu_sessions.patch 2014-10-31 04:52:33 +0000 | |||
1506 | @@ -4,9 +4,11 @@ | |||
1507 | 4 | (TryExec enables to show them or not depends on the package installed) | 4 | (TryExec enables to show them or not depends on the package installed) |
1508 | 5 | Forwarded: Not needed | 5 | Forwarded: Not needed |
1509 | 6 | 6 | ||
1513 | 7 | --- a/data/gnome.desktop.in | 7 | Index: gnome-session/data/gnome.desktop.in |
1514 | 8 | +++ b/data/gnome.desktop.in | 8 | =================================================================== |
1515 | 9 | @@ -1,7 +1,8 @@ | 9 | --- gnome-session.orig/data/gnome.desktop.in |
1516 | 10 | +++ gnome-session/data/gnome.desktop.in | ||
1517 | 11 | @@ -1,8 +1,9 @@ | ||
1518 | 10 | [Desktop Entry] | 12 | [Desktop Entry] |
1519 | 11 | _Name=GNOME | 13 | _Name=GNOME |
1520 | 12 | _Comment=This session logs you into GNOME | 14 | _Comment=This session logs you into GNOME |
1521 | @@ -16,10 +18,13 @@ | |||
1522 | 16 | +TryExec=gnome-shell | 18 | +TryExec=gnome-shell |
1523 | 17 | Icon= | 19 | Icon= |
1524 | 18 | Type=Application | 20 | Type=Application |
1525 | 21 | DesktopNames=GNOME | ||
1526 | 19 | +X-LightDM-DesktopName=GNOME | 22 | +X-LightDM-DesktopName=GNOME |
1530 | 20 | --- a/data/Makefile.am | 23 | Index: gnome-session/data/Makefile.am |
1531 | 21 | +++ b/data/Makefile.am | 24 | =================================================================== |
1532 | 22 | @@ -13,7 +13,7 @@ | 25 | --- gnome-session.orig/data/Makefile.am |
1533 | 26 | +++ gnome-session/data/Makefile.am | ||
1534 | 27 | @@ -12,7 +12,7 @@ hwcompatdir = $(pkgdatadir) | ||
1535 | 23 | hwcompat_DATA = hardware-compatibility | 28 | hwcompat_DATA = hardware-compatibility |
1536 | 24 | 29 | ||
1537 | 25 | xsessiondir = $(datadir)/xsessions | 30 | xsessiondir = $(datadir)/xsessions |
1538 | @@ -28,25 +33,29 @@ | |||
1539 | 28 | 33 | ||
1540 | 29 | if BUILD_SESSION_SELECTOR | 34 | if BUILD_SESSION_SELECTOR |
1541 | 30 | xsession_in_files += gnome-custom-session.desktop.in | 35 | xsession_in_files += gnome-custom-session.desktop.in |
1543 | 31 | @@ -26,7 +26,7 @@ | 36 | @@ -29,7 +29,7 @@ desktop_in_files = gnome-session-propert |
1544 | 32 | desktop_DATA = $(desktop_in_files:.desktop.in=.desktop) | 37 | desktop_DATA = $(desktop_in_files:.desktop.in=.desktop) |
1545 | 33 | 38 | ||
1546 | 34 | sessiondir = $(datadir)/gnome-session/sessions | 39 | sessiondir = $(datadir)/gnome-session/sessions |
1549 | 35 | -session_in_in_files = gnome.session.desktop.in.in gnome-dummy.session.desktop.in.in | 40 | -session_in_in_files = gnome.session.desktop.in.in gnome-dummy.session.desktop.in.in gnome-wayland.session.desktop.in.in |
1550 | 36 | +session_in_in_files = gnome.session.desktop.in.in gnome-dummy.session.desktop.in.in ubuntu.session.desktop.in.in | 41 | +session_in_in_files = gnome.session.desktop.in.in gnome-dummy.session.desktop.in.in gnome-wayland.session.desktop.in.in ubuntu.session.desktop.in.in |
1551 | 37 | session_in_files = $(session_in_in_files:.session.desktop.in.in=.session.desktop.in) | 42 | session_in_files = $(session_in_in_files:.session.desktop.in.in=.session.desktop.in) |
1552 | 38 | session_DATA = $(session_in_files:.session.desktop.in=.session) | 43 | session_DATA = $(session_in_files:.session.desktop.in=.session) |
1553 | 39 | 44 | ||
1554 | 45 | Index: gnome-session/data/ubuntu.session.desktop.in.in | ||
1555 | 46 | =================================================================== | ||
1556 | 40 | --- /dev/null | 47 | --- /dev/null |
1558 | 41 | +++ b/data/ubuntu.session.desktop.in.in | 48 | +++ gnome-session/data/ubuntu.session.desktop.in.in |
1559 | 42 | @@ -0,0 +1,4 @@ | 49 | @@ -0,0 +1,4 @@ |
1560 | 43 | +[GNOME Session] | 50 | +[GNOME Session] |
1561 | 44 | +_Name=Ubuntu | 51 | +_Name=Ubuntu |
1563 | 45 | +RequiredComponents=unity-settings-daemon; | 52 | +RequiredComponents=unity-settings-daemon;compiz; |
1564 | 46 | +DesktopName=Unity | 53 | +DesktopName=Unity |
1565 | 54 | Index: gnome-session/data/ubuntu.desktop.in | ||
1566 | 55 | =================================================================== | ||
1567 | 47 | --- /dev/null | 56 | --- /dev/null |
1570 | 48 | +++ b/data/ubuntu.desktop.in | 57 | +++ gnome-session/data/ubuntu.desktop.in |
1571 | 49 | @@ -0,0 +1,8 @@ | 58 | @@ -0,0 +1,9 @@ |
1572 | 50 | +[Desktop Entry] | 59 | +[Desktop Entry] |
1573 | 51 | +_Name=Ubuntu | 60 | +_Name=Ubuntu |
1574 | 52 | +_Comment=This session logs you into Ubuntu | 61 | +_Comment=This session logs you into Ubuntu |
1575 | @@ -54,4 +63,5 @@ | |||
1576 | 54 | +TryExec=unity | 63 | +TryExec=unity |
1577 | 55 | +Icon= | 64 | +Icon= |
1578 | 56 | +Type=Application | 65 | +Type=Application |
1579 | 66 | +DesktopNames=Unity | ||
1580 | 57 | +X-LightDM-DesktopName=Unity | 67 | +X-LightDM-DesktopName=Unity |
1581 | 58 | 68 | ||
1582 | === removed file 'debian/patches/52_xdg_current_desktop.patch' | |||
1583 | --- debian/patches/52_xdg_current_desktop.patch 2014-02-17 03:42:04 +0000 | |||
1584 | +++ debian/patches/52_xdg_current_desktop.patch 1970-01-01 00:00:00 +0000 | |||
1585 | @@ -1,46 +0,0 @@ | |||
1586 | 1 | Index: gnome-session-3.7.4/gnome-session/gsm-session-fill.c | ||
1587 | 2 | =================================================================== | ||
1588 | 3 | --- gnome-session-3.7.4.orig/gnome-session/gsm-session-fill.c 2013-02-07 18:04:28.954708097 -0500 | ||
1589 | 4 | +++ gnome-session-3.7.4/gnome-session/gsm-session-fill.c 2013-02-07 18:04:28.946708097 -0500 | ||
1590 | 5 | @@ -31,6 +31,7 @@ | ||
1591 | 6 | #define GSM_KEYFILE_SESSION_GROUP "GNOME Session" | ||
1592 | 7 | #define GSM_KEYFILE_RUNNABLE_KEY "IsRunnableHelper" | ||
1593 | 8 | #define GSM_KEYFILE_FALLBACK_KEY "FallbackSession" | ||
1594 | 9 | +#define GSM_KEYFILE_DESKTOP_NAME_KEY "DesktopName" | ||
1595 | 10 | #define GSM_KEYFILE_REQUIRED_COMPONENTS_KEY "RequiredComponents" | ||
1596 | 11 | |||
1597 | 12 | /* See https://bugzilla.gnome.org/show_bug.cgi?id=641992 for discussion */ | ||
1598 | 13 | @@ -315,6 +316,24 @@ | ||
1599 | 14 | return keyfile; | ||
1600 | 15 | } | ||
1601 | 16 | |||
1602 | 17 | +static void | ||
1603 | 18 | +set_xdg_current_desktop (GKeyFile *keyfile) | ||
1604 | 19 | +{ | ||
1605 | 20 | + char *value; | ||
1606 | 21 | + | ||
1607 | 22 | + value = g_key_file_get_string (keyfile, | ||
1608 | 23 | + GSM_KEYFILE_SESSION_GROUP, GSM_KEYFILE_DESKTOP_NAME_KEY, | ||
1609 | 24 | + NULL); | ||
1610 | 25 | + | ||
1611 | 26 | + if (!IS_STRING_EMPTY (value)) { | ||
1612 | 27 | + gsm_util_setenv ("XDG_CURRENT_DESKTOP", value); | ||
1613 | 28 | + } | ||
1614 | 29 | + else { | ||
1615 | 30 | + gsm_util_setenv ("XDG_CURRENT_DESKTOP", "GNOME"); | ||
1616 | 31 | + } | ||
1617 | 32 | + g_free (value); | ||
1618 | 33 | +} | ||
1619 | 34 | + | ||
1620 | 35 | gboolean | ||
1621 | 36 | gsm_session_fill (GsmManager *manager, | ||
1622 | 37 | const char *session) | ||
1623 | 38 | @@ -332,6 +351,8 @@ | ||
1624 | 39 | |||
1625 | 40 | g_free (actual_session); | ||
1626 | 41 | |||
1627 | 42 | + set_xdg_current_desktop (keyfile); | ||
1628 | 43 | + | ||
1629 | 44 | load_standard_apps (manager, keyfile); | ||
1630 | 45 | |||
1631 | 46 | g_key_file_free (keyfile); | ||
1632 | 47 | 0 | ||
1633 | === removed file 'debian/patches/80_new_upstream_session_dialog.patch' | |||
1634 | --- debian/patches/80_new_upstream_session_dialog.patch 2011-05-24 08:56:36 +0000 | |||
1635 | +++ debian/patches/80_new_upstream_session_dialog.patch 1970-01-01 00:00:00 +0000 | |||
1636 | @@ -1,699 +0,0 @@ | |||
1637 | 1 | Description: change the logout dialog to the opensuse proposal. | ||
1638 | 2 | Bug: https://bugzilla.gnome.org/show_bug.cgi?id=507101 | ||
1639 | 3 | Author: Vincent Untz | ||
1640 | 4 | |||
1641 | 5 | Index: gnome-session-3.0.0/gnome-session/gsm-manager.c | ||
1642 | 6 | =================================================================== | ||
1643 | 7 | --- gnome-session-3.0.0.orig/gnome-session/gsm-manager.c 2011-05-24 10:17:22.244968980 +0200 | ||
1644 | 8 | +++ gnome-session-3.0.0/gnome-session/gsm-manager.c 2011-05-24 10:17:22.284969173 +0200 | ||
1645 | 9 | @@ -3050,7 +3050,8 @@ | ||
1646 | 10 | |||
1647 | 11 | display = gtk_widget_get_display (GTK_WIDGET (logout_dialog)); | ||
1648 | 12 | |||
1649 | 13 | - gtk_widget_destroy (GTK_WIDGET (logout_dialog)); | ||
1650 | 14 | + if (response_id != GTK_RESPONSE_HELP) | ||
1651 | 15 | + gtk_widget_destroy (GTK_WIDGET (logout_dialog)); | ||
1652 | 16 | |||
1653 | 17 | /* In case of dialog cancel, switch user, hibernate and | ||
1654 | 18 | * suspend, we just perform the respective action and return, | ||
1655 | 19 | @@ -3060,6 +3061,10 @@ | ||
1656 | 20 | case GTK_RESPONSE_NONE: | ||
1657 | 21 | case GTK_RESPONSE_DELETE_EVENT: | ||
1658 | 22 | break; | ||
1659 | 23 | + case GTK_RESPONSE_HELP: | ||
1660 | 24 | + gsm_util_help_display (GTK_WINDOW (logout_dialog), | ||
1661 | 25 | + "gosgetstarted-73"); | ||
1662 | 26 | + break; | ||
1663 | 27 | case GSM_LOGOUT_RESPONSE_SWITCH_USER: | ||
1664 | 28 | request_switch_user (display, manager); | ||
1665 | 29 | break; | ||
1666 | 30 | Index: gnome-session-3.0.0/gnome-session/gsm-util.c | ||
1667 | 31 | =================================================================== | ||
1668 | 32 | --- gnome-session-3.0.0.orig/gnome-session/gsm-util.c 2011-03-22 21:31:43.000000000 +0100 | ||
1669 | 33 | +++ gnome-session-3.0.0/gnome-session/gsm-util.c 2011-05-24 10:17:22.284969173 +0200 | ||
1670 | 34 | @@ -21,6 +21,7 @@ | ||
1671 | 35 | #include <config.h> | ||
1672 | 36 | #include <stdlib.h> | ||
1673 | 37 | #include <ctype.h> | ||
1674 | 38 | +#include <string.h> | ||
1675 | 39 | #include <sys/types.h> | ||
1676 | 40 | #include <unistd.h> | ||
1677 | 41 | #include <sys/time.h> | ||
1678 | 42 | @@ -519,3 +520,86 @@ | ||
1679 | 43 | |||
1680 | 44 | return icon_size; | ||
1681 | 45 | } | ||
1682 | 46 | + | ||
1683 | 47 | +void | ||
1684 | 48 | +gsm_util_help_display (GtkWindow *parent, | ||
1685 | 49 | + const char *link_id) | ||
1686 | 50 | +{ | ||
1687 | 51 | + GError *error = NULL; | ||
1688 | 52 | + const char *lang; | ||
1689 | 53 | + char *uri = NULL; | ||
1690 | 54 | + gboolean found; | ||
1691 | 55 | + | ||
1692 | 56 | + int i; | ||
1693 | 57 | + | ||
1694 | 58 | + const char * const * langs = g_get_language_names (); | ||
1695 | 59 | + | ||
1696 | 60 | + uri = NULL; | ||
1697 | 61 | + found = FALSE; | ||
1698 | 62 | + | ||
1699 | 63 | + for (i = 0; langs[i]; i++) { | ||
1700 | 64 | + lang = langs[i]; | ||
1701 | 65 | + if (strchr (lang, '.')) { | ||
1702 | 66 | + continue; | ||
1703 | 67 | + } | ||
1704 | 68 | + | ||
1705 | 69 | + uri = g_build_filename (DATADIR, | ||
1706 | 70 | + "/gnome/help/user-guide/", | ||
1707 | 71 | + lang, | ||
1708 | 72 | + "/user-guide.xml", | ||
1709 | 73 | + NULL); | ||
1710 | 74 | + | ||
1711 | 75 | + if (g_file_test (uri, G_FILE_TEST_EXISTS)) { | ||
1712 | 76 | + found = TRUE; | ||
1713 | 77 | + break; | ||
1714 | 78 | + } | ||
1715 | 79 | + } | ||
1716 | 80 | + | ||
1717 | 81 | + if (found) { | ||
1718 | 82 | + GAppInfo *app_info; | ||
1719 | 83 | + char *command; | ||
1720 | 84 | + | ||
1721 | 85 | + if (link_id) { | ||
1722 | 86 | + command = g_strconcat ("gnome-open ghelp://", uri, "?", link_id, NULL); | ||
1723 | 87 | + } else { | ||
1724 | 88 | + command = g_strconcat ("gnome-open ghelp://", uri, NULL); | ||
1725 | 89 | + } | ||
1726 | 90 | + | ||
1727 | 91 | + app_info = g_app_info_create_from_commandline (command, "gnome-open",G_APP_INFO_CREATE_NONE, &error); | ||
1728 | 92 | + g_free (command); | ||
1729 | 93 | + | ||
1730 | 94 | + if (error == NULL && app_info != NULL) { | ||
1731 | 95 | + GdkScreen *screen; | ||
1732 | 96 | + GdkAppLaunchContext *context; | ||
1733 | 97 | + | ||
1734 | 98 | + screen = gtk_widget_get_screen (GTK_WIDGET (parent)); | ||
1735 | 99 | + context = gdk_display_get_app_launch_context (gdk_screen_get_display (screen)); | ||
1736 | 100 | + g_app_info_launch (app_info, NULL, G_APP_LAUNCH_CONTEXT (context), &error); | ||
1737 | 101 | + | ||
1738 | 102 | + g_object_unref (context); | ||
1739 | 103 | + g_object_unref (app_info); | ||
1740 | 104 | + } | ||
1741 | 105 | + } | ||
1742 | 106 | + | ||
1743 | 107 | + if (!found || error != NULL) { | ||
1744 | 108 | + GtkWidget *d; | ||
1745 | 109 | + const char *errmsg; | ||
1746 | 110 | + | ||
1747 | 111 | + if (!found) | ||
1748 | 112 | + errmsg = _("Cannot find help."); | ||
1749 | 113 | + else { | ||
1750 | 114 | + errmsg = error->message; | ||
1751 | 115 | + g_error_free (error); | ||
1752 | 116 | + } | ||
1753 | 117 | + | ||
1754 | 118 | + d = gtk_message_dialog_new (parent, | ||
1755 | 119 | + GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT, | ||
1756 | 120 | + GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, | ||
1757 | 121 | + "%s", errmsg); | ||
1758 | 122 | + gtk_widget_show (GTK_WIDGET (d)); | ||
1759 | 123 | + g_signal_connect (d, "response", | ||
1760 | 124 | + G_CALLBACK (gtk_widget_destroy), NULL); | ||
1761 | 125 | + } | ||
1762 | 126 | + | ||
1763 | 127 | + g_free (uri); | ||
1764 | 128 | +} | ||
1765 | 129 | Index: gnome-session-3.0.0/gnome-session/Makefile.am | ||
1766 | 130 | =================================================================== | ||
1767 | 131 | --- gnome-session-3.0.0.orig/gnome-session/Makefile.am 2011-03-22 21:36:21.000000000 +0100 | ||
1768 | 132 | +++ gnome-session-3.0.0/gnome-session/Makefile.am 2011-05-24 10:17:22.288969198 +0200 | ||
1769 | 133 | @@ -94,6 +94,10 @@ | ||
1770 | 134 | gsm-util.c \ | ||
1771 | 135 | gsm-util.h | ||
1772 | 136 | |||
1773 | 137 | +libgsmutil_la_CPPFLAGS = \ | ||
1774 | 138 | + $(AM_CPPFLAGS) \ | ||
1775 | 139 | + -DDATADIR=\""$(datadir)"\" | ||
1776 | 140 | + | ||
1777 | 141 | libgsmutil_la_LIBADD = \ | ||
1778 | 142 | $(GNOME_SESSION_LIBS) | ||
1779 | 143 | |||
1780 | 144 | Index: gnome-session-3.0.0/gnome-session/gsm-logout-dialog.c | ||
1781 | 145 | =================================================================== | ||
1782 | 146 | --- gnome-session-3.0.0.orig/gnome-session/gsm-logout-dialog.c 2011-03-22 21:31:43.000000000 +0100 | ||
1783 | 147 | +++ gnome-session-3.0.0/gnome-session/gsm-logout-dialog.c 2011-05-24 10:29:39.732625980 +0200 | ||
1784 | 148 | @@ -43,6 +43,14 @@ | ||
1785 | 149 | #define LOCKDOWN_SCHEMA "org.gnome.desktop.lockdown" | ||
1786 | 150 | #define KEY_DISABLE_USER_SWITCHING "disable-user-switching" | ||
1787 | 151 | |||
1788 | 152 | +#define GSM_ICON_LOGOUT "system-log-out" | ||
1789 | 153 | +#define GSM_ICON_SWITCH "system-users" | ||
1790 | 154 | +#define GSM_ICON_SHUTDOWN "system-shutdown" | ||
1791 | 155 | +#define GSM_ICON_REBOOT "view-refresh" | ||
1792 | 156 | +/* TODO: use gpm icons? */ | ||
1793 | 157 | +#define GSM_ICON_HIBERNATE "drive-harddisk" | ||
1794 | 158 | +#define GSM_ICON_SLEEP "gnome-session-sleep" | ||
1795 | 159 | + | ||
1796 | 160 | typedef enum { | ||
1797 | 161 | GSM_DIALOG_LOGOUT_TYPE_LOGOUT, | ||
1798 | 162 | GSM_DIALOG_LOGOUT_TYPE_SHUTDOWN | ||
1799 | 163 | @@ -50,11 +58,12 @@ | ||
1800 | 164 | |||
1801 | 165 | struct _GsmLogoutDialogPrivate | ||
1802 | 166 | { | ||
1803 | 167 | - GsmDialogLogoutType type; | ||
1804 | 168 | - | ||
1805 | 169 | UpClient *up_client; | ||
1806 | 170 | GsmConsolekit *consolekit; | ||
1807 | 171 | |||
1808 | 172 | + GtkWidget *info_label; | ||
1809 | 173 | + GtkWidget *cancel_button; | ||
1810 | 174 | + | ||
1811 | 175 | int timeout; | ||
1812 | 176 | unsigned int timeout_id; | ||
1813 | 177 | |||
1814 | 178 | @@ -63,7 +72,8 @@ | ||
1815 | 179 | |||
1816 | 180 | static GsmLogoutDialog *current_dialog = NULL; | ||
1817 | 181 | |||
1818 | 182 | -static void gsm_logout_dialog_set_timeout (GsmLogoutDialog *logout_dialog); | ||
1819 | 183 | +static void gsm_logout_dialog_set_timeout (GsmLogoutDialog *logout_dialog, | ||
1820 | 184 | + int seconds); | ||
1821 | 185 | |||
1822 | 186 | static void gsm_logout_dialog_destroy (GsmLogoutDialog *logout_dialog, | ||
1823 | 187 | gpointer data); | ||
1824 | 188 | @@ -71,43 +81,10 @@ | ||
1825 | 189 | static void gsm_logout_dialog_show (GsmLogoutDialog *logout_dialog, | ||
1826 | 190 | gpointer data); | ||
1827 | 191 | |||
1828 | 192 | -enum { | ||
1829 | 193 | - PROP_0, | ||
1830 | 194 | - PROP_MESSAGE_TYPE | ||
1831 | 195 | -}; | ||
1832 | 196 | - | ||
1833 | 197 | -G_DEFINE_TYPE (GsmLogoutDialog, gsm_logout_dialog, GTK_TYPE_MESSAGE_DIALOG); | ||
1834 | 198 | - | ||
1835 | 199 | -static void | ||
1836 | 200 | -gsm_logout_dialog_set_property (GObject *object, | ||
1837 | 201 | - guint prop_id, | ||
1838 | 202 | - const GValue *value, | ||
1839 | 203 | - GParamSpec *pspec) | ||
1840 | 204 | -{ | ||
1841 | 205 | - switch (prop_id) { | ||
1842 | 206 | - case PROP_MESSAGE_TYPE: | ||
1843 | 207 | - break; | ||
1844 | 208 | - default: | ||
1845 | 209 | - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); | ||
1846 | 210 | - break; | ||
1847 | 211 | - } | ||
1848 | 212 | -} | ||
1849 | 213 | +static void gsm_logout_set_info_text (GsmLogoutDialog *logout_dialog, | ||
1850 | 214 | + int seconds); | ||
1851 | 215 | |||
1852 | 216 | -static void | ||
1853 | 217 | -gsm_logout_dialog_get_property (GObject *object, | ||
1854 | 218 | - guint prop_id, | ||
1855 | 219 | - GValue *value, | ||
1856 | 220 | - GParamSpec *pspec) | ||
1857 | 221 | -{ | ||
1858 | 222 | - switch (prop_id) { | ||
1859 | 223 | - case PROP_MESSAGE_TYPE: | ||
1860 | 224 | - g_value_set_enum (value, GTK_MESSAGE_WARNING); | ||
1861 | 225 | - break; | ||
1862 | 226 | - default: | ||
1863 | 227 | - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); | ||
1864 | 228 | - break; | ||
1865 | 229 | - } | ||
1866 | 230 | -} | ||
1867 | 231 | +G_DEFINE_TYPE (GsmLogoutDialog, gsm_logout_dialog, GTK_TYPE_DIALOG); | ||
1868 | 232 | |||
1869 | 233 | static void | ||
1870 | 234 | gsm_logout_dialog_class_init (GsmLogoutDialogClass *klass) | ||
1871 | 235 | @@ -116,18 +93,6 @@ | ||
1872 | 236 | |||
1873 | 237 | gobject_class = G_OBJECT_CLASS (klass); | ||
1874 | 238 | |||
1875 | 239 | - /* This is a workaround to avoid a stupid crash: libgnomeui | ||
1876 | 240 | - * listens for the "show" signal on all GtkMessageDialog and | ||
1877 | 241 | - * gets the "message-type" of the dialogs. We will crash when | ||
1878 | 242 | - * it accesses this property if we don't override it since we | ||
1879 | 243 | - * didn't define it. */ | ||
1880 | 244 | - gobject_class->set_property = gsm_logout_dialog_set_property; | ||
1881 | 245 | - gobject_class->get_property = gsm_logout_dialog_get_property; | ||
1882 | 246 | - | ||
1883 | 247 | - g_object_class_override_property (gobject_class, | ||
1884 | 248 | - PROP_MESSAGE_TYPE, | ||
1885 | 249 | - "message-type"); | ||
1886 | 250 | - | ||
1887 | 251 | g_type_class_add_private (klass, sizeof (GsmLogoutDialogPrivate)); | ||
1888 | 252 | } | ||
1889 | 253 | |||
1890 | 254 | @@ -139,11 +104,22 @@ | ||
1891 | 255 | logout_dialog->priv->timeout_id = 0; | ||
1892 | 256 | logout_dialog->priv->timeout = 0; | ||
1893 | 257 | logout_dialog->priv->default_response = GTK_RESPONSE_CANCEL; | ||
1894 | 258 | + logout_dialog->priv->info_label = NULL; | ||
1895 | 259 | |||
1896 | 260 | - gtk_window_set_skip_taskbar_hint (GTK_WINDOW (logout_dialog), TRUE); | ||
1897 | 261 | + gtk_window_set_resizable (GTK_WINDOW (logout_dialog), FALSE); | ||
1898 | 262 | gtk_window_set_keep_above (GTK_WINDOW (logout_dialog), TRUE); | ||
1899 | 263 | gtk_window_stick (GTK_WINDOW (logout_dialog)); | ||
1900 | 264 | |||
1901 | 265 | + /* use HIG spacings */ | ||
1902 | 266 | + gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (logout_dialog))), 12); | ||
1903 | 267 | + gtk_container_set_border_width (GTK_CONTAINER (logout_dialog), 6); | ||
1904 | 268 | + | ||
1905 | 269 | + gtk_dialog_add_button (GTK_DIALOG (logout_dialog), GTK_STOCK_HELP, | ||
1906 | 270 | + GTK_RESPONSE_HELP); | ||
1907 | 271 | + logout_dialog->priv->cancel_button = | ||
1908 | 272 | + gtk_dialog_add_button (GTK_DIALOG (logout_dialog), | ||
1909 | 273 | + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL); | ||
1910 | 274 | + | ||
1911 | 275 | logout_dialog->priv->up_client = up_client_new (); | ||
1912 | 276 | |||
1913 | 277 | logout_dialog->priv->consolekit = gsm_get_consolekit (); | ||
1914 | 278 | @@ -239,38 +215,26 @@ | ||
1915 | 279 | static void | ||
1916 | 280 | gsm_logout_dialog_show (GsmLogoutDialog *logout_dialog, gpointer user_data) | ||
1917 | 281 | { | ||
1918 | 282 | - gsm_logout_dialog_set_timeout (logout_dialog); | ||
1919 | 283 | -} | ||
1920 | 284 | + gsm_logout_set_info_text (logout_dialog, AUTOMATIC_ACTION_TIMEOUT); | ||
1921 | 285 | |||
1922 | 286 | -static gboolean | ||
1923 | 287 | -gsm_logout_dialog_timeout (gpointer data) | ||
1924 | 288 | -{ | ||
1925 | 289 | - GsmLogoutDialog *logout_dialog; | ||
1926 | 290 | - char *seconds_warning; | ||
1927 | 291 | - char *secondary_text; | ||
1928 | 292 | - int seconds_to_show; | ||
1929 | 293 | - static char *session_type = NULL; | ||
1930 | 294 | - | ||
1931 | 295 | - logout_dialog = (GsmLogoutDialog *) data; | ||
1932 | 296 | - | ||
1933 | 297 | - if (!logout_dialog->priv->timeout) { | ||
1934 | 298 | - gtk_dialog_response (GTK_DIALOG (logout_dialog), | ||
1935 | 299 | - logout_dialog->priv->default_response); | ||
1936 | 300 | - | ||
1937 | 301 | - return FALSE; | ||
1938 | 302 | - } | ||
1939 | 303 | + if (logout_dialog->priv->default_response != GTK_RESPONSE_CANCEL) | ||
1940 | 304 | + gsm_logout_dialog_set_timeout (logout_dialog, | ||
1941 | 305 | + AUTOMATIC_ACTION_TIMEOUT); | ||
1942 | 306 | +} | ||
1943 | 307 | |||
1944 | 308 | - if (logout_dialog->priv->timeout <= 30) { | ||
1945 | 309 | - seconds_to_show = logout_dialog->priv->timeout; | ||
1946 | 310 | - } else { | ||
1947 | 311 | - seconds_to_show = (logout_dialog->priv->timeout/10) * 10; | ||
1948 | 312 | |||
1949 | 313 | - if (logout_dialog->priv->timeout % 10) | ||
1950 | 314 | - seconds_to_show += 10; | ||
1951 | 315 | - } | ||
1952 | 316 | +static void | ||
1953 | 317 | +gsm_logout_set_info_text (GsmLogoutDialog *logout_dialog, | ||
1954 | 318 | + int seconds_to_show) | ||
1955 | 319 | +{ | ||
1956 | 320 | + const char *seconds_warning; | ||
1957 | 321 | + char *secondary_text; | ||
1958 | 322 | + char *buf; | ||
1959 | 323 | + char *markup; | ||
1960 | 324 | + static char *session_type = NULL; | ||
1961 | 325 | |||
1962 | 326 | - switch (logout_dialog->priv->type) { | ||
1963 | 327 | - case GSM_DIALOG_LOGOUT_TYPE_LOGOUT: | ||
1964 | 328 | + switch (logout_dialog->priv->default_response) { | ||
1965 | 329 | + case GSM_LOGOUT_RESPONSE_LOGOUT: | ||
1966 | 330 | /* This string is shared with gsm-fail-whale-dialog.c */ | ||
1967 | 331 | seconds_warning = ngettext ("You will be automatically logged " | ||
1968 | 332 | "out in %d second.", | ||
1969 | 333 | @@ -279,7 +243,7 @@ | ||
1970 | 334 | seconds_to_show); | ||
1971 | 335 | break; | ||
1972 | 336 | |||
1973 | 337 | - case GSM_DIALOG_LOGOUT_TYPE_SHUTDOWN: | ||
1974 | 338 | + case GSM_LOGOUT_RESPONSE_SHUTDOWN: | ||
1975 | 339 | seconds_warning = ngettext ("This system will be automatically " | ||
1976 | 340 | "shut down in %d second.", | ||
1977 | 341 | "This system will be automatically " | ||
1978 | 342 | @@ -287,6 +251,10 @@ | ||
1979 | 343 | seconds_to_show); | ||
1980 | 344 | break; | ||
1981 | 345 | |||
1982 | 346 | + case GTK_RESPONSE_CANCEL: | ||
1983 | 347 | + seconds_warning = ""; | ||
1984 | 348 | + break; | ||
1985 | 349 | + | ||
1986 | 350 | default: | ||
1987 | 351 | g_assert_not_reached (); | ||
1988 | 352 | } | ||
1989 | 353 | @@ -321,25 +289,50 @@ | ||
1990 | 354 | secondary_text = g_strdup (seconds_warning); | ||
1991 | 355 | } | ||
1992 | 356 | |||
1993 | 357 | - gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (logout_dialog), | ||
1994 | 358 | - secondary_text, | ||
1995 | 359 | - seconds_to_show, | ||
1996 | 360 | - NULL); | ||
1997 | 361 | + buf = g_strdup_printf (secondary_text, seconds_to_show); | ||
1998 | 362 | + markup = g_markup_printf_escaped ("<i>%s</i>", buf); | ||
1999 | 363 | + g_free (buf); | ||
2000 | 364 | + gtk_label_set_markup (GTK_LABEL (logout_dialog->priv->info_label), | ||
2001 | 365 | + markup); | ||
2002 | 366 | + g_free (markup); | ||
2003 | 367 | +} | ||
2004 | 368 | |||
2005 | 369 | - logout_dialog->priv->timeout--; | ||
2006 | 370 | +static gboolean | ||
2007 | 371 | +gsm_logout_dialog_timeout (gpointer data) | ||
2008 | 372 | +{ | ||
2009 | 373 | + GsmLogoutDialog *logout_dialog; | ||
2010 | 374 | + int seconds_to_show; | ||
2011 | 375 | + | ||
2012 | 376 | + logout_dialog = (GsmLogoutDialog *) data; | ||
2013 | 377 | + | ||
2014 | 378 | + if (!logout_dialog->priv->timeout) { | ||
2015 | 379 | + gtk_dialog_response (GTK_DIALOG (logout_dialog), | ||
2016 | 380 | + logout_dialog->priv->default_response); | ||
2017 | 381 | + | ||
2018 | 382 | + return FALSE; | ||
2019 | 383 | + } | ||
2020 | 384 | + | ||
2021 | 385 | + if (logout_dialog->priv->timeout <= 30) { | ||
2022 | 386 | + seconds_to_show = logout_dialog->priv->timeout; | ||
2023 | 387 | + } else { | ||
2024 | 388 | + seconds_to_show = (logout_dialog->priv->timeout/10) * 10; | ||
2025 | 389 | + | ||
2026 | 390 | + if (logout_dialog->priv->timeout % 10) | ||
2027 | 391 | + seconds_to_show += 10; | ||
2028 | 392 | + } | ||
2029 | 393 | |||
2030 | 394 | - g_free (secondary_text); | ||
2031 | 395 | + gsm_logout_set_info_text (logout_dialog, seconds_to_show); | ||
2032 | 396 | + | ||
2033 | 397 | + logout_dialog->priv->timeout--; | ||
2034 | 398 | |||
2035 | 399 | return TRUE; | ||
2036 | 400 | } | ||
2037 | 401 | |||
2038 | 402 | static void | ||
2039 | 403 | -gsm_logout_dialog_set_timeout (GsmLogoutDialog *logout_dialog) | ||
2040 | 404 | +gsm_logout_dialog_set_timeout (GsmLogoutDialog *logout_dialog, | ||
2041 | 405 | + int seconds) | ||
2042 | 406 | { | ||
2043 | 407 | - logout_dialog->priv->timeout = AUTOMATIC_ACTION_TIMEOUT; | ||
2044 | 408 | - | ||
2045 | 409 | - /* Sets the secondary text */ | ||
2046 | 410 | - gsm_logout_dialog_timeout (logout_dialog); | ||
2047 | 411 | + logout_dialog->priv->timeout = seconds; | ||
2048 | 412 | |||
2049 | 413 | if (logout_dialog->priv->timeout_id != 0) { | ||
2050 | 414 | g_source_remove (logout_dialog->priv->timeout_id); | ||
2051 | 415 | @@ -351,14 +344,120 @@ | ||
2052 | 416 | } | ||
2053 | 417 | |||
2054 | 418 | static GtkWidget * | ||
2055 | 419 | +gsm_logout_tile_new (const char *icon_name, | ||
2056 | 420 | + const char *title, | ||
2057 | 421 | + const char *description) | ||
2058 | 422 | +{ | ||
2059 | 423 | + GtkWidget *button; | ||
2060 | 424 | + GtkWidget *alignment; | ||
2061 | 425 | + GtkWidget *hbox; | ||
2062 | 426 | + GtkWidget *vbox; | ||
2063 | 427 | + GtkWidget *image; | ||
2064 | 428 | + GtkWidget *label; | ||
2065 | 429 | + char *markup; | ||
2066 | 430 | + | ||
2067 | 431 | + g_assert (title != NULL); | ||
2068 | 432 | + | ||
2069 | 433 | + button = GTK_WIDGET (gtk_button_new ()); | ||
2070 | 434 | + gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE); | ||
2071 | 435 | + | ||
2072 | 436 | + alignment = gtk_alignment_new (0, 0.5, 0, 0); | ||
2073 | 437 | + gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 0, 0, 6, 6); | ||
2074 | 438 | + gtk_container_add (GTK_CONTAINER (button), alignment); | ||
2075 | 439 | + | ||
2076 | 440 | + hbox = gtk_hbox_new (FALSE, 12); | ||
2077 | 441 | + gtk_container_add (GTK_CONTAINER (alignment), hbox); | ||
2078 | 442 | + if (icon_name != NULL) { | ||
2079 | 443 | + image = gtk_image_new_from_icon_name (icon_name, | ||
2080 | 444 | + GTK_ICON_SIZE_DIALOG); | ||
2081 | 445 | + gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0); | ||
2082 | 446 | + } | ||
2083 | 447 | + | ||
2084 | 448 | + vbox = gtk_vbox_new (FALSE, 2); | ||
2085 | 449 | + | ||
2086 | 450 | + markup = g_markup_printf_escaped ("<span weight=\"bold\">%s</span>", | ||
2087 | 451 | + title); | ||
2088 | 452 | + label = gtk_label_new (markup); | ||
2089 | 453 | + g_free (markup); | ||
2090 | 454 | + | ||
2091 | 455 | + gtk_label_set_use_markup (GTK_LABEL (label), TRUE); | ||
2092 | 456 | + gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); | ||
2093 | 457 | + gtk_label_set_use_underline (GTK_LABEL (label), TRUE); | ||
2094 | 458 | + | ||
2095 | 459 | + gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0); | ||
2096 | 460 | + | ||
2097 | 461 | + if (description != NULL) { | ||
2098 | 462 | + gchar *markup; | ||
2099 | 463 | + GdkColor *color; | ||
2100 | 464 | + GtkWidget *label; | ||
2101 | 465 | + GtkStyle *style; | ||
2102 | 466 | + | ||
2103 | 467 | + style = gtk_widget_get_style (GTK_WIDGET (button)); | ||
2104 | 468 | + color = &style->fg[GTK_STATE_INSENSITIVE]; | ||
2105 | 469 | + markup = g_markup_printf_escaped ("<span size=\"small\" foreground=\"#%.2x%.2x%.2x\">%s</span>", | ||
2106 | 470 | + color->red, | ||
2107 | 471 | + color->green, | ||
2108 | 472 | + color->blue, | ||
2109 | 473 | + description); | ||
2110 | 474 | + label = gtk_label_new (markup); | ||
2111 | 475 | + g_free (markup); | ||
2112 | 476 | + | ||
2113 | 477 | + gtk_label_set_use_markup (GTK_LABEL (label), TRUE); | ||
2114 | 478 | + gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); | ||
2115 | 479 | + gtk_label_set_use_underline (GTK_LABEL (label), TRUE); | ||
2116 | 480 | + gtk_label_set_line_wrap (GTK_LABEL (label), TRUE); | ||
2117 | 481 | + | ||
2118 | 482 | + gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0); | ||
2119 | 483 | + } | ||
2120 | 484 | + | ||
2121 | 485 | + gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0); | ||
2122 | 486 | + | ||
2123 | 487 | + return button; | ||
2124 | 488 | +} | ||
2125 | 489 | + | ||
2126 | 490 | +static void | ||
2127 | 491 | +gsm_logout_tile_clicked (GtkWidget *tile, | ||
2128 | 492 | + gpointer response_p) | ||
2129 | 493 | +{ | ||
2130 | 494 | + GtkWidget *dialog; | ||
2131 | 495 | + | ||
2132 | 496 | + dialog = gtk_widget_get_toplevel (tile); | ||
2133 | 497 | + g_assert (GTK_IS_DIALOG (dialog)); | ||
2134 | 498 | + gtk_dialog_response (GTK_DIALOG (dialog), | ||
2135 | 499 | + GPOINTER_TO_UINT (response_p)); | ||
2136 | 500 | +} | ||
2137 | 501 | + | ||
2138 | 502 | +static GtkWidget * | ||
2139 | 503 | +gsm_logout_append_tile (GtkWidget *vbox, | ||
2140 | 504 | + unsigned int response, | ||
2141 | 505 | + const char *icon_name, | ||
2142 | 506 | + const char *title, | ||
2143 | 507 | + const char *description) | ||
2144 | 508 | +{ | ||
2145 | 509 | + GtkWidget *tile; | ||
2146 | 510 | + | ||
2147 | 511 | + tile = gsm_logout_tile_new (icon_name, title, description); | ||
2148 | 512 | + gtk_box_pack_start (GTK_BOX (vbox), tile, TRUE, TRUE, 0); | ||
2149 | 513 | + gtk_widget_show_all (tile); | ||
2150 | 514 | + | ||
2151 | 515 | + g_signal_connect (tile, | ||
2152 | 516 | + "clicked", | ||
2153 | 517 | + G_CALLBACK (gsm_logout_tile_clicked), | ||
2154 | 518 | + GUINT_TO_POINTER (response)); | ||
2155 | 519 | + | ||
2156 | 520 | + return tile; | ||
2157 | 521 | +} | ||
2158 | 522 | + | ||
2159 | 523 | +static GtkWidget * | ||
2160 | 524 | gsm_get_dialog (GsmDialogLogoutType type, | ||
2161 | 525 | GdkScreen *screen, | ||
2162 | 526 | guint32 activate_time) | ||
2163 | 527 | { | ||
2164 | 528 | GsmLogoutDialog *logout_dialog; | ||
2165 | 529 | - GtkWidget *dialog_image; | ||
2166 | 530 | - const char *primary_text; | ||
2167 | 531 | + GtkWidget *vbox; | ||
2168 | 532 | + GtkWidget *tile; | ||
2169 | 533 | const char *icon_name; | ||
2170 | 534 | + const char *title; | ||
2171 | 535 | |||
2172 | 536 | if (current_dialog != NULL) { | ||
2173 | 537 | gtk_widget_destroy (GTK_WIDGET (current_dialog)); | ||
2174 | 538 | @@ -368,83 +467,119 @@ | ||
2175 | 539 | |||
2176 | 540 | current_dialog = logout_dialog; | ||
2177 | 541 | |||
2178 | 542 | - gtk_window_set_title (GTK_WINDOW (logout_dialog), ""); | ||
2179 | 543 | - | ||
2180 | 544 | - logout_dialog->priv->type = type; | ||
2181 | 545 | + vbox = gtk_vbox_new (FALSE, 12); | ||
2182 | 546 | + gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (logout_dialog))), vbox, | ||
2183 | 547 | + FALSE, FALSE, 0); | ||
2184 | 548 | + gtk_container_set_border_width (GTK_CONTAINER (vbox), 6); | ||
2185 | 549 | + gtk_widget_show (vbox); | ||
2186 | 550 | |||
2187 | 551 | icon_name = NULL; | ||
2188 | 552 | - primary_text = NULL; | ||
2189 | 553 | + title = NULL; | ||
2190 | 554 | |||
2191 | 555 | switch (type) { | ||
2192 | 556 | case GSM_DIALOG_LOGOUT_TYPE_LOGOUT: | ||
2193 | 557 | icon_name = GSM_ICON_LOGOUT; | ||
2194 | 558 | - primary_text = _("Log out of this system now?"); | ||
2195 | 559 | + title = _("Log Out of the Session"); | ||
2196 | 560 | |||
2197 | 561 | logout_dialog->priv->default_response = GSM_LOGOUT_RESPONSE_LOGOUT; | ||
2198 | 562 | |||
2199 | 563 | - if (gsm_logout_supports_switch_user (logout_dialog)) { | ||
2200 | 564 | - gtk_dialog_add_button (GTK_DIALOG (logout_dialog), | ||
2201 | 565 | + | ||
2202 | 566 | + gsm_logout_append_tile (vbox, GSM_LOGOUT_RESPONSE_LOGOUT, | ||
2203 | 567 | + GSM_ICON_LOGOUT, _("_Log Out"), | ||
2204 | 568 | + _("Ends your session and logs you " | ||
2205 | 569 | + "out.")); | ||
2206 | 570 | + | ||
2207 | 571 | + tile = gsm_logout_append_tile (vbox, | ||
2208 | 572 | + GSM_LOGOUT_RESPONSE_SWITCH_USER, | ||
2209 | 573 | + GSM_ICON_SWITCH, | ||
2210 | 574 | _("_Switch User"), | ||
2211 | 575 | - GSM_LOGOUT_RESPONSE_SWITCH_USER); | ||
2212 | 576 | + _("Suspends your session, " | ||
2213 | 577 | + "allowing another user to " | ||
2214 | 578 | + "log in and use the " | ||
2215 | 579 | + "computer.")); | ||
2216 | 580 | + if (!gsm_logout_supports_switch_user (logout_dialog)) { | ||
2217 | 581 | + gtk_widget_set_sensitive (tile, FALSE); | ||
2218 | 582 | } | ||
2219 | 583 | |||
2220 | 584 | - gtk_dialog_add_button (GTK_DIALOG (logout_dialog), | ||
2221 | 585 | - GTK_STOCK_CANCEL, | ||
2222 | 586 | - GTK_RESPONSE_CANCEL); | ||
2223 | 587 | - | ||
2224 | 588 | - gtk_dialog_add_button (GTK_DIALOG (logout_dialog), | ||
2225 | 589 | - _("_Log Out"), | ||
2226 | 590 | - GSM_LOGOUT_RESPONSE_LOGOUT); | ||
2227 | 591 | - | ||
2228 | 592 | break; | ||
2229 | 593 | case GSM_DIALOG_LOGOUT_TYPE_SHUTDOWN: | ||
2230 | 594 | icon_name = GSM_ICON_SHUTDOWN; | ||
2231 | 595 | - primary_text = _("Shut down this system now?"); | ||
2232 | 596 | + title = _("Shut Down the Computer"); | ||
2233 | 597 | |||
2234 | 598 | logout_dialog->priv->default_response = GSM_LOGOUT_RESPONSE_SHUTDOWN; | ||
2235 | 599 | |||
2236 | 600 | - if (gsm_logout_supports_system_suspend (logout_dialog)) { | ||
2237 | 601 | - gtk_dialog_add_button (GTK_DIALOG (logout_dialog), | ||
2238 | 602 | - _("S_uspend"), | ||
2239 | 603 | - GSM_LOGOUT_RESPONSE_SLEEP); | ||
2240 | 604 | + tile = gsm_logout_append_tile (vbox, | ||
2241 | 605 | + GSM_LOGOUT_RESPONSE_SHUTDOWN, | ||
2242 | 606 | + GSM_ICON_SHUTDOWN, | ||
2243 | 607 | + _("_Shut Down"), | ||
2244 | 608 | + _("Ends your session and turns " | ||
2245 | 609 | + "off the computer.")); | ||
2246 | 610 | + if (!gsm_logout_supports_shutdown (logout_dialog)) { | ||
2247 | 611 | + gtk_widget_set_sensitive (tile, FALSE); | ||
2248 | 612 | + /* If shutdown is not available, let's just fallback | ||
2249 | 613 | + * on cancel as the default action. We could fallback | ||
2250 | 614 | + * on reboot first, then suspend and then hibernate | ||
2251 | 615 | + * but it's not that useful, really */ | ||
2252 | 616 | + logout_dialog->priv->default_response = GTK_RESPONSE_CANCEL; | ||
2253 | 617 | } | ||
2254 | 618 | |||
2255 | 619 | - if (gsm_logout_supports_system_hibernate (logout_dialog)) { | ||
2256 | 620 | - gtk_dialog_add_button (GTK_DIALOG (logout_dialog), | ||
2257 | 621 | - _("_Hibernate"), | ||
2258 | 622 | - GSM_LOGOUT_RESPONSE_HIBERNATE); | ||
2259 | 623 | + tile = gsm_logout_append_tile (vbox, | ||
2260 | 624 | + GSM_LOGOUT_RESPONSE_REBOOT, | ||
2261 | 625 | + GSM_ICON_REBOOT, _("_Restart"), | ||
2262 | 626 | + _("Ends your session and " | ||
2263 | 627 | + "restarts the computer.")); | ||
2264 | 628 | + if (!gsm_logout_supports_reboot (logout_dialog)) { | ||
2265 | 629 | + gtk_widget_set_sensitive (tile, FALSE); | ||
2266 | 630 | } | ||
2267 | 631 | |||
2268 | 632 | - if (gsm_logout_supports_reboot (logout_dialog)) { | ||
2269 | 633 | - gtk_dialog_add_button (GTK_DIALOG (logout_dialog), | ||
2270 | 634 | - _("_Restart"), | ||
2271 | 635 | - GSM_LOGOUT_RESPONSE_REBOOT); | ||
2272 | 636 | + /* We don't set those options insensitive if they are no | ||
2273 | 637 | + * supported (like we do for shutdown/restart) since some | ||
2274 | 638 | + * hardware just don't support suspend/hibernate. So we | ||
2275 | 639 | + * don't show those options in this case. */ | ||
2276 | 640 | + if (gsm_logout_supports_system_suspend (logout_dialog)) { | ||
2277 | 641 | + gsm_logout_append_tile (vbox, | ||
2278 | 642 | + GSM_LOGOUT_RESPONSE_SLEEP, | ||
2279 | 643 | + GSM_ICON_SLEEP, _("S_uspend"), | ||
2280 | 644 | + _("Suspends your session " | ||
2281 | 645 | + "quickly, using minimal " | ||
2282 | 646 | + "power while the computer " | ||
2283 | 647 | + "stands by.")); | ||
2284 | 648 | } | ||
2285 | 649 | |||
2286 | 650 | - gtk_dialog_add_button (GTK_DIALOG (logout_dialog), | ||
2287 | 651 | - GTK_STOCK_CANCEL, | ||
2288 | 652 | - GTK_RESPONSE_CANCEL); | ||
2289 | 653 | - | ||
2290 | 654 | - if (gsm_logout_supports_shutdown (logout_dialog)) { | ||
2291 | 655 | - gtk_dialog_add_button (GTK_DIALOG (logout_dialog), | ||
2292 | 656 | - _("_Shut Down"), | ||
2293 | 657 | - GSM_LOGOUT_RESPONSE_SHUTDOWN); | ||
2294 | 658 | + if (gsm_logout_supports_system_hibernate (logout_dialog)) { | ||
2295 | 659 | + gsm_logout_append_tile (vbox, | ||
2296 | 660 | + GSM_LOGOUT_RESPONSE_HIBERNATE, | ||
2297 | 661 | + GSM_ICON_HIBERNATE, | ||
2298 | 662 | + _("_Hibernate"), | ||
2299 | 663 | + _("Suspends your session, " | ||
2300 | 664 | + "using no power until the " | ||
2301 | 665 | + "computer is restarted.")); | ||
2302 | 666 | } | ||
2303 | 667 | + | ||
2304 | 668 | break; | ||
2305 | 669 | default: | ||
2306 | 670 | g_assert_not_reached (); | ||
2307 | 671 | } | ||
2308 | 672 | |||
2309 | 673 | - dialog_image = gtk_message_dialog_get_image (GTK_MESSAGE_DIALOG (logout_dialog)); | ||
2310 | 674 | + logout_dialog->priv->info_label = gtk_label_new (""); | ||
2311 | 675 | + gtk_label_set_line_wrap (GTK_LABEL (logout_dialog->priv->info_label), | ||
2312 | 676 | + TRUE); | ||
2313 | 677 | + gtk_box_pack_start (GTK_BOX (vbox), logout_dialog->priv->info_label, | ||
2314 | 678 | + TRUE, TRUE, 0); | ||
2315 | 679 | + gtk_widget_show (logout_dialog->priv->info_label); | ||
2316 | 680 | |||
2317 | 681 | - gtk_image_set_from_icon_name (GTK_IMAGE (dialog_image), | ||
2318 | 682 | - icon_name, GTK_ICON_SIZE_DIALOG); | ||
2319 | 683 | gtk_window_set_icon_name (GTK_WINDOW (logout_dialog), icon_name); | ||
2320 | 684 | - gtk_window_set_position (GTK_WINDOW (logout_dialog), GTK_WIN_POS_CENTER_ALWAYS); | ||
2321 | 685 | - gtk_message_dialog_set_markup (GTK_MESSAGE_DIALOG (logout_dialog), primary_text); | ||
2322 | 686 | + gtk_window_set_title (GTK_WINDOW (logout_dialog), title); | ||
2323 | 687 | + gtk_window_set_position (GTK_WINDOW (logout_dialog), | ||
2324 | 688 | + GTK_WIN_POS_CENTER_ALWAYS); | ||
2325 | 689 | |||
2326 | 690 | gtk_dialog_set_default_response (GTK_DIALOG (logout_dialog), | ||
2327 | 691 | logout_dialog->priv->default_response); | ||
2328 | 692 | + /* Note that focus is on the widget for the default response by default | ||
2329 | 693 | + * (since they're the first widget, except when it's Cancel */ | ||
2330 | 694 | + if (logout_dialog->priv->default_response == GTK_RESPONSE_CANCEL) | ||
2331 | 695 | + gtk_window_set_focus (GTK_WINDOW (logout_dialog), | ||
2332 | 696 | + logout_dialog->priv->cancel_button); | ||
2333 | 697 | |||
2334 | 698 | gtk_window_set_screen (GTK_WINDOW (logout_dialog), screen); | ||
2335 | 699 | |||
2336 | 700 | 0 | ||
2337 | === modified file 'debian/patches/95_dbus_request_shutdown.patch' | |||
2338 | --- debian/patches/95_dbus_request_shutdown.patch 2013-06-08 23:25:03 +0000 | |||
2339 | +++ debian/patches/95_dbus_request_shutdown.patch 2014-10-31 04:52:33 +0000 | |||
2340 | @@ -2,11 +2,9 @@ | |||
2341 | 2 | other applications to shutdown or reboot the machine via the session manager | 2 | other applications to shutdown or reboot the machine via the session manager |
2342 | 3 | Author: Chris Coulson <chrisccoulson@ubuntu.com> | 3 | Author: Chris Coulson <chrisccoulson@ubuntu.com> |
2343 | 4 | 4 | ||
2349 | 5 | Index: gnome-session-3.7.3/gnome-session/gsm-manager.c | 5 | --- a/gnome-session/gsm-manager.c |
2350 | 6 | =================================================================== | 6 | +++ b/gnome-session/gsm-manager.c |
2351 | 7 | --- gnome-session-3.7.3.orig/gnome-session/gsm-manager.c 2013-01-07 12:51:02.026999067 +1300 | 7 | @@ -3116,6 +3116,48 @@ |
2347 | 8 | +++ gnome-session-3.7.3/gnome-session/gsm-manager.c 2013-01-07 12:51:02.022999066 +1300 | ||
2348 | 9 | @@ -3664,6 +3664,48 @@ | ||
2352 | 10 | } | 8 | } |
2353 | 11 | 9 | ||
2354 | 12 | gboolean | 10 | gboolean |
2355 | @@ -52,14 +50,12 @@ | |||
2356 | 52 | +} | 50 | +} |
2357 | 53 | + | 51 | + |
2358 | 54 | +gboolean | 52 | +gboolean |
2361 | 55 | gsm_manager_shutdown (GsmManager *manager, | 53 | gsm_manager_shutdown (GsmManager *manager, |
2362 | 56 | GError **error) | 54 | DBusGMethodInvocation *context) |
2363 | 57 | { | 55 | { |
2369 | 58 | Index: gnome-session-3.7.3/gnome-session/gsm-manager.h | 56 | --- a/gnome-session/gsm-manager.h |
2370 | 59 | =================================================================== | 57 | +++ b/gnome-session/gsm-manager.h |
2371 | 60 | --- gnome-session-3.7.3.orig/gnome-session/gsm-manager.h 2013-01-07 12:51:02.026999067 +1300 | 58 | @@ -159,7 +159,10 @@ |
2367 | 61 | +++ gnome-session-3.7.3/gnome-session/gsm-manager.h 2013-01-07 12:51:02.022999066 +1300 | ||
2368 | 62 | @@ -160,7 +160,10 @@ | ||
2372 | 63 | guint flags, | 59 | guint flags, |
2373 | 64 | gboolean *is_inhibited, | 60 | gboolean *is_inhibited, |
2374 | 65 | GError *error); | 61 | GError *error); |
2375 | @@ -69,13 +65,11 @@ | |||
2376 | 69 | +gboolean gsm_manager_request_reboot (GsmManager *manager, | 65 | +gboolean gsm_manager_request_reboot (GsmManager *manager, |
2377 | 70 | + GError **error); | 66 | + GError **error); |
2378 | 71 | gboolean gsm_manager_shutdown (GsmManager *manager, | 67 | gboolean gsm_manager_shutdown (GsmManager *manager, |
2380 | 72 | GError **error); | 68 | DBusGMethodInvocation *context); |
2381 | 73 | gboolean gsm_manager_reboot (GsmManager *manager, | 69 | gboolean gsm_manager_reboot (GsmManager *manager, |
2387 | 74 | Index: gnome-session-3.7.3/gnome-session/org.gnome.SessionManager.xml | 70 | --- a/gnome-session/org.gnome.SessionManager.xml |
2388 | 75 | =================================================================== | 71 | +++ b/gnome-session/org.gnome.SessionManager.xml |
2389 | 76 | --- gnome-session-3.7.3.orig/gnome-session/org.gnome.SessionManager.xml 2013-01-07 12:51:02.026999067 +1300 | 72 | @@ -348,6 +348,23 @@ |
2385 | 77 | +++ gnome-session-3.7.3/gnome-session/org.gnome.SessionManager.xml 2013-01-07 12:51:02.022999066 +1300 | ||
2386 | 78 | @@ -346,6 +346,23 @@ | ||
2390 | 79 | </doc:doc> | 73 | </doc:doc> |
2391 | 80 | </method> | 74 | </method> |
2392 | 81 | 75 | ||
2393 | 82 | 76 | ||
2394 | === removed file 'debian/patches/git_fix_wrong_unref_call.patch' | |||
2395 | --- debian/patches/git_fix_wrong_unref_call.patch 2013-10-11 13:45:07 +0000 | |||
2396 | +++ debian/patches/git_fix_wrong_unref_call.patch 1970-01-01 00:00:00 +0000 | |||
2397 | @@ -1,32 +0,0 @@ | |||
2398 | 1 | Subject: shell: unref correct proxy on destroy | ||
2399 | 2 | |||
2400 | 3 | gsm-shell.c tries to automatically clear it's reference to the | ||
2401 | 4 | EndSessionDialog proxy when the proxy is destroyed. | ||
2402 | 5 | |||
2403 | 6 | It accidentally unrefs the wrong object though. This commit | ||
2404 | 7 | fixes that by changing the open coded unref+nullify to g_clear_object | ||
2405 | 8 | |||
2406 | 9 | I believe this will address this crasher: | ||
2407 | 10 | |||
2408 | 11 | https://retrace.fedoraproject.org/faf/problems/1214348/ | ||
2409 | 12 | |||
2410 | 13 | https://bugzilla.gnome.org/show_bug.cgi?id=709221 | ||
2411 | 14 | --- | ||
2412 | 15 | diff --git a/gnome-session/gsm-shell.c b/gnome-session/gsm-shell.c | ||
2413 | 16 | index 450ca40..1c7f053 100644 | ||
2414 | 17 | --- a/gnome-session/gsm-shell.c | ||
2415 | 18 | +++ b/gnome-session/gsm-shell.c | ||
2416 | 19 | @@ -534,11 +534,7 @@ static void | ||
2417 | 20 | on_end_session_dialog_proxy_destroyed (DBusGProxy *proxy, | ||
2418 | 21 | GsmShell *shell) | ||
2419 | 22 | { | ||
2420 | 23 | - /* FIXME - is this right? */ | ||
2421 | 24 | - if (shell->priv->end_session_dialog_proxy != NULL) { | ||
2422 | 25 | - g_object_unref (shell->priv->proxy); | ||
2423 | 26 | - shell->priv->end_session_dialog_proxy = NULL; | ||
2424 | 27 | - } | ||
2425 | 28 | + g_clear_object (&shell->priv->end_session_dialog_proxy); | ||
2426 | 29 | } | ||
2427 | 30 | |||
2428 | 31 | static gboolean | ||
2429 | 32 | |||
2430 | 33 | 0 | ||
2431 | === added file 'debian/patches/revert_remove_gnome_session_properties.patch' | |||
2432 | --- debian/patches/revert_remove_gnome_session_properties.patch 1970-01-01 00:00:00 +0000 | |||
2433 | +++ debian/patches/revert_remove_gnome_session_properties.patch 2014-10-31 04:52:33 +0000 | |||
2434 | @@ -0,0 +1,3992 @@ | |||
2435 | 1 | From 172a7377d00be077c96e9951941c070d491b0b4b Mon Sep 17 00:00:00 2001 | ||
2436 | 2 | From: Tim Lunn <tim@feathertop.org> | ||
2437 | 3 | Date: Fri, 31 Oct 2014 09:23:49 +1100 | ||
2438 | 4 | Subject: [PATCH] Revert "Remove gnome-session-properties" | ||
2439 | 5 | |||
2440 | 6 | This reverts commit ea285af9962313ee2675fff27d3a852bb61e936a. | ||
2441 | 7 | --- | ||
2442 | 8 | Makefile.am | 1 + | ||
2443 | 9 | capplet/Makefile.am | 31 + | ||
2444 | 10 | capplet/gsm-app-dialog.c | 540 +++++++++++++ | ||
2445 | 11 | capplet/gsm-app-dialog.h | 66 ++ | ||
2446 | 12 | capplet/gsm-properties-dialog.c | 774 +++++++++++++++++++ | ||
2447 | 13 | capplet/gsm-properties-dialog.h | 57 ++ | ||
2448 | 14 | capplet/gsp-app-manager.c | 593 ++++++++++++++ | ||
2449 | 15 | capplet/gsp-app-manager.h | 81 ++ | ||
2450 | 16 | capplet/gsp-app.c | 1102 +++++++++++++++++++++++++++ | ||
2451 | 17 | capplet/gsp-app.h | 108 +++ | ||
2452 | 18 | capplet/gsp-keyfile.c | 201 +++++ | ||
2453 | 19 | capplet/gsp-keyfile.h | 65 ++ | ||
2454 | 20 | capplet/main.c | 108 +++ | ||
2455 | 21 | configure.ac | 2 + | ||
2456 | 22 | data/Makefile.am | 6 + | ||
2457 | 23 | data/gnome-session-properties.desktop.in.in | 15 + | ||
2458 | 24 | doc/man/Makefile.am | 1 + | ||
2459 | 25 | doc/man/gnome-session-properties.1 | 24 + | ||
2460 | 26 | po/POTFILES.in | 5 + | ||
2461 | 27 | 19 files changed, 3780 insertions(+) | ||
2462 | 28 | create mode 100644 capplet/Makefile.am | ||
2463 | 29 | create mode 100644 capplet/gsm-app-dialog.c | ||
2464 | 30 | create mode 100644 capplet/gsm-app-dialog.h | ||
2465 | 31 | create mode 100644 capplet/gsm-properties-dialog.c | ||
2466 | 32 | create mode 100644 capplet/gsm-properties-dialog.h | ||
2467 | 33 | create mode 100644 capplet/gsp-app-manager.c | ||
2468 | 34 | create mode 100644 capplet/gsp-app-manager.h | ||
2469 | 35 | create mode 100644 capplet/gsp-app.c | ||
2470 | 36 | create mode 100644 capplet/gsp-app.h | ||
2471 | 37 | create mode 100644 capplet/gsp-keyfile.c | ||
2472 | 38 | create mode 100644 capplet/gsp-keyfile.h | ||
2473 | 39 | create mode 100644 capplet/main.c | ||
2474 | 40 | create mode 100644 data/gnome-session-properties.desktop.in.in | ||
2475 | 41 | create mode 100644 doc/man/gnome-session-properties.1 | ||
2476 | 42 | |||
2477 | 43 | Index: gnome-session/Makefile.am | ||
2478 | 44 | =================================================================== | ||
2479 | 45 | --- gnome-session.orig/Makefile.am | ||
2480 | 46 | +++ gnome-session/Makefile.am | ||
2481 | 47 | @@ -1,5 +1,6 @@ | ||
2482 | 48 | SUBDIRS = \ | ||
2483 | 49 | gnome-session \ | ||
2484 | 50 | + capplet \ | ||
2485 | 51 | tools \ | ||
2486 | 52 | data \ | ||
2487 | 53 | doc \ | ||
2488 | 54 | Index: gnome-session/capplet/Makefile.am | ||
2489 | 55 | =================================================================== | ||
2490 | 56 | --- /dev/null | ||
2491 | 57 | +++ gnome-session/capplet/Makefile.am | ||
2492 | 58 | @@ -0,0 +1,31 @@ | ||
2493 | 59 | +bin_PROGRAMS = gnome-session-properties | ||
2494 | 60 | + | ||
2495 | 61 | +AM_CPPFLAGS = \ | ||
2496 | 62 | + $(SESSION_PROPERTIES_CFLAGS) \ | ||
2497 | 63 | + $(GCONF_CFLAGS) \ | ||
2498 | 64 | + -I$(top_srcdir)/gnome-session \ | ||
2499 | 65 | + -DLOCALE_DIR=\""$(datadir)/locale"\" \ | ||
2500 | 66 | + -DGTKBUILDER_DIR=\""$(pkgdatadir)"\" \ | ||
2501 | 67 | + $(DISABLE_DEPRECATED_CFLAGS) | ||
2502 | 68 | + | ||
2503 | 69 | +AM_CFLAGS = $(WARN_CFLAGS) | ||
2504 | 70 | + | ||
2505 | 71 | +gnome_session_properties_SOURCES = \ | ||
2506 | 72 | + main.c \ | ||
2507 | 73 | + gsm-properties-dialog.h \ | ||
2508 | 74 | + gsm-properties-dialog.c \ | ||
2509 | 75 | + gsm-app-dialog.h \ | ||
2510 | 76 | + gsm-app-dialog.c \ | ||
2511 | 77 | + gsp-app.h \ | ||
2512 | 78 | + gsp-app.c \ | ||
2513 | 79 | + gsp-app-manager.h \ | ||
2514 | 80 | + gsp-app-manager.c \ | ||
2515 | 81 | + gsp-keyfile.h \ | ||
2516 | 82 | + gsp-keyfile.c | ||
2517 | 83 | + | ||
2518 | 84 | +gnome_session_properties_LDADD = \ | ||
2519 | 85 | + $(SESSION_PROPERTIES_LIBS) \ | ||
2520 | 86 | + $(top_builddir)/gnome-session/libgsmutil.la \ | ||
2521 | 87 | + $(GCONF_LIBS) | ||
2522 | 88 | + | ||
2523 | 89 | +-include $(top_srcdir)/git.mk | ||
2524 | 90 | Index: gnome-session/capplet/gsm-app-dialog.c | ||
2525 | 91 | =================================================================== | ||
2526 | 92 | --- /dev/null | ||
2527 | 93 | +++ gnome-session/capplet/gsm-app-dialog.c | ||
2528 | 94 | @@ -0,0 +1,540 @@ | ||
2529 | 95 | +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- | ||
2530 | 96 | + * | ||
2531 | 97 | + * Copyright (C) 2008 William Jon McCann <jmccann@redhat.com> | ||
2532 | 98 | + * | ||
2533 | 99 | + * This program is free software; you can redistribute it and/or modify | ||
2534 | 100 | + * it under the terms of the GNU General Public License as published by | ||
2535 | 101 | + * the Free Software Foundation; either version 2 of the License, or | ||
2536 | 102 | + * (at your option) any later version. | ||
2537 | 103 | + * | ||
2538 | 104 | + * This program is distributed in the hope that it will be useful, | ||
2539 | 105 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2540 | 106 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2541 | 107 | + * GNU General Public License for more details. | ||
2542 | 108 | + * | ||
2543 | 109 | + * You should have received a copy of the GNU General Public License | ||
2544 | 110 | + * along with this program; if not, write to the Free Software | ||
2545 | 111 | + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
2546 | 112 | + * | ||
2547 | 113 | + */ | ||
2548 | 114 | + | ||
2549 | 115 | +#include "config.h" | ||
2550 | 116 | + | ||
2551 | 117 | +#include <glib.h> | ||
2552 | 118 | +#include <glib/gi18n.h> | ||
2553 | 119 | +#include <gtk/gtk.h> | ||
2554 | 120 | + | ||
2555 | 121 | +#include "gsm-util.h" | ||
2556 | 122 | + | ||
2557 | 123 | +#include "gsm-app-dialog.h" | ||
2558 | 124 | + | ||
2559 | 125 | +#define GTKBUILDER_FILE "session-properties.ui" | ||
2560 | 126 | + | ||
2561 | 127 | +#define CAPPLET_NAME_ENTRY_WIDGET_NAME "session_properties_name_entry" | ||
2562 | 128 | +#define CAPPLET_COMMAND_ENTRY_WIDGET_NAME "session_properties_command_entry" | ||
2563 | 129 | +#define CAPPLET_COMMENT_ENTRY_WIDGET_NAME "session_properties_comment_entry" | ||
2564 | 130 | +#define CAPPLET_BROWSE_WIDGET_NAME "session_properties_browse_button" | ||
2565 | 131 | + | ||
2566 | 132 | + | ||
2567 | 133 | +#define GSM_APP_DIALOG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSM_TYPE_APP_DIALOG, GsmAppDialogPrivate)) | ||
2568 | 134 | + | ||
2569 | 135 | +struct GsmAppDialogPrivate | ||
2570 | 136 | +{ | ||
2571 | 137 | + GtkWidget *name_entry; | ||
2572 | 138 | + GtkWidget *command_entry; | ||
2573 | 139 | + GtkWidget *comment_entry; | ||
2574 | 140 | + GtkWidget *browse_button; | ||
2575 | 141 | + char *name; | ||
2576 | 142 | + char *command; | ||
2577 | 143 | + char *comment; | ||
2578 | 144 | +}; | ||
2579 | 145 | + | ||
2580 | 146 | +static void gsm_app_dialog_class_init (GsmAppDialogClass *klass); | ||
2581 | 147 | +static void gsm_app_dialog_init (GsmAppDialog *app_dialog); | ||
2582 | 148 | +static void gsm_app_dialog_finalize (GObject *object); | ||
2583 | 149 | + | ||
2584 | 150 | +enum { | ||
2585 | 151 | + PROP_0, | ||
2586 | 152 | + PROP_NAME, | ||
2587 | 153 | + PROP_COMMAND, | ||
2588 | 154 | + PROP_COMMENT | ||
2589 | 155 | +}; | ||
2590 | 156 | + | ||
2591 | 157 | +G_DEFINE_TYPE (GsmAppDialog, gsm_app_dialog, GTK_TYPE_DIALOG) | ||
2592 | 158 | + | ||
2593 | 159 | +static char * | ||
2594 | 160 | +make_exec_uri (const char *exec) | ||
2595 | 161 | +{ | ||
2596 | 162 | + GString *str; | ||
2597 | 163 | + const char *c; | ||
2598 | 164 | + | ||
2599 | 165 | + if (exec == NULL) { | ||
2600 | 166 | + return g_strdup (""); | ||
2601 | 167 | + } | ||
2602 | 168 | + | ||
2603 | 169 | + if (strchr (exec, ' ') == NULL) { | ||
2604 | 170 | + return g_strdup (exec); | ||
2605 | 171 | + } | ||
2606 | 172 | + | ||
2607 | 173 | + str = g_string_new_len (NULL, strlen (exec)); | ||
2608 | 174 | + | ||
2609 | 175 | + str = g_string_append_c (str, '"'); | ||
2610 | 176 | + for (c = exec; *c != '\0'; c++) { | ||
2611 | 177 | + /* FIXME: GKeyFile will add an additional backslach so we'll | ||
2612 | 178 | + * end up with toto\\" instead of toto\" | ||
2613 | 179 | + * We could use g_key_file_set_value(), but then we don't | ||
2614 | 180 | + * benefit from the other escaping that glib is doing... | ||
2615 | 181 | + */ | ||
2616 | 182 | + if (*c == '"') { | ||
2617 | 183 | + str = g_string_append (str, "\\\""); | ||
2618 | 184 | + } else { | ||
2619 | 185 | + str = g_string_append_c (str, *c); | ||
2620 | 186 | + } | ||
2621 | 187 | + } | ||
2622 | 188 | + str = g_string_append_c (str, '"'); | ||
2623 | 189 | + | ||
2624 | 190 | + return g_string_free (str, FALSE); | ||
2625 | 191 | +} | ||
2626 | 192 | + | ||
2627 | 193 | +static void | ||
2628 | 194 | +on_browse_button_clicked (GtkWidget *widget, | ||
2629 | 195 | + GsmAppDialog *dialog) | ||
2630 | 196 | +{ | ||
2631 | 197 | + GtkWidget *chooser; | ||
2632 | 198 | + int response; | ||
2633 | 199 | + | ||
2634 | 200 | + chooser = gtk_file_chooser_dialog_new ("", | ||
2635 | 201 | + GTK_WINDOW (dialog), | ||
2636 | 202 | + GTK_FILE_CHOOSER_ACTION_OPEN, | ||
2637 | 203 | + GTK_STOCK_CANCEL, | ||
2638 | 204 | + GTK_RESPONSE_CANCEL, | ||
2639 | 205 | + GTK_STOCK_OPEN, | ||
2640 | 206 | + GTK_RESPONSE_ACCEPT, | ||
2641 | 207 | + NULL); | ||
2642 | 208 | + | ||
2643 | 209 | + gtk_window_set_transient_for (GTK_WINDOW (chooser), | ||
2644 | 210 | + GTK_WINDOW (dialog)); | ||
2645 | 211 | + | ||
2646 | 212 | + gtk_window_set_destroy_with_parent (GTK_WINDOW (chooser), TRUE); | ||
2647 | 213 | + | ||
2648 | 214 | + gtk_window_set_title (GTK_WINDOW (chooser), _("Select Command")); | ||
2649 | 215 | + | ||
2650 | 216 | + gtk_widget_show (chooser); | ||
2651 | 217 | + | ||
2652 | 218 | + response = gtk_dialog_run (GTK_DIALOG (chooser)); | ||
2653 | 219 | + | ||
2654 | 220 | + if (response == GTK_RESPONSE_ACCEPT) { | ||
2655 | 221 | + char *text; | ||
2656 | 222 | + char *uri; | ||
2657 | 223 | + | ||
2658 | 224 | + text = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (chooser)); | ||
2659 | 225 | + | ||
2660 | 226 | + uri = make_exec_uri (text); | ||
2661 | 227 | + | ||
2662 | 228 | + g_free (text); | ||
2663 | 229 | + | ||
2664 | 230 | + gtk_entry_set_text (GTK_ENTRY (dialog->priv->command_entry), uri); | ||
2665 | 231 | + | ||
2666 | 232 | + g_free (uri); | ||
2667 | 233 | + } | ||
2668 | 234 | + | ||
2669 | 235 | + gtk_widget_destroy (chooser); | ||
2670 | 236 | +} | ||
2671 | 237 | + | ||
2672 | 238 | +static void | ||
2673 | 239 | +on_entry_activate (GtkEntry *entry, | ||
2674 | 240 | + GsmAppDialog *dialog) | ||
2675 | 241 | +{ | ||
2676 | 242 | + gtk_dialog_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK); | ||
2677 | 243 | +} | ||
2678 | 244 | + | ||
2679 | 245 | +static void | ||
2680 | 246 | +setup_dialog (GsmAppDialog *dialog) | ||
2681 | 247 | +{ | ||
2682 | 248 | + GtkWidget *content_area; | ||
2683 | 249 | + GtkWidget *widget; | ||
2684 | 250 | + GtkBuilder *xml; | ||
2685 | 251 | + GError *error; | ||
2686 | 252 | + | ||
2687 | 253 | + xml = gtk_builder_new (); | ||
2688 | 254 | + gtk_builder_set_translation_domain (xml, GETTEXT_PACKAGE); | ||
2689 | 255 | + | ||
2690 | 256 | + error = NULL; | ||
2691 | 257 | + if (!gtk_builder_add_from_file (xml, | ||
2692 | 258 | + GTKBUILDER_DIR "/" GTKBUILDER_FILE, | ||
2693 | 259 | + &error)) { | ||
2694 | 260 | + if (error) { | ||
2695 | 261 | + g_warning ("Could not load capplet UI file: %s", | ||
2696 | 262 | + error->message); | ||
2697 | 263 | + g_error_free (error); | ||
2698 | 264 | + } else { | ||
2699 | 265 | + g_warning ("Could not load capplet UI file."); | ||
2700 | 266 | + } | ||
2701 | 267 | + } | ||
2702 | 268 | + | ||
2703 | 269 | + content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); | ||
2704 | 270 | + widget = GTK_WIDGET (gtk_builder_get_object (xml, "main-table")); | ||
2705 | 271 | + gtk_container_add (GTK_CONTAINER (content_area), widget); | ||
2706 | 272 | + | ||
2707 | 273 | + gtk_container_set_border_width (GTK_CONTAINER (dialog), 6); | ||
2708 | 274 | + gtk_window_set_icon_name (GTK_WINDOW (dialog), "session-properties"); | ||
2709 | 275 | + | ||
2710 | 276 | + g_object_set (dialog, | ||
2711 | 277 | + "allow-shrink", FALSE, | ||
2712 | 278 | + "allow-grow", FALSE, | ||
2713 | 279 | + NULL); | ||
2714 | 280 | + | ||
2715 | 281 | + gtk_dialog_add_button (GTK_DIALOG (dialog), | ||
2716 | 282 | + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL); | ||
2717 | 283 | + | ||
2718 | 284 | + if (dialog->priv->name == NULL | ||
2719 | 285 | + && dialog->priv->command == NULL | ||
2720 | 286 | + && dialog->priv->comment == NULL) { | ||
2721 | 287 | + gtk_window_set_title (GTK_WINDOW (dialog), _("Add Startup Program")); | ||
2722 | 288 | + gtk_dialog_add_button (GTK_DIALOG (dialog), | ||
2723 | 289 | + GTK_STOCK_ADD, GTK_RESPONSE_OK); | ||
2724 | 290 | + } else { | ||
2725 | 291 | + gtk_window_set_title (GTK_WINDOW (dialog), _("Edit Startup Program")); | ||
2726 | 292 | + gtk_dialog_add_button (GTK_DIALOG (dialog), | ||
2727 | 293 | + GTK_STOCK_SAVE, GTK_RESPONSE_OK); | ||
2728 | 294 | + } | ||
2729 | 295 | + | ||
2730 | 296 | + dialog->priv->name_entry = GTK_WIDGET (gtk_builder_get_object (xml, CAPPLET_NAME_ENTRY_WIDGET_NAME)); | ||
2731 | 297 | + g_signal_connect (dialog->priv->name_entry, | ||
2732 | 298 | + "activate", | ||
2733 | 299 | + G_CALLBACK (on_entry_activate), | ||
2734 | 300 | + dialog); | ||
2735 | 301 | + if (dialog->priv->name != NULL) { | ||
2736 | 302 | + gtk_entry_set_text (GTK_ENTRY (dialog->priv->name_entry), dialog->priv->name); | ||
2737 | 303 | + } | ||
2738 | 304 | + | ||
2739 | 305 | + dialog->priv->browse_button = GTK_WIDGET (gtk_builder_get_object (xml, CAPPLET_BROWSE_WIDGET_NAME)); | ||
2740 | 306 | + g_signal_connect (dialog->priv->browse_button, | ||
2741 | 307 | + "clicked", | ||
2742 | 308 | + G_CALLBACK (on_browse_button_clicked), | ||
2743 | 309 | + dialog); | ||
2744 | 310 | + | ||
2745 | 311 | + dialog->priv->command_entry = GTK_WIDGET (gtk_builder_get_object (xml, CAPPLET_COMMAND_ENTRY_WIDGET_NAME)); | ||
2746 | 312 | + g_signal_connect (dialog->priv->command_entry, | ||
2747 | 313 | + "activate", | ||
2748 | 314 | + G_CALLBACK (on_entry_activate), | ||
2749 | 315 | + dialog); | ||
2750 | 316 | + if (dialog->priv->command != NULL) { | ||
2751 | 317 | + gtk_entry_set_text (GTK_ENTRY (dialog->priv->command_entry), dialog->priv->command); | ||
2752 | 318 | + } | ||
2753 | 319 | + | ||
2754 | 320 | + dialog->priv->comment_entry = GTK_WIDGET (gtk_builder_get_object (xml, CAPPLET_COMMENT_ENTRY_WIDGET_NAME)); | ||
2755 | 321 | + g_signal_connect (dialog->priv->comment_entry, | ||
2756 | 322 | + "activate", | ||
2757 | 323 | + G_CALLBACK (on_entry_activate), | ||
2758 | 324 | + dialog); | ||
2759 | 325 | + if (dialog->priv->comment != NULL) { | ||
2760 | 326 | + gtk_entry_set_text (GTK_ENTRY (dialog->priv->comment_entry), dialog->priv->comment); | ||
2761 | 327 | + } | ||
2762 | 328 | + | ||
2763 | 329 | + if (xml != NULL) { | ||
2764 | 330 | + g_object_unref (xml); | ||
2765 | 331 | + } | ||
2766 | 332 | +} | ||
2767 | 333 | + | ||
2768 | 334 | +static GObject * | ||
2769 | 335 | +gsm_app_dialog_constructor (GType type, | ||
2770 | 336 | + guint n_construct_app, | ||
2771 | 337 | + GObjectConstructParam *construct_app) | ||
2772 | 338 | +{ | ||
2773 | 339 | + GsmAppDialog *dialog; | ||
2774 | 340 | + | ||
2775 | 341 | + dialog = GSM_APP_DIALOG (G_OBJECT_CLASS (gsm_app_dialog_parent_class)->constructor (type, | ||
2776 | 342 | + n_construct_app, | ||
2777 | 343 | + construct_app)); | ||
2778 | 344 | + | ||
2779 | 345 | + setup_dialog (dialog); | ||
2780 | 346 | + | ||
2781 | 347 | + gtk_widget_show_all (GTK_WIDGET (dialog)); | ||
2782 | 348 | + | ||
2783 | 349 | + return G_OBJECT (dialog); | ||
2784 | 350 | +} | ||
2785 | 351 | + | ||
2786 | 352 | +static void | ||
2787 | 353 | +gsm_app_dialog_dispose (GObject *object) | ||
2788 | 354 | +{ | ||
2789 | 355 | + GsmAppDialog *dialog; | ||
2790 | 356 | + | ||
2791 | 357 | + g_return_if_fail (object != NULL); | ||
2792 | 358 | + g_return_if_fail (GSM_IS_APP_DIALOG (object)); | ||
2793 | 359 | + | ||
2794 | 360 | + dialog = GSM_APP_DIALOG (object); | ||
2795 | 361 | + | ||
2796 | 362 | + g_free (dialog->priv->name); | ||
2797 | 363 | + dialog->priv->name = NULL; | ||
2798 | 364 | + g_free (dialog->priv->command); | ||
2799 | 365 | + dialog->priv->command = NULL; | ||
2800 | 366 | + g_free (dialog->priv->comment); | ||
2801 | 367 | + dialog->priv->comment = NULL; | ||
2802 | 368 | + | ||
2803 | 369 | + G_OBJECT_CLASS (gsm_app_dialog_parent_class)->dispose (object); | ||
2804 | 370 | +} | ||
2805 | 371 | + | ||
2806 | 372 | +static void | ||
2807 | 373 | +gsm_app_dialog_set_name (GsmAppDialog *dialog, | ||
2808 | 374 | + const char *name) | ||
2809 | 375 | +{ | ||
2810 | 376 | + g_return_if_fail (GSM_IS_APP_DIALOG (dialog)); | ||
2811 | 377 | + | ||
2812 | 378 | + g_free (dialog->priv->name); | ||
2813 | 379 | + | ||
2814 | 380 | + dialog->priv->name = g_strdup (name); | ||
2815 | 381 | + g_object_notify (G_OBJECT (dialog), "name"); | ||
2816 | 382 | +} | ||
2817 | 383 | + | ||
2818 | 384 | +static void | ||
2819 | 385 | +gsm_app_dialog_set_command (GsmAppDialog *dialog, | ||
2820 | 386 | + const char *name) | ||
2821 | 387 | +{ | ||
2822 | 388 | + g_return_if_fail (GSM_IS_APP_DIALOG (dialog)); | ||
2823 | 389 | + | ||
2824 | 390 | + g_free (dialog->priv->command); | ||
2825 | 391 | + | ||
2826 | 392 | + dialog->priv->command = g_strdup (name); | ||
2827 | 393 | + g_object_notify (G_OBJECT (dialog), "command"); | ||
2828 | 394 | +} | ||
2829 | 395 | + | ||
2830 | 396 | +static void | ||
2831 | 397 | +gsm_app_dialog_set_comment (GsmAppDialog *dialog, | ||
2832 | 398 | + const char *name) | ||
2833 | 399 | +{ | ||
2834 | 400 | + g_return_if_fail (GSM_IS_APP_DIALOG (dialog)); | ||
2835 | 401 | + | ||
2836 | 402 | + g_free (dialog->priv->comment); | ||
2837 | 403 | + | ||
2838 | 404 | + dialog->priv->comment = g_strdup (name); | ||
2839 | 405 | + g_object_notify (G_OBJECT (dialog), "comment"); | ||
2840 | 406 | +} | ||
2841 | 407 | + | ||
2842 | 408 | +const char * | ||
2843 | 409 | +gsm_app_dialog_get_name (GsmAppDialog *dialog) | ||
2844 | 410 | +{ | ||
2845 | 411 | + g_return_val_if_fail (GSM_IS_APP_DIALOG (dialog), NULL); | ||
2846 | 412 | + return gtk_entry_get_text (GTK_ENTRY (dialog->priv->name_entry)); | ||
2847 | 413 | +} | ||
2848 | 414 | + | ||
2849 | 415 | +const char * | ||
2850 | 416 | +gsm_app_dialog_get_command (GsmAppDialog *dialog) | ||
2851 | 417 | +{ | ||
2852 | 418 | + g_return_val_if_fail (GSM_IS_APP_DIALOG (dialog), NULL); | ||
2853 | 419 | + return gtk_entry_get_text (GTK_ENTRY (dialog->priv->command_entry)); | ||
2854 | 420 | +} | ||
2855 | 421 | + | ||
2856 | 422 | +const char * | ||
2857 | 423 | +gsm_app_dialog_get_comment (GsmAppDialog *dialog) | ||
2858 | 424 | +{ | ||
2859 | 425 | + g_return_val_if_fail (GSM_IS_APP_DIALOG (dialog), NULL); | ||
2860 | 426 | + return gtk_entry_get_text (GTK_ENTRY (dialog->priv->comment_entry)); | ||
2861 | 427 | +} | ||
2862 | 428 | + | ||
2863 | 429 | +static void | ||
2864 | 430 | +gsm_app_dialog_set_property (GObject *object, | ||
2865 | 431 | + guint prop_id, | ||
2866 | 432 | + const GValue *value, | ||
2867 | 433 | + GParamSpec *pspec) | ||
2868 | 434 | +{ | ||
2869 | 435 | + GsmAppDialog *dialog = GSM_APP_DIALOG (object); | ||
2870 | 436 | + | ||
2871 | 437 | + switch (prop_id) { | ||
2872 | 438 | + case PROP_NAME: | ||
2873 | 439 | + gsm_app_dialog_set_name (dialog, g_value_get_string (value)); | ||
2874 | 440 | + break; | ||
2875 | 441 | + case PROP_COMMAND: | ||
2876 | 442 | + gsm_app_dialog_set_command (dialog, g_value_get_string (value)); | ||
2877 | 443 | + break; | ||
2878 | 444 | + case PROP_COMMENT: | ||
2879 | 445 | + gsm_app_dialog_set_comment (dialog, g_value_get_string (value)); | ||
2880 | 446 | + break; | ||
2881 | 447 | + default: | ||
2882 | 448 | + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); | ||
2883 | 449 | + break; | ||
2884 | 450 | + } | ||
2885 | 451 | +} | ||
2886 | 452 | + | ||
2887 | 453 | +static void | ||
2888 | 454 | +gsm_app_dialog_get_property (GObject *object, | ||
2889 | 455 | + guint prop_id, | ||
2890 | 456 | + GValue *value, | ||
2891 | 457 | + GParamSpec *pspec) | ||
2892 | 458 | +{ | ||
2893 | 459 | + GsmAppDialog *dialog = GSM_APP_DIALOG (object); | ||
2894 | 460 | + | ||
2895 | 461 | + switch (prop_id) { | ||
2896 | 462 | + case PROP_NAME: | ||
2897 | 463 | + g_value_set_string (value, dialog->priv->name); | ||
2898 | 464 | + break; | ||
2899 | 465 | + case PROP_COMMAND: | ||
2900 | 466 | + g_value_set_string (value, dialog->priv->command); | ||
2901 | 467 | + break; | ||
2902 | 468 | + case PROP_COMMENT: | ||
2903 | 469 | + g_value_set_string (value, dialog->priv->comment); | ||
2904 | 470 | + break; | ||
2905 | 471 | + default: | ||
2906 | 472 | + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); | ||
2907 | 473 | + break; | ||
2908 | 474 | + } | ||
2909 | 475 | +} | ||
2910 | 476 | + | ||
2911 | 477 | +static void | ||
2912 | 478 | +gsm_app_dialog_class_init (GsmAppDialogClass *klass) | ||
2913 | 479 | +{ | ||
2914 | 480 | + GObjectClass *object_class = G_OBJECT_CLASS (klass); | ||
2915 | 481 | + | ||
2916 | 482 | + object_class->get_property = gsm_app_dialog_get_property; | ||
2917 | 483 | + object_class->set_property = gsm_app_dialog_set_property; | ||
2918 | 484 | + object_class->constructor = gsm_app_dialog_constructor; | ||
2919 | 485 | + object_class->dispose = gsm_app_dialog_dispose; | ||
2920 | 486 | + object_class->finalize = gsm_app_dialog_finalize; | ||
2921 | 487 | + | ||
2922 | 488 | + g_object_class_install_property (object_class, | ||
2923 | 489 | + PROP_NAME, | ||
2924 | 490 | + g_param_spec_string ("name", | ||
2925 | 491 | + "name", | ||
2926 | 492 | + "name", | ||
2927 | 493 | + NULL, | ||
2928 | 494 | + G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); | ||
2929 | 495 | + g_object_class_install_property (object_class, | ||
2930 | 496 | + PROP_COMMAND, | ||
2931 | 497 | + g_param_spec_string ("command", | ||
2932 | 498 | + "command", | ||
2933 | 499 | + "command", | ||
2934 | 500 | + NULL, | ||
2935 | 501 | + G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); | ||
2936 | 502 | + g_object_class_install_property (object_class, | ||
2937 | 503 | + PROP_COMMENT, | ||
2938 | 504 | + g_param_spec_string ("comment", | ||
2939 | 505 | + "comment", | ||
2940 | 506 | + "comment", | ||
2941 | 507 | + NULL, | ||
2942 | 508 | + G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); | ||
2943 | 509 | + | ||
2944 | 510 | + g_type_class_add_private (klass, sizeof (GsmAppDialogPrivate)); | ||
2945 | 511 | +} | ||
2946 | 512 | + | ||
2947 | 513 | +static void | ||
2948 | 514 | +gsm_app_dialog_init (GsmAppDialog *dialog) | ||
2949 | 515 | +{ | ||
2950 | 516 | + | ||
2951 | 517 | + dialog->priv = GSM_APP_DIALOG_GET_PRIVATE (dialog); | ||
2952 | 518 | +} | ||
2953 | 519 | + | ||
2954 | 520 | +static void | ||
2955 | 521 | +gsm_app_dialog_finalize (GObject *object) | ||
2956 | 522 | +{ | ||
2957 | 523 | + GsmAppDialog *dialog; | ||
2958 | 524 | + | ||
2959 | 525 | + g_return_if_fail (object != NULL); | ||
2960 | 526 | + g_return_if_fail (GSM_IS_APP_DIALOG (object)); | ||
2961 | 527 | + | ||
2962 | 528 | + dialog = GSM_APP_DIALOG (object); | ||
2963 | 529 | + | ||
2964 | 530 | + g_return_if_fail (dialog->priv != NULL); | ||
2965 | 531 | + | ||
2966 | 532 | + G_OBJECT_CLASS (gsm_app_dialog_parent_class)->finalize (object); | ||
2967 | 533 | +} | ||
2968 | 534 | + | ||
2969 | 535 | +GtkWidget * | ||
2970 | 536 | +gsm_app_dialog_new (const char *name, | ||
2971 | 537 | + const char *command, | ||
2972 | 538 | + const char *comment) | ||
2973 | 539 | +{ | ||
2974 | 540 | + GObject *object; | ||
2975 | 541 | + | ||
2976 | 542 | + object = g_object_new (GSM_TYPE_APP_DIALOG, | ||
2977 | 543 | + "name", name, | ||
2978 | 544 | + "command", command, | ||
2979 | 545 | + "comment", comment, | ||
2980 | 546 | + NULL); | ||
2981 | 547 | + | ||
2982 | 548 | + return GTK_WIDGET (object); | ||
2983 | 549 | +} | ||
2984 | 550 | + | ||
2985 | 551 | +gboolean | ||
2986 | 552 | +gsm_app_dialog_run (GsmAppDialog *dialog, | ||
2987 | 553 | + char **name_p, | ||
2988 | 554 | + char **command_p, | ||
2989 | 555 | + char **comment_p) | ||
2990 | 556 | +{ | ||
2991 | 557 | + gboolean retval; | ||
2992 | 558 | + | ||
2993 | 559 | + retval = FALSE; | ||
2994 | 560 | + | ||
2995 | 561 | + while (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK) { | ||
2996 | 562 | + const char *name; | ||
2997 | 563 | + const char *exec; | ||
2998 | 564 | + const char *comment; | ||
2999 | 565 | + const char *error_msg; | ||
3000 | 566 | + GError *error; | ||
3001 | 567 | + char **argv; | ||
3002 | 568 | + int argc; | ||
3003 | 569 | + | ||
3004 | 570 | + name = gsm_app_dialog_get_name (GSM_APP_DIALOG (dialog)); | ||
3005 | 571 | + exec = gsm_app_dialog_get_command (GSM_APP_DIALOG (dialog)); | ||
3006 | 572 | + comment = gsm_app_dialog_get_comment (GSM_APP_DIALOG (dialog)); | ||
3007 | 573 | + | ||
3008 | 574 | + error = NULL; | ||
3009 | 575 | + error_msg = NULL; | ||
3010 | 576 | + | ||
3011 | 577 | + if (gsm_util_text_is_blank (exec)) { | ||
3012 | 578 | + error_msg = _("The startup command cannot be empty"); | ||
3013 | 579 | + } else { | ||
3014 | 580 | + if (!g_shell_parse_argv (exec, &argc, &argv, &error)) { | ||
3015 | 581 | + if (error != NULL) { | ||
3016 | 582 | + error_msg = error->message; | ||
3017 | 583 | + } else { | ||
3018 | 584 | + error_msg = _("The startup command is not valid"); | ||
3019 | 585 | + } | ||
3020 | 586 | + } | ||
3021 | 587 | + } | ||
3022 | 588 | + | ||
3023 | 589 | + if (error_msg != NULL) { | ||
3024 | 590 | + GtkWidget *msgbox; | ||
3025 | 591 | + | ||
3026 | 592 | + msgbox = gtk_message_dialog_new (GTK_WINDOW (dialog), | ||
3027 | 593 | + GTK_DIALOG_MODAL, | ||
3028 | 594 | + GTK_MESSAGE_ERROR, | ||
3029 | 595 | + GTK_BUTTONS_CLOSE, | ||
3030 | 596 | + "%s", error_msg); | ||
3031 | 597 | + | ||
3032 | 598 | + if (error != NULL) { | ||
3033 | 599 | + g_error_free (error); | ||
3034 | 600 | + } | ||
3035 | 601 | + | ||
3036 | 602 | + gtk_dialog_run (GTK_DIALOG (msgbox)); | ||
3037 | 603 | + | ||
3038 | 604 | + gtk_widget_destroy (msgbox); | ||
3039 | 605 | + | ||
3040 | 606 | + continue; | ||
3041 | 607 | + } | ||
3042 | 608 | + | ||
3043 | 609 | + if (gsm_util_text_is_blank (name)) { | ||
3044 | 610 | + name = argv[0]; | ||
3045 | 611 | + } | ||
3046 | 612 | + | ||
3047 | 613 | + if (name_p) { | ||
3048 | 614 | + *name_p = g_strdup (name); | ||
3049 | 615 | + } | ||
3050 | 616 | + | ||
3051 | 617 | + g_strfreev (argv); | ||
3052 | 618 | + | ||
3053 | 619 | + if (command_p) { | ||
3054 | 620 | + *command_p = g_strdup (exec); | ||
3055 | 621 | + } | ||
3056 | 622 | + | ||
3057 | 623 | + if (comment_p) { | ||
3058 | 624 | + *comment_p = g_strdup (comment); | ||
3059 | 625 | + } | ||
3060 | 626 | + | ||
3061 | 627 | + retval = TRUE; | ||
3062 | 628 | + break; | ||
3063 | 629 | + } | ||
3064 | 630 | + | ||
3065 | 631 | + gtk_widget_destroy (GTK_WIDGET (dialog)); | ||
3066 | 632 | + | ||
3067 | 633 | + return retval; | ||
3068 | 634 | +} | ||
3069 | 635 | Index: gnome-session/capplet/gsm-app-dialog.h | ||
3070 | 636 | =================================================================== | ||
3071 | 637 | --- /dev/null | ||
3072 | 638 | +++ gnome-session/capplet/gsm-app-dialog.h | ||
3073 | 639 | @@ -0,0 +1,66 @@ | ||
3074 | 640 | +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- | ||
3075 | 641 | + * | ||
3076 | 642 | + * Copyright (C) 2008 William Jon McCann <jmccann@redhat.com> | ||
3077 | 643 | + * | ||
3078 | 644 | + * This program is free software; you can redistribute it and/or modify | ||
3079 | 645 | + * it under the terms of the GNU General Public License as published by | ||
3080 | 646 | + * the Free Software Foundation; either version 2 of the License, or | ||
3081 | 647 | + * (at your option) any later version. | ||
3082 | 648 | + * | ||
3083 | 649 | + * This program is distributed in the hope that it will be useful, | ||
3084 | 650 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
3085 | 651 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
3086 | 652 | + * GNU General Public License for more details. | ||
3087 | 653 | + * | ||
3088 | 654 | + * You should have received a copy of the GNU General Public License | ||
3089 | 655 | + * along with this program; if not, write to the Free Software | ||
3090 | 656 | + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
3091 | 657 | + * | ||
3092 | 658 | + */ | ||
3093 | 659 | + | ||
3094 | 660 | +#ifndef __GSM_APP_DIALOG_H | ||
3095 | 661 | +#define __GSM_APP_DIALOG_H | ||
3096 | 662 | + | ||
3097 | 663 | +#include <glib-object.h> | ||
3098 | 664 | +#include <gtk/gtk.h> | ||
3099 | 665 | + | ||
3100 | 666 | +G_BEGIN_DECLS | ||
3101 | 667 | + | ||
3102 | 668 | +#define GSM_TYPE_APP_DIALOG (gsm_app_dialog_get_type ()) | ||
3103 | 669 | +#define GSM_APP_DIALOG(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSM_TYPE_APP_DIALOG, GsmAppDialog)) | ||
3104 | 670 | +#define GSM_APP_DIALOG_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GSM_TYPE_APP_DIALOG, GsmAppDialogClass)) | ||
3105 | 671 | +#define GSM_IS_APP_DIALOG(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSM_TYPE_APP_DIALOG)) | ||
3106 | 672 | +#define GSM_IS_APP_DIALOG_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GSM_TYPE_APP_DIALOG)) | ||
3107 | 673 | +#define GSM_APP_DIALOG_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSM_TYPE_APP_DIALOG, GsmAppDialogClass)) | ||
3108 | 674 | + | ||
3109 | 675 | +typedef struct GsmAppDialogPrivate GsmAppDialogPrivate; | ||
3110 | 676 | + | ||
3111 | 677 | +typedef struct | ||
3112 | 678 | +{ | ||
3113 | 679 | + GtkDialog parent; | ||
3114 | 680 | + GsmAppDialogPrivate *priv; | ||
3115 | 681 | +} GsmAppDialog; | ||
3116 | 682 | + | ||
3117 | 683 | +typedef struct | ||
3118 | 684 | +{ | ||
3119 | 685 | + GtkDialogClass parent_class; | ||
3120 | 686 | +} GsmAppDialogClass; | ||
3121 | 687 | + | ||
3122 | 688 | +GType gsm_app_dialog_get_type (void); | ||
3123 | 689 | + | ||
3124 | 690 | +GtkWidget * gsm_app_dialog_new (const char *name, | ||
3125 | 691 | + const char *command, | ||
3126 | 692 | + const char *comment); | ||
3127 | 693 | + | ||
3128 | 694 | +gboolean gsm_app_dialog_run (GsmAppDialog *dialog, | ||
3129 | 695 | + char **name_p, | ||
3130 | 696 | + char **command_p, | ||
3131 | 697 | + char **comment_p); | ||
3132 | 698 | + | ||
3133 | 699 | +const char * gsm_app_dialog_get_name (GsmAppDialog *dialog); | ||
3134 | 700 | +const char * gsm_app_dialog_get_command (GsmAppDialog *dialog); | ||
3135 | 701 | +const char * gsm_app_dialog_get_comment (GsmAppDialog *dialog); | ||
3136 | 702 | + | ||
3137 | 703 | +G_END_DECLS | ||
3138 | 704 | + | ||
3139 | 705 | +#endif /* __GSM_APP_DIALOG_H */ | ||
3140 | 706 | Index: gnome-session/capplet/gsm-properties-dialog.c | ||
3141 | 707 | =================================================================== | ||
3142 | 708 | --- /dev/null | ||
3143 | 709 | +++ gnome-session/capplet/gsm-properties-dialog.c | ||
3144 | 710 | @@ -0,0 +1,774 @@ | ||
3145 | 711 | +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- | ||
3146 | 712 | + * | ||
3147 | 713 | + * Copyright (C) 1999 Free Software Foundation, Inc. | ||
3148 | 714 | + * Copyright (C) 2007 Vincent Untz. | ||
3149 | 715 | + * Copyright (C) 2008 Lucas Rocha. | ||
3150 | 716 | + * Copyright (C) 2008 William Jon McCann <jmccann@redhat.com> | ||
3151 | 717 | + * | ||
3152 | 718 | + * This program is free software; you can redistribute it and/or modify | ||
3153 | 719 | + * it under the terms of the GNU General Public License as published by | ||
3154 | 720 | + * the Free Software Foundation; either version 2 of the License, or | ||
3155 | 721 | + * (at your option) any later version. | ||
3156 | 722 | + * | ||
3157 | 723 | + * This program is distributed in the hope that it will be useful, | ||
3158 | 724 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
3159 | 725 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
3160 | 726 | + * GNU General Public License for more details. | ||
3161 | 727 | + * | ||
3162 | 728 | + * You should have received a copy of the GNU General Public License | ||
3163 | 729 | + * along with this program; if not, write to the Free Software | ||
3164 | 730 | + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
3165 | 731 | + * | ||
3166 | 732 | + */ | ||
3167 | 733 | + | ||
3168 | 734 | +#include "config.h" | ||
3169 | 735 | + | ||
3170 | 736 | +#include <glib.h> | ||
3171 | 737 | +#include <glib/gi18n.h> | ||
3172 | 738 | +#include <gtk/gtk.h> | ||
3173 | 739 | + | ||
3174 | 740 | +#include "gsm-properties-dialog.h" | ||
3175 | 741 | +#include "gsm-app-dialog.h" | ||
3176 | 742 | +#include "gsm-util.h" | ||
3177 | 743 | +#include "gsp-app.h" | ||
3178 | 744 | +#include "gsp-app-manager.h" | ||
3179 | 745 | + | ||
3180 | 746 | +#define GSM_PROPERTIES_DIALOG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSM_TYPE_PROPERTIES_DIALOG, GsmPropertiesDialogPrivate)) | ||
3181 | 747 | + | ||
3182 | 748 | +#define GTKBUILDER_FILE "session-properties.ui" | ||
3183 | 749 | + | ||
3184 | 750 | +#define CAPPLET_TREEVIEW_WIDGET_NAME "session_properties_treeview" | ||
3185 | 751 | +#define CAPPLET_ADD_WIDGET_NAME "session_properties_add_button" | ||
3186 | 752 | +#define CAPPLET_DELETE_WIDGET_NAME "session_properties_delete_button" | ||
3187 | 753 | +#define CAPPLET_EDIT_WIDGET_NAME "session_properties_edit_button" | ||
3188 | 754 | +#define CAPPLET_SAVE_WIDGET_NAME "session_properties_save_button" | ||
3189 | 755 | +#define CAPPLET_REMEMBER_WIDGET_NAME "session_properties_remember_toggle" | ||
3190 | 756 | + | ||
3191 | 757 | +#define STARTUP_APP_ICON "system-run" | ||
3192 | 758 | + | ||
3193 | 759 | +#define SPC_SETTINGS_SCHEMA "org.gnome.SessionManager" | ||
3194 | 760 | +#define SPC_SETTINGS_AUTOSAVE_KEY "auto-save-session" | ||
3195 | 761 | + | ||
3196 | 762 | +struct GsmPropertiesDialogPrivate | ||
3197 | 763 | +{ | ||
3198 | 764 | + GtkBuilder *xml; | ||
3199 | 765 | + GtkListStore *list_store; | ||
3200 | 766 | + GtkTreeModel *tree_filter; | ||
3201 | 767 | + | ||
3202 | 768 | + GtkTreeView *treeview; | ||
3203 | 769 | + GtkWidget *add_button; | ||
3204 | 770 | + GtkWidget *delete_button; | ||
3205 | 771 | + GtkWidget *edit_button; | ||
3206 | 772 | + | ||
3207 | 773 | + GSettings *settings; | ||
3208 | 774 | + | ||
3209 | 775 | + GspAppManager *manager; | ||
3210 | 776 | +}; | ||
3211 | 777 | + | ||
3212 | 778 | +enum { | ||
3213 | 779 | + STORE_COL_VISIBLE = 0, | ||
3214 | 780 | + STORE_COL_ENABLED, | ||
3215 | 781 | + STORE_COL_GICON, | ||
3216 | 782 | + STORE_COL_DESCRIPTION, | ||
3217 | 783 | + STORE_COL_APP, | ||
3218 | 784 | + STORE_COL_SEARCH, | ||
3219 | 785 | + NUMBER_OF_COLUMNS | ||
3220 | 786 | +}; | ||
3221 | 787 | + | ||
3222 | 788 | +static void gsm_properties_dialog_class_init (GsmPropertiesDialogClass *klass); | ||
3223 | 789 | +static void gsm_properties_dialog_init (GsmPropertiesDialog *properties_dialog); | ||
3224 | 790 | +static void gsm_properties_dialog_finalize (GObject *object); | ||
3225 | 791 | + | ||
3226 | 792 | +G_DEFINE_TYPE (GsmPropertiesDialog, gsm_properties_dialog, GTK_TYPE_DIALOG) | ||
3227 | 793 | + | ||
3228 | 794 | +static gboolean | ||
3229 | 795 | +find_by_app (GtkTreeModel *model, | ||
3230 | 796 | + GtkTreeIter *iter, | ||
3231 | 797 | + GspApp *app) | ||
3232 | 798 | +{ | ||
3233 | 799 | + GspApp *iter_app = NULL; | ||
3234 | 800 | + | ||
3235 | 801 | + if (!gtk_tree_model_get_iter_first (model, iter)) { | ||
3236 | 802 | + return FALSE; | ||
3237 | 803 | + } | ||
3238 | 804 | + | ||
3239 | 805 | + do { | ||
3240 | 806 | + gtk_tree_model_get (model, iter, | ||
3241 | 807 | + STORE_COL_APP, &iter_app, | ||
3242 | 808 | + -1); | ||
3243 | 809 | + | ||
3244 | 810 | + if (iter_app == app) { | ||
3245 | 811 | + g_object_unref (iter_app); | ||
3246 | 812 | + return TRUE; | ||
3247 | 813 | + } | ||
3248 | 814 | + } while (gtk_tree_model_iter_next (model, iter)); | ||
3249 | 815 | + | ||
3250 | 816 | + return FALSE; | ||
3251 | 817 | +} | ||
3252 | 818 | + | ||
3253 | 819 | +static void | ||
3254 | 820 | +_fill_iter_from_app (GtkListStore *list_store, | ||
3255 | 821 | + GtkTreeIter *iter, | ||
3256 | 822 | + GspApp *app) | ||
3257 | 823 | +{ | ||
3258 | 824 | + gboolean hidden; | ||
3259 | 825 | + gboolean display; | ||
3260 | 826 | + gboolean enabled; | ||
3261 | 827 | + gboolean shown; | ||
3262 | 828 | + GIcon *icon; | ||
3263 | 829 | + const char *description; | ||
3264 | 830 | + const char *app_name; | ||
3265 | 831 | + | ||
3266 | 832 | + hidden = gsp_app_get_hidden (app); | ||
3267 | 833 | + display = gsp_app_get_display (app); | ||
3268 | 834 | + enabled = gsp_app_get_enabled (app); | ||
3269 | 835 | + shown = gsp_app_get_shown (app); | ||
3270 | 836 | + icon = gsp_app_get_icon (app); | ||
3271 | 837 | + description = gsp_app_get_description (app); | ||
3272 | 838 | + app_name = gsp_app_get_name (app); | ||
3273 | 839 | + | ||
3274 | 840 | + if (G_IS_THEMED_ICON (icon)) { | ||
3275 | 841 | + GtkIconTheme *theme; | ||
3276 | 842 | + const char * const *icon_names; | ||
3277 | 843 | + | ||
3278 | 844 | + theme = gtk_icon_theme_get_default (); | ||
3279 | 845 | + icon_names = g_themed_icon_get_names (G_THEMED_ICON (icon)); | ||
3280 | 846 | + if (icon_names[0] == NULL || | ||
3281 | 847 | + !gtk_icon_theme_has_icon (theme, icon_names[0])) { | ||
3282 | 848 | + g_object_unref (icon); | ||
3283 | 849 | + icon = NULL; | ||
3284 | 850 | + } | ||
3285 | 851 | + } else if (G_IS_FILE_ICON (icon)) { | ||
3286 | 852 | + GFile *iconfile; | ||
3287 | 853 | + | ||
3288 | 854 | + iconfile = g_file_icon_get_file (G_FILE_ICON (icon)); | ||
3289 | 855 | + if (!g_file_query_exists (iconfile, NULL)) { | ||
3290 | 856 | + g_object_unref (icon); | ||
3291 | 857 | + icon = NULL; | ||
3292 | 858 | + } | ||
3293 | 859 | + } | ||
3294 | 860 | + | ||
3295 | 861 | + if (icon == NULL) { | ||
3296 | 862 | + icon = g_themed_icon_new (STARTUP_APP_ICON); | ||
3297 | 863 | + } | ||
3298 | 864 | + | ||
3299 | 865 | + gtk_list_store_set (list_store, iter, | ||
3300 | 866 | + STORE_COL_VISIBLE, !hidden && shown && display, | ||
3301 | 867 | + STORE_COL_ENABLED, enabled, | ||
3302 | 868 | + STORE_COL_GICON, icon, | ||
3303 | 869 | + STORE_COL_DESCRIPTION, description, | ||
3304 | 870 | + STORE_COL_APP, app, | ||
3305 | 871 | + STORE_COL_SEARCH, app_name, | ||
3306 | 872 | + -1); | ||
3307 | 873 | + g_object_unref (icon); | ||
3308 | 874 | +} | ||
3309 | 875 | + | ||
3310 | 876 | +static void | ||
3311 | 877 | +_app_changed (GsmPropertiesDialog *dialog, | ||
3312 | 878 | + GspApp *app) | ||
3313 | 879 | +{ | ||
3314 | 880 | + GtkTreeIter iter; | ||
3315 | 881 | + | ||
3316 | 882 | + if (!find_by_app (GTK_TREE_MODEL (dialog->priv->list_store), | ||
3317 | 883 | + &iter, app)) { | ||
3318 | 884 | + return; | ||
3319 | 885 | + } | ||
3320 | 886 | + | ||
3321 | 887 | + _fill_iter_from_app (dialog->priv->list_store, &iter, app); | ||
3322 | 888 | +} | ||
3323 | 889 | + | ||
3324 | 890 | +static void | ||
3325 | 891 | +append_app (GsmPropertiesDialog *dialog, | ||
3326 | 892 | + GspApp *app) | ||
3327 | 893 | +{ | ||
3328 | 894 | + GtkTreeIter iter; | ||
3329 | 895 | + | ||
3330 | 896 | + gtk_list_store_append (dialog->priv->list_store, &iter); | ||
3331 | 897 | + _fill_iter_from_app (dialog->priv->list_store, &iter, app); | ||
3332 | 898 | + | ||
3333 | 899 | + g_signal_connect_swapped (app, "changed", | ||
3334 | 900 | + G_CALLBACK (_app_changed), dialog); | ||
3335 | 901 | +} | ||
3336 | 902 | + | ||
3337 | 903 | +static void | ||
3338 | 904 | +_app_added (GsmPropertiesDialog *dialog, | ||
3339 | 905 | + GspApp *app, | ||
3340 | 906 | + GspAppManager *manager) | ||
3341 | 907 | +{ | ||
3342 | 908 | + append_app (dialog, app); | ||
3343 | 909 | +} | ||
3344 | 910 | + | ||
3345 | 911 | +static void | ||
3346 | 912 | +_app_removed (GsmPropertiesDialog *dialog, | ||
3347 | 913 | + GspApp *app, | ||
3348 | 914 | + GspAppManager *manager) | ||
3349 | 915 | +{ | ||
3350 | 916 | + GtkTreeIter iter; | ||
3351 | 917 | + | ||
3352 | 918 | + if (!find_by_app (GTK_TREE_MODEL (dialog->priv->list_store), | ||
3353 | 919 | + &iter, app)) { | ||
3354 | 920 | + return; | ||
3355 | 921 | + } | ||
3356 | 922 | + | ||
3357 | 923 | + g_signal_handlers_disconnect_by_func (app, | ||
3358 | 924 | + _app_changed, | ||
3359 | 925 | + dialog); | ||
3360 | 926 | + gtk_list_store_remove (dialog->priv->list_store, &iter); | ||
3361 | 927 | +} | ||
3362 | 928 | + | ||
3363 | 929 | +static void | ||
3364 | 930 | +populate_model (GsmPropertiesDialog *dialog) | ||
3365 | 931 | +{ | ||
3366 | 932 | + GSList *apps; | ||
3367 | 933 | + GSList *l; | ||
3368 | 934 | + | ||
3369 | 935 | + apps = gsp_app_manager_get_apps (dialog->priv->manager); | ||
3370 | 936 | + for (l = apps; l != NULL; l = l->next) { | ||
3371 | 937 | + append_app (dialog, GSP_APP (l->data)); | ||
3372 | 938 | + } | ||
3373 | 939 | + g_slist_free (apps); | ||
3374 | 940 | +} | ||
3375 | 941 | + | ||
3376 | 942 | +static void | ||
3377 | 943 | +on_selection_changed (GtkTreeSelection *selection, | ||
3378 | 944 | + GsmPropertiesDialog *dialog) | ||
3379 | 945 | +{ | ||
3380 | 946 | + gboolean sel; | ||
3381 | 947 | + | ||
3382 | 948 | + sel = gtk_tree_selection_get_selected (selection, NULL, NULL); | ||
3383 | 949 | + | ||
3384 | 950 | + gtk_widget_set_sensitive (dialog->priv->edit_button, sel); | ||
3385 | 951 | + gtk_widget_set_sensitive (dialog->priv->delete_button, sel); | ||
3386 | 952 | +} | ||
3387 | 953 | + | ||
3388 | 954 | +static void | ||
3389 | 955 | +on_startup_enabled_toggled (GtkCellRendererToggle *cell_renderer, | ||
3390 | 956 | + char *path, | ||
3391 | 957 | + GsmPropertiesDialog *dialog) | ||
3392 | 958 | +{ | ||
3393 | 959 | + GtkTreeIter iter; | ||
3394 | 960 | + GspApp *app; | ||
3395 | 961 | + gboolean active; | ||
3396 | 962 | + | ||
3397 | 963 | + if (!gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (dialog->priv->tree_filter), | ||
3398 | 964 | + &iter, path)) { | ||
3399 | 965 | + return; | ||
3400 | 966 | + } | ||
3401 | 967 | + | ||
3402 | 968 | + app = NULL; | ||
3403 | 969 | + gtk_tree_model_get (GTK_TREE_MODEL (dialog->priv->tree_filter), | ||
3404 | 970 | + &iter, | ||
3405 | 971 | + STORE_COL_APP, &app, | ||
3406 | 972 | + -1); | ||
3407 | 973 | + | ||
3408 | 974 | + active = gtk_cell_renderer_toggle_get_active (cell_renderer); | ||
3409 | 975 | + active = !active; | ||
3410 | 976 | + | ||
3411 | 977 | + if (app) { | ||
3412 | 978 | + gsp_app_set_enabled (app, active); | ||
3413 | 979 | + g_object_unref (app); | ||
3414 | 980 | + } | ||
3415 | 981 | +} | ||
3416 | 982 | + | ||
3417 | 983 | +static void | ||
3418 | 984 | +on_drag_data_received (GtkWidget *widget, | ||
3419 | 985 | + GdkDragContext *drag_context, | ||
3420 | 986 | + gint x, | ||
3421 | 987 | + gint y, | ||
3422 | 988 | + GtkSelectionData *data, | ||
3423 | 989 | + guint info, | ||
3424 | 990 | + guint time, | ||
3425 | 991 | + GsmPropertiesDialog *dialog) | ||
3426 | 992 | +{ | ||
3427 | 993 | + gboolean dnd_success; | ||
3428 | 994 | + | ||
3429 | 995 | + dnd_success = FALSE; | ||
3430 | 996 | + | ||
3431 | 997 | + if (data != NULL) { | ||
3432 | 998 | + char **filenames; | ||
3433 | 999 | + int i; | ||
3434 | 1000 | + | ||
3435 | 1001 | + filenames = gtk_selection_data_get_uris (data); | ||
3436 | 1002 | + | ||
3437 | 1003 | + for (i = 0; filenames[i] && filenames[i][0]; i++) { | ||
3438 | 1004 | + /* Return success if at least one file succeeded */ | ||
3439 | 1005 | + gboolean file_success; | ||
3440 | 1006 | + file_success = gsp_app_copy_desktop_file (filenames[i]); | ||
3441 | 1007 | + dnd_success = dnd_success || file_success; | ||
3442 | 1008 | + } | ||
3443 | 1009 | + | ||
3444 | 1010 | + g_strfreev (filenames); | ||
3445 | 1011 | + } | ||
3446 | 1012 | + | ||
3447 | 1013 | + gtk_drag_finish (drag_context, dnd_success, FALSE, time); | ||
3448 | 1014 | + g_signal_stop_emission_by_name (widget, "drag_data_received"); | ||
3449 | 1015 | +} | ||
3450 | 1016 | + | ||
3451 | 1017 | +static void | ||
3452 | 1018 | +on_drag_begin (GtkWidget *widget, | ||
3453 | 1019 | + GdkDragContext *context, | ||
3454 | 1020 | + GsmPropertiesDialog *dialog) | ||
3455 | 1021 | +{ | ||
3456 | 1022 | + GtkTreePath *path; | ||
3457 | 1023 | + GtkTreeIter iter; | ||
3458 | 1024 | + GspApp *app; | ||
3459 | 1025 | + | ||
3460 | 1026 | + gtk_tree_view_get_cursor (GTK_TREE_VIEW (widget), &path, NULL); | ||
3461 | 1027 | + gtk_tree_model_get_iter (GTK_TREE_MODEL (dialog->priv->tree_filter), | ||
3462 | 1028 | + &iter, path); | ||
3463 | 1029 | + gtk_tree_path_free (path); | ||
3464 | 1030 | + | ||
3465 | 1031 | + gtk_tree_model_get (GTK_TREE_MODEL (dialog->priv->tree_filter), | ||
3466 | 1032 | + &iter, | ||
3467 | 1033 | + STORE_COL_APP, &app, | ||
3468 | 1034 | + -1); | ||
3469 | 1035 | + | ||
3470 | 1036 | + if (app) { | ||
3471 | 1037 | + g_object_set_data_full (G_OBJECT (context), "gsp-app", | ||
3472 | 1038 | + g_object_ref (app), g_object_unref); | ||
3473 | 1039 | + g_object_unref (app); | ||
3474 | 1040 | + } | ||
3475 | 1041 | + | ||
3476 | 1042 | +} | ||
3477 | 1043 | + | ||
3478 | 1044 | +static void | ||
3479 | 1045 | +on_drag_data_get (GtkWidget *widget, | ||
3480 | 1046 | + GdkDragContext *context, | ||
3481 | 1047 | + GtkSelectionData *selection_data, | ||
3482 | 1048 | + guint info, | ||
3483 | 1049 | + guint time, | ||
3484 | 1050 | + GsmPropertiesDialog *dialog) | ||
3485 | 1051 | +{ | ||
3486 | 1052 | + GspApp *app; | ||
3487 | 1053 | + | ||
3488 | 1054 | + app = g_object_get_data (G_OBJECT (context), "gsp-app"); | ||
3489 | 1055 | + if (app) { | ||
3490 | 1056 | + const char *uris[2]; | ||
3491 | 1057 | + char *uri; | ||
3492 | 1058 | + | ||
3493 | 1059 | + uri = g_filename_to_uri (gsp_app_get_path (app), NULL, NULL); | ||
3494 | 1060 | + | ||
3495 | 1061 | + uris[0] = uri; | ||
3496 | 1062 | + uris[1] = NULL; | ||
3497 | 1063 | + gtk_selection_data_set_uris (selection_data, (char **) uris); | ||
3498 | 1064 | + | ||
3499 | 1065 | + g_free (uri); | ||
3500 | 1066 | + } | ||
3501 | 1067 | +} | ||
3502 | 1068 | + | ||
3503 | 1069 | +static void | ||
3504 | 1070 | +on_add_app_clicked (GtkWidget *widget, | ||
3505 | 1071 | + GsmPropertiesDialog *dialog) | ||
3506 | 1072 | +{ | ||
3507 | 1073 | + GtkWidget *add_dialog; | ||
3508 | 1074 | + char *name; | ||
3509 | 1075 | + char *exec; | ||
3510 | 1076 | + char *comment; | ||
3511 | 1077 | + | ||
3512 | 1078 | + add_dialog = gsm_app_dialog_new (NULL, NULL, NULL); | ||
3513 | 1079 | + gtk_window_set_transient_for (GTK_WINDOW (add_dialog), | ||
3514 | 1080 | + GTK_WINDOW (dialog)); | ||
3515 | 1081 | + | ||
3516 | 1082 | + if (gsm_app_dialog_run (GSM_APP_DIALOG (add_dialog), | ||
3517 | 1083 | + &name, &exec, &comment)) { | ||
3518 | 1084 | + gsp_app_create (name, comment, exec); | ||
3519 | 1085 | + g_free (name); | ||
3520 | 1086 | + g_free (exec); | ||
3521 | 1087 | + g_free (comment); | ||
3522 | 1088 | + } | ||
3523 | 1089 | +} | ||
3524 | 1090 | + | ||
3525 | 1091 | +static void | ||
3526 | 1092 | +on_delete_app_clicked (GtkWidget *widget, | ||
3527 | 1093 | + GsmPropertiesDialog *dialog) | ||
3528 | 1094 | +{ | ||
3529 | 1095 | + GtkTreeSelection *selection; | ||
3530 | 1096 | + GtkTreeIter iter; | ||
3531 | 1097 | + GspApp *app; | ||
3532 | 1098 | + | ||
3533 | 1099 | + selection = gtk_tree_view_get_selection (dialog->priv->treeview); | ||
3534 | 1100 | + | ||
3535 | 1101 | + if (!gtk_tree_selection_get_selected (selection, NULL, &iter)) { | ||
3536 | 1102 | + return; | ||
3537 | 1103 | + } | ||
3538 | 1104 | + | ||
3539 | 1105 | + app = NULL; | ||
3540 | 1106 | + gtk_tree_model_get (GTK_TREE_MODEL (dialog->priv->tree_filter), | ||
3541 | 1107 | + &iter, | ||
3542 | 1108 | + STORE_COL_APP, &app, | ||
3543 | 1109 | + -1); | ||
3544 | 1110 | + | ||
3545 | 1111 | + if (app) { | ||
3546 | 1112 | + gsp_app_delete (app); | ||
3547 | 1113 | + g_object_unref (app); | ||
3548 | 1114 | + } | ||
3549 | 1115 | +} | ||
3550 | 1116 | + | ||
3551 | 1117 | +static void | ||
3552 | 1118 | +on_edit_app_clicked (GtkWidget *widget, | ||
3553 | 1119 | + GsmPropertiesDialog *dialog) | ||
3554 | 1120 | +{ | ||
3555 | 1121 | + GtkTreeSelection *selection; | ||
3556 | 1122 | + GtkTreeIter iter; | ||
3557 | 1123 | + GspApp *app; | ||
3558 | 1124 | + | ||
3559 | 1125 | + selection = gtk_tree_view_get_selection (dialog->priv->treeview); | ||
3560 | 1126 | + | ||
3561 | 1127 | + if (!gtk_tree_selection_get_selected (selection, NULL, &iter)) { | ||
3562 | 1128 | + return; | ||
3563 | 1129 | + } | ||
3564 | 1130 | + | ||
3565 | 1131 | + app = NULL; | ||
3566 | 1132 | + gtk_tree_model_get (GTK_TREE_MODEL (dialog->priv->tree_filter), | ||
3567 | 1133 | + &iter, | ||
3568 | 1134 | + STORE_COL_APP, &app, | ||
3569 | 1135 | + -1); | ||
3570 | 1136 | + | ||
3571 | 1137 | + if (app) { | ||
3572 | 1138 | + GtkWidget *edit_dialog; | ||
3573 | 1139 | + char *name; | ||
3574 | 1140 | + char *exec; | ||
3575 | 1141 | + char *comment; | ||
3576 | 1142 | + | ||
3577 | 1143 | + edit_dialog = gsm_app_dialog_new (gsp_app_get_name (app), | ||
3578 | 1144 | + gsp_app_get_exec (app), | ||
3579 | 1145 | + gsp_app_get_comment (app)); | ||
3580 | 1146 | + gtk_window_set_transient_for (GTK_WINDOW (edit_dialog), | ||
3581 | 1147 | + GTK_WINDOW (dialog)); | ||
3582 | 1148 | + | ||
3583 | 1149 | + if (gsm_app_dialog_run (GSM_APP_DIALOG (edit_dialog), | ||
3584 | 1150 | + &name, &exec, &comment)) { | ||
3585 | 1151 | + gsp_app_update (app, name, comment, exec); | ||
3586 | 1152 | + g_free (name); | ||
3587 | 1153 | + g_free (exec); | ||
3588 | 1154 | + g_free (comment); | ||
3589 | 1155 | + } | ||
3590 | 1156 | + | ||
3591 | 1157 | + g_object_unref (app); | ||
3592 | 1158 | + } | ||
3593 | 1159 | +} | ||
3594 | 1160 | + | ||
3595 | 1161 | +static void | ||
3596 | 1162 | +on_row_activated (GtkTreeView *tree_view, | ||
3597 | 1163 | + GtkTreePath *path, | ||
3598 | 1164 | + GtkTreeViewColumn *column, | ||
3599 | 1165 | + GsmPropertiesDialog *dialog) | ||
3600 | 1166 | +{ | ||
3601 | 1167 | + on_edit_app_clicked (NULL, dialog); | ||
3602 | 1168 | +} | ||
3603 | 1169 | + | ||
3604 | 1170 | +static void | ||
3605 | 1171 | +on_save_session_clicked (GtkWidget *widget, | ||
3606 | 1172 | + GsmPropertiesDialog *dialog) | ||
3607 | 1173 | +{ | ||
3608 | 1174 | + g_debug ("Session saving is not implemented yet!"); | ||
3609 | 1175 | +} | ||
3610 | 1176 | + | ||
3611 | 1177 | +static void | ||
3612 | 1178 | +setup_dialog (GsmPropertiesDialog *dialog) | ||
3613 | 1179 | +{ | ||
3614 | 1180 | + GtkTreeView *treeview; | ||
3615 | 1181 | + GtkWidget *button; | ||
3616 | 1182 | + GtkTreeModel *tree_filter; | ||
3617 | 1183 | + GtkTreeViewColumn *column; | ||
3618 | 1184 | + GtkCellRenderer *renderer; | ||
3619 | 1185 | + GtkTreeSelection *selection; | ||
3620 | 1186 | + GtkTargetList *targetlist; | ||
3621 | 1187 | + | ||
3622 | 1188 | + gtk_dialog_add_buttons (GTK_DIALOG (dialog), | ||
3623 | 1189 | + GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, | ||
3624 | 1190 | + NULL); | ||
3625 | 1191 | + | ||
3626 | 1192 | + dialog->priv->list_store = gtk_list_store_new (NUMBER_OF_COLUMNS, | ||
3627 | 1193 | + G_TYPE_BOOLEAN, | ||
3628 | 1194 | + G_TYPE_BOOLEAN, | ||
3629 | 1195 | + G_TYPE_ICON, | ||
3630 | 1196 | + G_TYPE_STRING, | ||
3631 | 1197 | + G_TYPE_OBJECT, | ||
3632 | 1198 | + G_TYPE_STRING); | ||
3633 | 1199 | + tree_filter = gtk_tree_model_filter_new (GTK_TREE_MODEL (dialog->priv->list_store), | ||
3634 | 1200 | + NULL); | ||
3635 | 1201 | + g_object_unref (dialog->priv->list_store); | ||
3636 | 1202 | + dialog->priv->tree_filter = tree_filter; | ||
3637 | 1203 | + | ||
3638 | 1204 | + gtk_tree_model_filter_set_visible_column (GTK_TREE_MODEL_FILTER (tree_filter), | ||
3639 | 1205 | + STORE_COL_VISIBLE); | ||
3640 | 1206 | + | ||
3641 | 1207 | + treeview = GTK_TREE_VIEW (gtk_builder_get_object (dialog->priv->xml, | ||
3642 | 1208 | + CAPPLET_TREEVIEW_WIDGET_NAME)); | ||
3643 | 1209 | + dialog->priv->treeview = treeview; | ||
3644 | 1210 | + | ||
3645 | 1211 | + gtk_tree_view_set_model (treeview, tree_filter); | ||
3646 | 1212 | + g_object_unref (tree_filter); | ||
3647 | 1213 | + | ||
3648 | 1214 | + gtk_tree_view_set_headers_visible (treeview, FALSE); | ||
3649 | 1215 | + g_signal_connect (treeview, | ||
3650 | 1216 | + "row-activated", | ||
3651 | 1217 | + G_CALLBACK (on_row_activated), | ||
3652 | 1218 | + dialog); | ||
3653 | 1219 | + | ||
3654 | 1220 | + selection = gtk_tree_view_get_selection (treeview); | ||
3655 | 1221 | + gtk_tree_selection_set_mode (selection, GTK_SELECTION_BROWSE); | ||
3656 | 1222 | + g_signal_connect (selection, | ||
3657 | 1223 | + "changed", | ||
3658 | 1224 | + G_CALLBACK (on_selection_changed), | ||
3659 | 1225 | + dialog); | ||
3660 | 1226 | + | ||
3661 | 1227 | + /* CHECKBOX COLUMN */ | ||
3662 | 1228 | + renderer = gtk_cell_renderer_toggle_new (); | ||
3663 | 1229 | + column = gtk_tree_view_column_new_with_attributes (_("Enabled"), | ||
3664 | 1230 | + renderer, | ||
3665 | 1231 | + "active", STORE_COL_ENABLED, | ||
3666 | 1232 | + NULL); | ||
3667 | 1233 | + gtk_tree_view_append_column (treeview, column); | ||
3668 | 1234 | + g_signal_connect (renderer, | ||
3669 | 1235 | + "toggled", | ||
3670 | 1236 | + G_CALLBACK (on_startup_enabled_toggled), | ||
3671 | 1237 | + dialog); | ||
3672 | 1238 | + | ||
3673 | 1239 | + /* ICON COLUMN */ | ||
3674 | 1240 | + renderer = gtk_cell_renderer_pixbuf_new (); | ||
3675 | 1241 | + column = gtk_tree_view_column_new_with_attributes (_("Icon"), | ||
3676 | 1242 | + renderer, | ||
3677 | 1243 | + "gicon", STORE_COL_GICON, | ||
3678 | 1244 | + "sensitive", STORE_COL_ENABLED, | ||
3679 | 1245 | + NULL); | ||
3680 | 1246 | + g_object_set (renderer, | ||
3681 | 1247 | + "stock-size", GSM_PROPERTIES_ICON_SIZE, | ||
3682 | 1248 | + NULL); | ||
3683 | 1249 | + gtk_tree_view_append_column (treeview, column); | ||
3684 | 1250 | + | ||
3685 | 1251 | + /* NAME COLUMN */ | ||
3686 | 1252 | + renderer = gtk_cell_renderer_text_new (); | ||
3687 | 1253 | + column = gtk_tree_view_column_new_with_attributes (_("Program"), | ||
3688 | 1254 | + renderer, | ||
3689 | 1255 | + "markup", STORE_COL_DESCRIPTION, | ||
3690 | 1256 | + "sensitive", STORE_COL_ENABLED, | ||
3691 | 1257 | + NULL); | ||
3692 | 1258 | + g_object_set (renderer, | ||
3693 | 1259 | + "ellipsize", PANGO_ELLIPSIZE_END, | ||
3694 | 1260 | + NULL); | ||
3695 | 1261 | + gtk_tree_view_append_column (treeview, column); | ||
3696 | 1262 | + | ||
3697 | 1263 | + | ||
3698 | 1264 | + gtk_tree_view_column_set_sort_column_id (column, STORE_COL_DESCRIPTION); | ||
3699 | 1265 | + gtk_tree_view_set_search_column (treeview, STORE_COL_SEARCH); | ||
3700 | 1266 | + gtk_tree_view_set_rules_hint (treeview, TRUE); | ||
3701 | 1267 | + | ||
3702 | 1268 | + gtk_tree_view_enable_model_drag_source (treeview, | ||
3703 | 1269 | + GDK_BUTTON1_MASK|GDK_BUTTON2_MASK, | ||
3704 | 1270 | + NULL, 0, | ||
3705 | 1271 | + GDK_ACTION_COPY); | ||
3706 | 1272 | + gtk_drag_source_add_uri_targets (GTK_WIDGET (treeview)); | ||
3707 | 1273 | + | ||
3708 | 1274 | + gtk_drag_dest_set (GTK_WIDGET (treeview), | ||
3709 | 1275 | + GTK_DEST_DEFAULT_ALL, | ||
3710 | 1276 | + NULL, 0, | ||
3711 | 1277 | + GDK_ACTION_COPY); | ||
3712 | 1278 | + | ||
3713 | 1279 | + gtk_drag_dest_add_uri_targets (GTK_WIDGET (treeview)); | ||
3714 | 1280 | + /* we don't want to accept drags coming from this widget */ | ||
3715 | 1281 | + targetlist = gtk_drag_dest_get_target_list (GTK_WIDGET (treeview)); | ||
3716 | 1282 | + if (targetlist != NULL) { | ||
3717 | 1283 | + GtkTargetEntry *targets; | ||
3718 | 1284 | + gint n_targets; | ||
3719 | 1285 | + gint i; | ||
3720 | 1286 | + | ||
3721 | 1287 | + targets = gtk_target_table_new_from_list (targetlist, &n_targets); | ||
3722 | 1288 | + for (i = 0; i < n_targets; i++) | ||
3723 | 1289 | + targets[i].flags = GTK_TARGET_OTHER_WIDGET; | ||
3724 | 1290 | + | ||
3725 | 1291 | + targetlist = gtk_target_list_new (targets, n_targets); | ||
3726 | 1292 | + gtk_drag_dest_set_target_list (GTK_WIDGET (treeview), targetlist); | ||
3727 | 1293 | + gtk_target_list_unref (targetlist); | ||
3728 | 1294 | + | ||
3729 | 1295 | + gtk_target_table_free (targets, n_targets); | ||
3730 | 1296 | + } | ||
3731 | 1297 | + | ||
3732 | 1298 | + g_signal_connect (treeview, "drag_begin", | ||
3733 | 1299 | + G_CALLBACK (on_drag_begin), | ||
3734 | 1300 | + dialog); | ||
3735 | 1301 | + g_signal_connect (treeview, "drag_data_get", | ||
3736 | 1302 | + G_CALLBACK (on_drag_data_get), | ||
3737 | 1303 | + dialog); | ||
3738 | 1304 | + g_signal_connect (treeview, "drag_data_received", | ||
3739 | 1305 | + G_CALLBACK (on_drag_data_received), | ||
3740 | 1306 | + dialog); | ||
3741 | 1307 | + | ||
3742 | 1308 | + gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (dialog->priv->list_store), | ||
3743 | 1309 | + STORE_COL_DESCRIPTION, | ||
3744 | 1310 | + GTK_SORT_ASCENDING); | ||
3745 | 1311 | + | ||
3746 | 1312 | + | ||
3747 | 1313 | + button = GTK_WIDGET (gtk_builder_get_object (dialog->priv->xml, | ||
3748 | 1314 | + CAPPLET_ADD_WIDGET_NAME)); | ||
3749 | 1315 | + dialog->priv->add_button = button; | ||
3750 | 1316 | + g_signal_connect (button, | ||
3751 | 1317 | + "clicked", | ||
3752 | 1318 | + G_CALLBACK (on_add_app_clicked), | ||
3753 | 1319 | + dialog); | ||
3754 | 1320 | + | ||
3755 | 1321 | + button = GTK_WIDGET (gtk_builder_get_object (dialog->priv->xml, | ||
3756 | 1322 | + CAPPLET_DELETE_WIDGET_NAME)); | ||
3757 | 1323 | + dialog->priv->delete_button = button; | ||
3758 | 1324 | + g_signal_connect (button, | ||
3759 | 1325 | + "clicked", | ||
3760 | 1326 | + G_CALLBACK (on_delete_app_clicked), | ||
3761 | 1327 | + dialog); | ||
3762 | 1328 | + | ||
3763 | 1329 | + button = GTK_WIDGET (gtk_builder_get_object (dialog->priv->xml, | ||
3764 | 1330 | + CAPPLET_EDIT_WIDGET_NAME)); | ||
3765 | 1331 | + dialog->priv->edit_button = button; | ||
3766 | 1332 | + g_signal_connect (button, | ||
3767 | 1333 | + "clicked", | ||
3768 | 1334 | + G_CALLBACK (on_edit_app_clicked), | ||
3769 | 1335 | + dialog); | ||
3770 | 1336 | + | ||
3771 | 1337 | + button = GTK_WIDGET (gtk_builder_get_object (dialog->priv->xml, | ||
3772 | 1338 | + CAPPLET_REMEMBER_WIDGET_NAME)); | ||
3773 | 1339 | + g_settings_bind (dialog->priv->settings, SPC_SETTINGS_AUTOSAVE_KEY, | ||
3774 | 1340 | + button, "active", G_SETTINGS_BIND_DEFAULT); | ||
3775 | 1341 | + | ||
3776 | 1342 | + button = GTK_WIDGET (gtk_builder_get_object (dialog->priv->xml, | ||
3777 | 1343 | + CAPPLET_SAVE_WIDGET_NAME)); | ||
3778 | 1344 | + g_signal_connect (button, | ||
3779 | 1345 | + "clicked", | ||
3780 | 1346 | + G_CALLBACK (on_save_session_clicked), | ||
3781 | 1347 | + dialog); | ||
3782 | 1348 | + | ||
3783 | 1349 | + dialog->priv->manager = gsp_app_manager_get (); | ||
3784 | 1350 | + gsp_app_manager_fill (dialog->priv->manager); | ||
3785 | 1351 | + g_signal_connect_swapped (dialog->priv->manager, "added", | ||
3786 | 1352 | + G_CALLBACK (_app_added), dialog); | ||
3787 | 1353 | + g_signal_connect_swapped (dialog->priv->manager, "removed", | ||
3788 | 1354 | + G_CALLBACK (_app_removed), dialog); | ||
3789 | 1355 | + | ||
3790 | 1356 | + populate_model (dialog); | ||
3791 | 1357 | +} | ||
3792 | 1358 | + | ||
3793 | 1359 | +static GObject * | ||
3794 | 1360 | +gsm_properties_dialog_constructor (GType type, | ||
3795 | 1361 | + guint n_construct_properties, | ||
3796 | 1362 | + GObjectConstructParam *construct_properties) | ||
3797 | 1363 | +{ | ||
3798 | 1364 | + GsmPropertiesDialog *dialog; | ||
3799 | 1365 | + | ||
3800 | 1366 | + dialog = GSM_PROPERTIES_DIALOG (G_OBJECT_CLASS (gsm_properties_dialog_parent_class)->constructor (type, | ||
3801 | 1367 | + n_construct_properties, | ||
3802 | 1368 | + construct_properties)); | ||
3803 | 1369 | + | ||
3804 | 1370 | + setup_dialog (dialog); | ||
3805 | 1371 | + | ||
3806 | 1372 | + gtk_widget_show (GTK_WIDGET (dialog)); | ||
3807 | 1373 | + | ||
3808 | 1374 | + return G_OBJECT (dialog); | ||
3809 | 1375 | +} | ||
3810 | 1376 | + | ||
3811 | 1377 | +static void | ||
3812 | 1378 | +gsm_properties_dialog_dispose (GObject *object) | ||
3813 | 1379 | +{ | ||
3814 | 1380 | + GsmPropertiesDialog *dialog; | ||
3815 | 1381 | + | ||
3816 | 1382 | + g_return_if_fail (object != NULL); | ||
3817 | 1383 | + g_return_if_fail (GSM_IS_PROPERTIES_DIALOG (object)); | ||
3818 | 1384 | + | ||
3819 | 1385 | + dialog = GSM_PROPERTIES_DIALOG (object); | ||
3820 | 1386 | + | ||
3821 | 1387 | + if (dialog->priv->xml != NULL) { | ||
3822 | 1388 | + g_object_unref (dialog->priv->xml); | ||
3823 | 1389 | + dialog->priv->xml = NULL; | ||
3824 | 1390 | + } | ||
3825 | 1391 | + | ||
3826 | 1392 | + if (dialog->priv->settings != NULL) { | ||
3827 | 1393 | + g_object_unref (dialog->priv->settings); | ||
3828 | 1394 | + dialog->priv->settings = NULL; | ||
3829 | 1395 | + } | ||
3830 | 1396 | + | ||
3831 | 1397 | + G_OBJECT_CLASS (gsm_properties_dialog_parent_class)->dispose (object); | ||
3832 | 1398 | + | ||
3833 | 1399 | + /* it's important to do this after chaining to the parent dispose | ||
3834 | 1400 | + * method because we want to make sure the treeview has been disposed | ||
3835 | 1401 | + * and removed all its references to GspApp objects */ | ||
3836 | 1402 | + if (dialog->priv->manager != NULL) { | ||
3837 | 1403 | + g_object_unref (dialog->priv->manager); | ||
3838 | 1404 | + dialog->priv->manager = NULL; | ||
3839 | 1405 | + } | ||
3840 | 1406 | +} | ||
3841 | 1407 | + | ||
3842 | 1408 | +static void | ||
3843 | 1409 | +gsm_properties_dialog_class_init (GsmPropertiesDialogClass *klass) | ||
3844 | 1410 | +{ | ||
3845 | 1411 | + GObjectClass *object_class = G_OBJECT_CLASS (klass); | ||
3846 | 1412 | + | ||
3847 | 1413 | + object_class->constructor = gsm_properties_dialog_constructor; | ||
3848 | 1414 | + object_class->dispose = gsm_properties_dialog_dispose; | ||
3849 | 1415 | + object_class->finalize = gsm_properties_dialog_finalize; | ||
3850 | 1416 | + | ||
3851 | 1417 | + g_type_class_add_private (klass, sizeof (GsmPropertiesDialogPrivate)); | ||
3852 | 1418 | +} | ||
3853 | 1419 | + | ||
3854 | 1420 | +static void | ||
3855 | 1421 | +gsm_properties_dialog_init (GsmPropertiesDialog *dialog) | ||
3856 | 1422 | +{ | ||
3857 | 1423 | + GtkWidget *content_area; | ||
3858 | 1424 | + GtkWidget *widget; | ||
3859 | 1425 | + GError *error; | ||
3860 | 1426 | + | ||
3861 | 1427 | + dialog->priv = GSM_PROPERTIES_DIALOG_GET_PRIVATE (dialog); | ||
3862 | 1428 | + | ||
3863 | 1429 | + dialog->priv->settings = g_settings_new (SPC_SETTINGS_SCHEMA); | ||
3864 | 1430 | + | ||
3865 | 1431 | + dialog->priv->xml = gtk_builder_new (); | ||
3866 | 1432 | + gtk_builder_set_translation_domain (dialog->priv->xml, GETTEXT_PACKAGE); | ||
3867 | 1433 | + | ||
3868 | 1434 | + error = NULL; | ||
3869 | 1435 | + if (!gtk_builder_add_from_file (dialog->priv->xml, | ||
3870 | 1436 | + GTKBUILDER_DIR "/" GTKBUILDER_FILE, | ||
3871 | 1437 | + &error)) { | ||
3872 | 1438 | + if (error) { | ||
3873 | 1439 | + g_warning ("Could not load capplet UI file: %s", | ||
3874 | 1440 | + error->message); | ||
3875 | 1441 | + g_error_free (error); | ||
3876 | 1442 | + } else { | ||
3877 | 1443 | + g_warning ("Could not load capplet UI file."); | ||
3878 | 1444 | + } | ||
3879 | 1445 | + } | ||
3880 | 1446 | + | ||
3881 | 1447 | + content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); | ||
3882 | 1448 | + widget = GTK_WIDGET (gtk_builder_get_object (dialog->priv->xml, | ||
3883 | 1449 | + "main-notebook")); | ||
3884 | 1450 | + gtk_box_pack_start (GTK_BOX (content_area), widget, TRUE, TRUE, 0); | ||
3885 | 1451 | + | ||
3886 | 1452 | + gtk_window_set_default_size (GTK_WINDOW (dialog), 600, 450); | ||
3887 | 1453 | + gtk_window_set_resizable (GTK_WINDOW (dialog), TRUE); | ||
3888 | 1454 | + gtk_container_set_border_width (GTK_CONTAINER (dialog), 6); | ||
3889 | 1455 | + gtk_box_set_spacing (GTK_BOX (content_area), 2); | ||
3890 | 1456 | + gtk_window_set_icon_name (GTK_WINDOW (dialog), "session-properties"); | ||
3891 | 1457 | + gtk_window_set_title (GTK_WINDOW (dialog), _("Startup Applications Preferences")); | ||
3892 | 1458 | +} | ||
3893 | 1459 | + | ||
3894 | 1460 | +static void | ||
3895 | 1461 | +gsm_properties_dialog_finalize (GObject *object) | ||
3896 | 1462 | +{ | ||
3897 | 1463 | + GsmPropertiesDialog *dialog; | ||
3898 | 1464 | + | ||
3899 | 1465 | + g_return_if_fail (object != NULL); | ||
3900 | 1466 | + g_return_if_fail (GSM_IS_PROPERTIES_DIALOG (object)); | ||
3901 | 1467 | + | ||
3902 | 1468 | + dialog = GSM_PROPERTIES_DIALOG (object); | ||
3903 | 1469 | + | ||
3904 | 1470 | + g_return_if_fail (dialog->priv != NULL); | ||
3905 | 1471 | + | ||
3906 | 1472 | + G_OBJECT_CLASS (gsm_properties_dialog_parent_class)->finalize (object); | ||
3907 | 1473 | +} | ||
3908 | 1474 | + | ||
3909 | 1475 | +GtkWidget * | ||
3910 | 1476 | +gsm_properties_dialog_new (void) | ||
3911 | 1477 | +{ | ||
3912 | 1478 | + GObject *object; | ||
3913 | 1479 | + | ||
3914 | 1480 | + object = g_object_new (GSM_TYPE_PROPERTIES_DIALOG, | ||
3915 | 1481 | + NULL); | ||
3916 | 1482 | + | ||
3917 | 1483 | + return GTK_WIDGET (object); | ||
3918 | 1484 | +} | ||
3919 | 1485 | Index: gnome-session/capplet/gsm-properties-dialog.h | ||
3920 | 1486 | =================================================================== | ||
3921 | 1487 | --- /dev/null | ||
3922 | 1488 | +++ gnome-session/capplet/gsm-properties-dialog.h | ||
3923 | 1489 | @@ -0,0 +1,57 @@ | ||
3924 | 1490 | +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- | ||
3925 | 1491 | + * | ||
3926 | 1492 | + * Copyright (C) 2008 William Jon McCann <jmccann@redhat.com> | ||
3927 | 1493 | + * | ||
3928 | 1494 | + * This program is free software; you can redistribute it and/or modify | ||
3929 | 1495 | + * it under the terms of the GNU General Public License as published by | ||
3930 | 1496 | + * the Free Software Foundation; either version 2 of the License, or | ||
3931 | 1497 | + * (at your option) any later version. | ||
3932 | 1498 | + * | ||
3933 | 1499 | + * This program is distributed in the hope that it will be useful, | ||
3934 | 1500 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
3935 | 1501 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
3936 | 1502 | + * GNU General Public License for more details. | ||
3937 | 1503 | + * | ||
3938 | 1504 | + * You should have received a copy of the GNU General Public License | ||
3939 | 1505 | + * along with this program; if not, write to the Free Software | ||
3940 | 1506 | + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
3941 | 1507 | + * | ||
3942 | 1508 | + */ | ||
3943 | 1509 | + | ||
3944 | 1510 | +#ifndef __GSM_PROPERTIES_DIALOG_H | ||
3945 | 1511 | +#define __GSM_PROPERTIES_DIALOG_H | ||
3946 | 1512 | + | ||
3947 | 1513 | +#include <glib-object.h> | ||
3948 | 1514 | +#include <gtk/gtk.h> | ||
3949 | 1515 | + | ||
3950 | 1516 | +G_BEGIN_DECLS | ||
3951 | 1517 | + | ||
3952 | 1518 | +#define GSM_TYPE_PROPERTIES_DIALOG (gsm_properties_dialog_get_type ()) | ||
3953 | 1519 | +#define GSM_PROPERTIES_DIALOG(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSM_TYPE_PROPERTIES_DIALOG, GsmPropertiesDialog)) | ||
3954 | 1520 | +#define GSM_PROPERTIES_DIALOG_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GSM_TYPE_PROPERTIES_DIALOG, GsmPropertiesDialogClass)) | ||
3955 | 1521 | +#define GSM_IS_PROPERTIES_DIALOG(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSM_TYPE_PROPERTIES_DIALOG)) | ||
3956 | 1522 | +#define GSM_IS_PROPERTIES_DIALOG_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GSM_TYPE_PROPERTIES_DIALOG)) | ||
3957 | 1523 | +#define GSM_PROPERTIES_DIALOG_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSM_TYPE_PROPERTIES_DIALOG, GsmPropertiesDialogClass)) | ||
3958 | 1524 | + | ||
3959 | 1525 | +typedef struct GsmPropertiesDialogPrivate GsmPropertiesDialogPrivate; | ||
3960 | 1526 | + | ||
3961 | 1527 | +typedef struct | ||
3962 | 1528 | +{ | ||
3963 | 1529 | + GtkDialog parent; | ||
3964 | 1530 | + GsmPropertiesDialogPrivate *priv; | ||
3965 | 1531 | +} GsmPropertiesDialog; | ||
3966 | 1532 | + | ||
3967 | 1533 | +typedef struct | ||
3968 | 1534 | +{ | ||
3969 | 1535 | + GtkDialogClass parent_class; | ||
3970 | 1536 | +} GsmPropertiesDialogClass; | ||
3971 | 1537 | + | ||
3972 | 1538 | +GType gsm_properties_dialog_get_type (void); | ||
3973 | 1539 | + | ||
3974 | 1540 | +GtkWidget * gsm_properties_dialog_new (void); | ||
3975 | 1541 | + | ||
3976 | 1542 | +#define GSM_PROPERTIES_ICON_SIZE GTK_ICON_SIZE_LARGE_TOOLBAR | ||
3977 | 1543 | + | ||
3978 | 1544 | +G_END_DECLS | ||
3979 | 1545 | + | ||
3980 | 1546 | +#endif /* __GSM_PROPERTIES_DIALOG_H */ | ||
3981 | 1547 | Index: gnome-session/capplet/gsp-app-manager.c | ||
3982 | 1548 | =================================================================== | ||
3983 | 1549 | --- /dev/null | ||
3984 | 1550 | +++ gnome-session/capplet/gsp-app-manager.c | ||
3985 | 1551 | @@ -0,0 +1,593 @@ | ||
3986 | 1552 | +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- | ||
3987 | 1553 | + * | ||
3988 | 1554 | + * Copyright (C) 1999 Free Software Foundation, Inc. | ||
3989 | 1555 | + * Copyright (C) 2007, 2009 Vincent Untz. | ||
3990 | 1556 | + * Copyright (C) 2008 Lucas Rocha. | ||
3991 | 1557 | + * Copyright (C) 2008 William Jon McCann <jmccann@redhat.com> | ||
3992 | 1558 | + * | ||
3993 | 1559 | + * This program is free software; you can redistribute it and/or modify | ||
3994 | 1560 | + * it under the terms of the GNU General Public License as published by | ||
3995 | 1561 | + * the Free Software Foundation; either version 2 of the License, or | ||
3996 | 1562 | + * (at your option) any later version. | ||
3997 | 1563 | + * | ||
3998 | 1564 | + * This program is distributed in the hope that it will be useful, | ||
3999 | 1565 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
4000 | 1566 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
4001 | 1567 | + * GNU General Public License for more details. | ||
4002 | 1568 | + * | ||
4003 | 1569 | + * You should have received a copy of the GNU General Public License | ||
4004 | 1570 | + * along with this program; if not, write to the Free Software | ||
4005 | 1571 | + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
4006 | 1572 | + * | ||
4007 | 1573 | + */ | ||
4008 | 1574 | + | ||
4009 | 1575 | +#include <string.h> | ||
4010 | 1576 | + | ||
4011 | 1577 | +#include "gsm-util.h" | ||
4012 | 1578 | +#include "gsp-app.h" | ||
4013 | 1579 | + | ||
4014 | 1580 | +#include "gsp-app-manager.h" | ||
4015 | 1581 | + | ||
4016 | 1582 | +static GspAppManager *manager = NULL; | ||
4017 | 1583 | + | ||
4018 | 1584 | +typedef struct { | ||
4019 | 1585 | + char *dir; | ||
4020 | 1586 | + int index; | ||
4021 | 1587 | + GFileMonitor *monitor; | ||
4022 | 1588 | +} GspXdgDir; | ||
4023 | 1589 | + | ||
4024 | 1590 | +struct _GspAppManagerPrivate { | ||
4025 | 1591 | + GSList *apps; | ||
4026 | 1592 | + GSList *dirs; | ||
4027 | 1593 | +}; | ||
4028 | 1594 | + | ||
4029 | 1595 | +#define GSP_APP_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSP_TYPE_APP_MANAGER, GspAppManagerPrivate)) | ||
4030 | 1596 | + | ||
4031 | 1597 | + | ||
4032 | 1598 | +enum { | ||
4033 | 1599 | + ADDED, | ||
4034 | 1600 | + REMOVED, | ||
4035 | 1601 | + LAST_SIGNAL | ||
4036 | 1602 | +}; | ||
4037 | 1603 | + | ||
4038 | 1604 | +static guint gsp_app_manager_signals[LAST_SIGNAL] = { 0 }; | ||
4039 | 1605 | + | ||
4040 | 1606 | + | ||
4041 | 1607 | +G_DEFINE_TYPE (GspAppManager, gsp_app_manager, G_TYPE_OBJECT) | ||
4042 | 1608 | + | ||
4043 | 1609 | +static void gsp_app_manager_dispose (GObject *object); | ||
4044 | 1610 | +static void gsp_app_manager_finalize (GObject *object); | ||
4045 | 1611 | +static void _gsp_app_manager_app_unref (GspApp *app, | ||
4046 | 1612 | + GspAppManager *manager); | ||
4047 | 1613 | +static void _gsp_app_manager_app_removed (GspAppManager *manager, | ||
4048 | 1614 | + GspApp *app); | ||
4049 | 1615 | + | ||
4050 | 1616 | +static GspXdgDir * | ||
4051 | 1617 | +_gsp_xdg_dir_new (const char *dir, | ||
4052 | 1618 | + int index) | ||
4053 | 1619 | +{ | ||
4054 | 1620 | + GspXdgDir *xdgdir; | ||
4055 | 1621 | + | ||
4056 | 1622 | + xdgdir = g_slice_new (GspXdgDir); | ||
4057 | 1623 | + | ||
4058 | 1624 | + xdgdir->dir = g_strdup (dir); | ||
4059 | 1625 | + xdgdir->index = index; | ||
4060 | 1626 | + xdgdir->monitor = NULL; | ||
4061 | 1627 | + | ||
4062 | 1628 | + return xdgdir; | ||
4063 | 1629 | +} | ||
4064 | 1630 | + | ||
4065 | 1631 | +static void | ||
4066 | 1632 | +_gsp_xdg_dir_free (GspXdgDir *xdgdir) | ||
4067 | 1633 | +{ | ||
4068 | 1634 | + if (xdgdir->dir) { | ||
4069 | 1635 | + g_free (xdgdir->dir); | ||
4070 | 1636 | + xdgdir->dir = NULL; | ||
4071 | 1637 | + } | ||
4072 | 1638 | + | ||
4073 | 1639 | + if (xdgdir->monitor) { | ||
4074 | 1640 | + g_file_monitor_cancel (xdgdir->monitor); | ||
4075 | 1641 | + g_object_unref (xdgdir->monitor); | ||
4076 | 1642 | + xdgdir->monitor = NULL; | ||
4077 | 1643 | + } | ||
4078 | 1644 | + | ||
4079 | 1645 | + g_slice_free (GspXdgDir, xdgdir); | ||
4080 | 1646 | +} | ||
4081 | 1647 | + | ||
4082 | 1648 | +static void | ||
4083 | 1649 | +gsp_app_manager_class_init (GspAppManagerClass *class) | ||
4084 | 1650 | +{ | ||
4085 | 1651 | + GObjectClass *gobject_class = G_OBJECT_CLASS (class); | ||
4086 | 1652 | + | ||
4087 | 1653 | + gobject_class->dispose = gsp_app_manager_dispose; | ||
4088 | 1654 | + gobject_class->finalize = gsp_app_manager_finalize; | ||
4089 | 1655 | + | ||
4090 | 1656 | + gsp_app_manager_signals[ADDED] = | ||
4091 | 1657 | + g_signal_new ("added", | ||
4092 | 1658 | + G_TYPE_FROM_CLASS (gobject_class), | ||
4093 | 1659 | + G_SIGNAL_RUN_LAST, | ||
4094 | 1660 | + G_STRUCT_OFFSET (GspAppManagerClass, | ||
4095 | 1661 | + added), | ||
4096 | 1662 | + NULL, | ||
4097 | 1663 | + NULL, | ||
4098 | 1664 | + g_cclosure_marshal_VOID__OBJECT, | ||
4099 | 1665 | + G_TYPE_NONE, 1, G_TYPE_OBJECT); | ||
4100 | 1666 | + | ||
4101 | 1667 | + gsp_app_manager_signals[REMOVED] = | ||
4102 | 1668 | + g_signal_new ("removed", | ||
4103 | 1669 | + G_TYPE_FROM_CLASS (gobject_class), | ||
4104 | 1670 | + G_SIGNAL_RUN_LAST, | ||
4105 | 1671 | + G_STRUCT_OFFSET (GspAppManagerClass, | ||
4106 | 1672 | + removed), | ||
4107 | 1673 | + NULL, | ||
4108 | 1674 | + NULL, | ||
4109 | 1675 | + g_cclosure_marshal_VOID__OBJECT, | ||
4110 | 1676 | + G_TYPE_NONE, 1, G_TYPE_OBJECT); | ||
4111 | 1677 | + | ||
4112 | 1678 | + g_type_class_add_private (class, sizeof (GspAppManagerPrivate)); | ||
4113 | 1679 | +} | ||
4114 | 1680 | + | ||
4115 | 1681 | +static void | ||
4116 | 1682 | +gsp_app_manager_init (GspAppManager *manager) | ||
4117 | 1683 | +{ | ||
4118 | 1684 | + manager->priv = GSP_APP_MANAGER_GET_PRIVATE (manager); | ||
4119 | 1685 | + | ||
4120 | 1686 | + memset (manager->priv, 0, sizeof (GspAppManagerPrivate)); | ||
4121 | 1687 | +} | ||
4122 | 1688 | + | ||
4123 | 1689 | +static void | ||
4124 | 1690 | +gsp_app_manager_dispose (GObject *object) | ||
4125 | 1691 | +{ | ||
4126 | 1692 | + GspAppManager *manager; | ||
4127 | 1693 | + | ||
4128 | 1694 | + g_return_if_fail (object != NULL); | ||
4129 | 1695 | + g_return_if_fail (GSP_IS_APP_MANAGER (object)); | ||
4130 | 1696 | + | ||
4131 | 1697 | + manager = GSP_APP_MANAGER (object); | ||
4132 | 1698 | + | ||
4133 | 1699 | + /* we unref GspApp objects in dispose since they might need to | ||
4134 | 1700 | + * reference us during their dispose/finalize */ | ||
4135 | 1701 | + g_slist_foreach (manager->priv->apps, | ||
4136 | 1702 | + (GFunc) _gsp_app_manager_app_unref, manager); | ||
4137 | 1703 | + g_slist_free (manager->priv->apps); | ||
4138 | 1704 | + manager->priv->apps = NULL; | ||
4139 | 1705 | + | ||
4140 | 1706 | + G_OBJECT_CLASS (gsp_app_manager_parent_class)->dispose (object); | ||
4141 | 1707 | +} | ||
4142 | 1708 | + | ||
4143 | 1709 | +static void | ||
4144 | 1710 | +gsp_app_manager_finalize (GObject *object) | ||
4145 | 1711 | +{ | ||
4146 | 1712 | + GspAppManager *manager; | ||
4147 | 1713 | + | ||
4148 | 1714 | + g_return_if_fail (object != NULL); | ||
4149 | 1715 | + g_return_if_fail (GSP_IS_APP_MANAGER (object)); | ||
4150 | 1716 | + | ||
4151 | 1717 | + manager = GSP_APP_MANAGER (object); | ||
4152 | 1718 | + | ||
4153 | 1719 | + g_slist_foreach (manager->priv->dirs, | ||
4154 | 1720 | + (GFunc) _gsp_xdg_dir_free, NULL); | ||
4155 | 1721 | + g_slist_free (manager->priv->dirs); | ||
4156 | 1722 | + manager->priv->dirs = NULL; | ||
4157 | 1723 | + | ||
4158 | 1724 | + G_OBJECT_CLASS (gsp_app_manager_parent_class)->finalize (object); | ||
4159 | 1725 | + | ||
4160 | 1726 | + manager = NULL; | ||
4161 | 1727 | +} | ||
4162 | 1728 | + | ||
4163 | 1729 | +static void | ||
4164 | 1730 | +_gsp_app_manager_emit_added (GspAppManager *manager, | ||
4165 | 1731 | + GspApp *app) | ||
4166 | 1732 | +{ | ||
4167 | 1733 | + g_signal_emit (G_OBJECT (manager), gsp_app_manager_signals[ADDED], | ||
4168 | 1734 | + 0, app); | ||
4169 | 1735 | +} | ||
4170 | 1736 | + | ||
4171 | 1737 | +static void | ||
4172 | 1738 | +_gsp_app_manager_emit_removed (GspAppManager *manager, | ||
4173 | 1739 | + GspApp *app) | ||
4174 | 1740 | +{ | ||
4175 | 1741 | + g_signal_emit (G_OBJECT (manager), gsp_app_manager_signals[REMOVED], | ||
4176 | 1742 | + 0, app); | ||
4177 | 1743 | +} | ||
4178 | 1744 | + | ||
4179 | 1745 | +/* | ||
4180 | 1746 | + * Directories | ||
4181 | 1747 | + */ | ||
4182 | 1748 | + | ||
4183 | 1749 | +static int | ||
4184 | 1750 | +gsp_app_manager_get_dir_index (GspAppManager *manager, | ||
4185 | 1751 | + const char *dir) | ||
4186 | 1752 | +{ | ||
4187 | 1753 | + GSList *l; | ||
4188 | 1754 | + GspXdgDir *xdgdir; | ||
4189 | 1755 | + | ||
4190 | 1756 | + g_return_val_if_fail (GSP_IS_APP_MANAGER (manager), -1); | ||
4191 | 1757 | + g_return_val_if_fail (dir != NULL, -1); | ||
4192 | 1758 | + | ||
4193 | 1759 | + for (l = manager->priv->dirs; l != NULL; l = l->next) { | ||
4194 | 1760 | + xdgdir = l->data; | ||
4195 | 1761 | + if (strcmp (dir, xdgdir->dir) == 0) { | ||
4196 | 1762 | + return xdgdir->index; | ||
4197 | 1763 | + } | ||
4198 | 1764 | + } | ||
4199 | 1765 | + | ||
4200 | 1766 | + return -1; | ||
4201 | 1767 | +} | ||
4202 | 1768 | + | ||
4203 | 1769 | +const char * | ||
4204 | 1770 | +gsp_app_manager_get_dir (GspAppManager *manager, | ||
4205 | 1771 | + unsigned int index) | ||
4206 | 1772 | +{ | ||
4207 | 1773 | + GSList *l; | ||
4208 | 1774 | + GspXdgDir *xdgdir; | ||
4209 | 1775 | + | ||
4210 | 1776 | + g_return_val_if_fail (GSP_IS_APP_MANAGER (manager), NULL); | ||
4211 | 1777 | + | ||
4212 | 1778 | + for (l = manager->priv->dirs; l != NULL; l = l->next) { | ||
4213 | 1779 | + xdgdir = l->data; | ||
4214 | 1780 | + if (index == xdgdir->index) { | ||
4215 | 1781 | + return xdgdir->dir; | ||
4216 | 1782 | + } | ||
4217 | 1783 | + } | ||
4218 | 1784 | + | ||
4219 | 1785 | + return NULL; | ||
4220 | 1786 | +} | ||
4221 | 1787 | + | ||
4222 | 1788 | +static int | ||
4223 | 1789 | +_gsp_app_manager_find_dir_with_basename (GspAppManager *manager, | ||
4224 | 1790 | + const char *basename, | ||
4225 | 1791 | + int minimum_index) | ||
4226 | 1792 | +{ | ||
4227 | 1793 | + GSList *l; | ||
4228 | 1794 | + GspXdgDir *xdgdir; | ||
4229 | 1795 | + char *path; | ||
4230 | 1796 | + GKeyFile *keyfile; | ||
4231 | 1797 | + int result = -1; | ||
4232 | 1798 | + | ||
4233 | 1799 | + path = NULL; | ||
4234 | 1800 | + keyfile = g_key_file_new (); | ||
4235 | 1801 | + | ||
4236 | 1802 | + for (l = manager->priv->dirs; l != NULL; l = l->next) { | ||
4237 | 1803 | + xdgdir = l->data; | ||
4238 | 1804 | + | ||
4239 | 1805 | + if (xdgdir->index <= minimum_index) { | ||
4240 | 1806 | + continue; | ||
4241 | 1807 | + } | ||
4242 | 1808 | + | ||
4243 | 1809 | + g_free (path); | ||
4244 | 1810 | + path = g_build_filename (xdgdir->dir, basename, NULL); | ||
4245 | 1811 | + if (!g_file_test (path, G_FILE_TEST_EXISTS)) { | ||
4246 | 1812 | + continue; | ||
4247 | 1813 | + } | ||
4248 | 1814 | + | ||
4249 | 1815 | + if (!g_key_file_load_from_file (keyfile, path, | ||
4250 | 1816 | + G_KEY_FILE_NONE, NULL)) { | ||
4251 | 1817 | + continue; | ||
4252 | 1818 | + } | ||
4253 | 1819 | + | ||
4254 | 1820 | + /* the file exists and is readable */ | ||
4255 | 1821 | + if (result == -1) { | ||
4256 | 1822 | + result = xdgdir->index; | ||
4257 | 1823 | + } else { | ||
4258 | 1824 | + result = MIN (result, xdgdir->index); | ||
4259 | 1825 | + } | ||
4260 | 1826 | + } | ||
4261 | 1827 | + | ||
4262 | 1828 | + g_key_file_free (keyfile); | ||
4263 | 1829 | + g_free (path); | ||
4264 | 1830 | + | ||
4265 | 1831 | + return result; | ||
4266 | 1832 | +} | ||
4267 | 1833 | + | ||
4268 | 1834 | +static void | ||
4269 | 1835 | +_gsp_app_manager_handle_delete (GspAppManager *manager, | ||
4270 | 1836 | + GspApp *app, | ||
4271 | 1837 | + const char *basename, | ||
4272 | 1838 | + int index) | ||
4273 | 1839 | +{ | ||
4274 | 1840 | + unsigned int position; | ||
4275 | 1841 | + unsigned int system_position; | ||
4276 | 1842 | + | ||
4277 | 1843 | + position = gsp_app_get_xdg_position (app); | ||
4278 | 1844 | + system_position = gsp_app_get_xdg_system_position (app); | ||
4279 | 1845 | + | ||
4280 | 1846 | + if (system_position < index) { | ||
4281 | 1847 | + /* it got deleted, but we don't even care about it */ | ||
4282 | 1848 | + return; | ||
4283 | 1849 | + } | ||
4284 | 1850 | + | ||
4285 | 1851 | + if (index < position) { | ||
4286 | 1852 | + /* it got deleted, but in a position earlier than the current | ||
4287 | 1853 | + * one. This happens when the user file was changed and became | ||
4288 | 1854 | + * identical to the system file; in this case, the user file is | ||
4289 | 1855 | + * simply removed. */ | ||
4290 | 1856 | + g_assert (index == 0); | ||
4291 | 1857 | + return; | ||
4292 | 1858 | + } | ||
4293 | 1859 | + | ||
4294 | 1860 | + if (position == index && | ||
4295 | 1861 | + (system_position == index || system_position == G_MAXUINT)) { | ||
4296 | 1862 | + /* the file used by the user was deleted, and there's no other | ||
4297 | 1863 | + * file in system directories. So it really got deleted. */ | ||
4298 | 1864 | + _gsp_app_manager_app_removed (manager, app); | ||
4299 | 1865 | + return; | ||
4300 | 1866 | + } | ||
4301 | 1867 | + | ||
4302 | 1868 | + if (system_position == index) { | ||
4303 | 1869 | + /* then we know that position != index; we just hae to tell | ||
4304 | 1870 | + * GspApp if there's still a system directory containing this | ||
4305 | 1871 | + * basename */ | ||
4306 | 1872 | + int new_system; | ||
4307 | 1873 | + | ||
4308 | 1874 | + new_system = _gsp_app_manager_find_dir_with_basename (manager, | ||
4309 | 1875 | + basename, | ||
4310 | 1876 | + index); | ||
4311 | 1877 | + if (new_system < 0) { | ||
4312 | 1878 | + gsp_app_set_xdg_system_position (app, G_MAXUINT); | ||
4313 | 1879 | + } else { | ||
4314 | 1880 | + gsp_app_set_xdg_system_position (app, new_system); | ||
4315 | 1881 | + } | ||
4316 | 1882 | + | ||
4317 | 1883 | + return; | ||
4318 | 1884 | + } | ||
4319 | 1885 | + | ||
4320 | 1886 | + if (position == index) { | ||
4321 | 1887 | + /* then we know that system_position != G_MAXUINT; we need to | ||
4322 | 1888 | + * tell GspApp to change position to system_position */ | ||
4323 | 1889 | + const char *dir; | ||
4324 | 1890 | + | ||
4325 | 1891 | + dir = gsp_app_manager_get_dir (manager, system_position); | ||
4326 | 1892 | + if (dir) { | ||
4327 | 1893 | + char *path; | ||
4328 | 1894 | + | ||
4329 | 1895 | + path = g_build_filename (dir, basename, NULL); | ||
4330 | 1896 | + gsp_app_reload_at (app, path, | ||
4331 | 1897 | + (unsigned int) system_position); | ||
4332 | 1898 | + g_free (path); | ||
4333 | 1899 | + } else { | ||
4334 | 1900 | + _gsp_app_manager_app_removed (manager, app); | ||
4335 | 1901 | + } | ||
4336 | 1902 | + | ||
4337 | 1903 | + return; | ||
4338 | 1904 | + } | ||
4339 | 1905 | + | ||
4340 | 1906 | + g_assert_not_reached (); | ||
4341 | 1907 | +} | ||
4342 | 1908 | + | ||
4343 | 1909 | +static gboolean | ||
4344 | 1910 | +gsp_app_manager_xdg_dir_monitor (GFileMonitor *monitor, | ||
4345 | 1911 | + GFile *child, | ||
4346 | 1912 | + GFile *other_file, | ||
4347 | 1913 | + GFileMonitorEvent flags, | ||
4348 | 1914 | + gpointer data) | ||
4349 | 1915 | +{ | ||
4350 | 1916 | + GspAppManager *manager; | ||
4351 | 1917 | + GspApp *old_app; | ||
4352 | 1918 | + GspApp *app; | ||
4353 | 1919 | + GFile *parent; | ||
4354 | 1920 | + char *basename; | ||
4355 | 1921 | + char *dir; | ||
4356 | 1922 | + char *path; | ||
4357 | 1923 | + int index; | ||
4358 | 1924 | + | ||
4359 | 1925 | + manager = GSP_APP_MANAGER (data); | ||
4360 | 1926 | + | ||
4361 | 1927 | + basename = g_file_get_basename (child); | ||
4362 | 1928 | + if (!g_str_has_suffix (basename, ".desktop")) { | ||
4363 | 1929 | + /* not a desktop file, we can ignore */ | ||
4364 | 1930 | + g_free (basename); | ||
4365 | 1931 | + return TRUE; | ||
4366 | 1932 | + } | ||
4367 | 1933 | + old_app = gsp_app_manager_find_app_with_basename (manager, basename); | ||
4368 | 1934 | + | ||
4369 | 1935 | + parent = g_file_get_parent (child); | ||
4370 | 1936 | + dir = g_file_get_path (parent); | ||
4371 | 1937 | + g_object_unref (parent); | ||
4372 | 1938 | + | ||
4373 | 1939 | + index = gsp_app_manager_get_dir_index (manager, dir); | ||
4374 | 1940 | + if (index < 0) { | ||
4375 | 1941 | + /* not a directory we know; should never happen, though */ | ||
4376 | 1942 | + g_free (dir); | ||
4377 | 1943 | + return TRUE; | ||
4378 | 1944 | + } | ||
4379 | 1945 | + | ||
4380 | 1946 | + path = g_file_get_path (child); | ||
4381 | 1947 | + | ||
4382 | 1948 | + switch (flags) { | ||
4383 | 1949 | + case G_FILE_MONITOR_EVENT_CHANGED: | ||
4384 | 1950 | + case G_FILE_MONITOR_EVENT_CREATED: | ||
4385 | 1951 | + /* we just do as if it was a new file: GspApp is clever enough | ||
4386 | 1952 | + * to do the right thing */ | ||
4387 | 1953 | + app = gsp_app_new (path, (unsigned int) index); | ||
4388 | 1954 | + | ||
4389 | 1955 | + /* we didn't have this app before, so add it */ | ||
4390 | 1956 | + if (old_app == NULL && app != NULL) { | ||
4391 | 1957 | + gsp_app_manager_add (manager, app); | ||
4392 | 1958 | + g_object_unref (app); | ||
4393 | 1959 | + } | ||
4394 | 1960 | + /* else: it was just updated, GspApp took care of | ||
4395 | 1961 | + * sending the event */ | ||
4396 | 1962 | + break; | ||
4397 | 1963 | + case G_FILE_MONITOR_EVENT_DELETED: | ||
4398 | 1964 | + if (!old_app) { | ||
4399 | 1965 | + /* it got deleted, but we don't know about it, so | ||
4400 | 1966 | + * nothing to do */ | ||
4401 | 1967 | + break; | ||
4402 | 1968 | + } | ||
4403 | 1969 | + | ||
4404 | 1970 | + _gsp_app_manager_handle_delete (manager, old_app, | ||
4405 | 1971 | + basename, index); | ||
4406 | 1972 | + break; | ||
4407 | 1973 | + default: | ||
4408 | 1974 | + break; | ||
4409 | 1975 | + } | ||
4410 | 1976 | + | ||
4411 | 1977 | + g_free (path); | ||
4412 | 1978 | + g_free (dir); | ||
4413 | 1979 | + g_free (basename); | ||
4414 | 1980 | + | ||
4415 | 1981 | + return TRUE; | ||
4416 | 1982 | +} | ||
4417 | 1983 | + | ||
4418 | 1984 | +/* | ||
4419 | 1985 | + * Initialization | ||
4420 | 1986 | + */ | ||
4421 | 1987 | + | ||
4422 | 1988 | +static void | ||
4423 | 1989 | +_gsp_app_manager_fill_from_dir (GspAppManager *manager, | ||
4424 | 1990 | + GspXdgDir *xdgdir) | ||
4425 | 1991 | +{ | ||
4426 | 1992 | + GFile *file; | ||
4427 | 1993 | + GDir *dir; | ||
4428 | 1994 | + const char *name; | ||
4429 | 1995 | + | ||
4430 | 1996 | + file = g_file_new_for_path (xdgdir->dir); | ||
4431 | 1997 | + xdgdir->monitor = g_file_monitor_directory (file, G_FILE_MONITOR_NONE, | ||
4432 | 1998 | + NULL, NULL); | ||
4433 | 1999 | + g_object_unref (file); | ||
4434 | 2000 | + | ||
4435 | 2001 | + if (xdgdir->monitor) { | ||
4436 | 2002 | + g_signal_connect (xdgdir->monitor, "changed", | ||
4437 | 2003 | + G_CALLBACK (gsp_app_manager_xdg_dir_monitor), | ||
4438 | 2004 | + manager); | ||
4439 | 2005 | + } | ||
4440 | 2006 | + | ||
4441 | 2007 | + dir = g_dir_open (xdgdir->dir, 0, NULL); | ||
4442 | 2008 | + if (!dir) { | ||
4443 | 2009 | + return; | ||
4444 | 2010 | + } | ||
4445 | 2011 | + | ||
4446 | 2012 | + while ((name = g_dir_read_name (dir))) { | ||
4447 | 2013 | + GspApp *app; | ||
4448 | 2014 | + char *desktop_file_path; | ||
4449 | 2015 | + | ||
4450 | 2016 | + if (!g_str_has_suffix (name, ".desktop")) { | ||
4451 | 2017 | + continue; | ||
4452 | 2018 | + } | ||
4453 | 2019 | + | ||
4454 | 2020 | + desktop_file_path = g_build_filename (xdgdir->dir, name, NULL); | ||
4455 | 2021 | + app = gsp_app_new (desktop_file_path, xdgdir->index); | ||
4456 | 2022 | + | ||
4457 | 2023 | + if (app != NULL) { | ||
4458 | 2024 | + gsp_app_manager_add (manager, app); | ||
4459 | 2025 | + g_object_unref (app); | ||
4460 | 2026 | + } | ||
4461 | 2027 | + | ||
4462 | 2028 | + g_free (desktop_file_path); | ||
4463 | 2029 | + } | ||
4464 | 2030 | + | ||
4465 | 2031 | + g_dir_close (dir); | ||
4466 | 2032 | +} | ||
4467 | 2033 | + | ||
4468 | 2034 | +void | ||
4469 | 2035 | +gsp_app_manager_fill (GspAppManager *manager) | ||
4470 | 2036 | +{ | ||
4471 | 2037 | + char **autostart_dirs; | ||
4472 | 2038 | + int i; | ||
4473 | 2039 | + | ||
4474 | 2040 | + if (manager->priv->apps != NULL) | ||
4475 | 2041 | + return; | ||
4476 | 2042 | + | ||
4477 | 2043 | + autostart_dirs = gsm_util_get_autostart_dirs (); | ||
4478 | 2044 | + /* we always assume that the first directory is the user one */ | ||
4479 | 2045 | + g_assert (g_str_has_prefix (autostart_dirs[0], | ||
4480 | 2046 | + g_get_user_config_dir ())); | ||
4481 | 2047 | + | ||
4482 | 2048 | + for (i = 0; autostart_dirs[i] != NULL; i++) { | ||
4483 | 2049 | + GspXdgDir *xdgdir; | ||
4484 | 2050 | + | ||
4485 | 2051 | + if (gsp_app_manager_get_dir_index (manager, | ||
4486 | 2052 | + autostart_dirs[i]) >= 0) { | ||
4487 | 2053 | + continue; | ||
4488 | 2054 | + } | ||
4489 | 2055 | + | ||
4490 | 2056 | + xdgdir = _gsp_xdg_dir_new (autostart_dirs[i], i); | ||
4491 | 2057 | + manager->priv->dirs = g_slist_prepend (manager->priv->dirs, | ||
4492 | 2058 | + xdgdir); | ||
4493 | 2059 | + | ||
4494 | 2060 | + _gsp_app_manager_fill_from_dir (manager, xdgdir); | ||
4495 | 2061 | + } | ||
4496 | 2062 | + | ||
4497 | 2063 | + g_strfreev (autostart_dirs); | ||
4498 | 2064 | +} | ||
4499 | 2065 | + | ||
4500 | 2066 | +/* | ||
4501 | 2067 | + * App handling | ||
4502 | 2068 | + */ | ||
4503 | 2069 | + | ||
4504 | 2070 | +static void | ||
4505 | 2071 | +_gsp_app_manager_app_unref (GspApp *app, | ||
4506 | 2072 | + GspAppManager *manager) | ||
4507 | 2073 | +{ | ||
4508 | 2074 | + g_signal_handlers_disconnect_by_func (app, | ||
4509 | 2075 | + _gsp_app_manager_app_removed, | ||
4510 | 2076 | + manager); | ||
4511 | 2077 | + g_object_unref (app); | ||
4512 | 2078 | +} | ||
4513 | 2079 | + | ||
4514 | 2080 | +static void | ||
4515 | 2081 | +_gsp_app_manager_app_removed (GspAppManager *manager, | ||
4516 | 2082 | + GspApp *app) | ||
4517 | 2083 | +{ | ||
4518 | 2084 | + _gsp_app_manager_emit_removed (manager, app); | ||
4519 | 2085 | + manager->priv->apps = g_slist_remove (manager->priv->apps, app); | ||
4520 | 2086 | + _gsp_app_manager_app_unref (app, manager); | ||
4521 | 2087 | +} | ||
4522 | 2088 | + | ||
4523 | 2089 | +void | ||
4524 | 2090 | +gsp_app_manager_add (GspAppManager *manager, | ||
4525 | 2091 | + GspApp *app) | ||
4526 | 2092 | +{ | ||
4527 | 2093 | + g_return_if_fail (GSP_IS_APP_MANAGER (manager)); | ||
4528 | 2094 | + g_return_if_fail (GSP_IS_APP (app)); | ||
4529 | 2095 | + | ||
4530 | 2096 | + manager->priv->apps = g_slist_prepend (manager->priv->apps, | ||
4531 | 2097 | + g_object_ref (app)); | ||
4532 | 2098 | + g_signal_connect_swapped (app, "removed", | ||
4533 | 2099 | + G_CALLBACK (_gsp_app_manager_app_removed), | ||
4534 | 2100 | + manager); | ||
4535 | 2101 | + _gsp_app_manager_emit_added (manager, app); | ||
4536 | 2102 | +} | ||
4537 | 2103 | + | ||
4538 | 2104 | +GspApp * | ||
4539 | 2105 | +gsp_app_manager_find_app_with_basename (GspAppManager *manager, | ||
4540 | 2106 | + const char *basename) | ||
4541 | 2107 | +{ | ||
4542 | 2108 | + GSList *l; | ||
4543 | 2109 | + GspApp *app; | ||
4544 | 2110 | + | ||
4545 | 2111 | + g_return_val_if_fail (GSP_IS_APP_MANAGER (manager), NULL); | ||
4546 | 2112 | + g_return_val_if_fail (basename != NULL, NULL); | ||
4547 | 2113 | + | ||
4548 | 2114 | + for (l = manager->priv->apps; l != NULL; l = l->next) { | ||
4549 | 2115 | + app = GSP_APP (l->data); | ||
4550 | 2116 | + if (strcmp (basename, gsp_app_get_basename (app)) == 0) | ||
4551 | 2117 | + return app; | ||
4552 | 2118 | + } | ||
4553 | 2119 | + | ||
4554 | 2120 | + return NULL; | ||
4555 | 2121 | +} | ||
4556 | 2122 | + | ||
4557 | 2123 | +/* | ||
4558 | 2124 | + * Singleton | ||
4559 | 2125 | + */ | ||
4560 | 2126 | + | ||
4561 | 2127 | +GspAppManager * | ||
4562 | 2128 | +gsp_app_manager_get (void) | ||
4563 | 2129 | +{ | ||
4564 | 2130 | + if (manager == NULL) { | ||
4565 | 2131 | + manager = g_object_new (GSP_TYPE_APP_MANAGER, NULL); | ||
4566 | 2132 | + return manager; | ||
4567 | 2133 | + } else { | ||
4568 | 2134 | + return g_object_ref (manager); | ||
4569 | 2135 | + } | ||
4570 | 2136 | +} | ||
4571 | 2137 | + | ||
4572 | 2138 | +GSList * | ||
4573 | 2139 | +gsp_app_manager_get_apps (GspAppManager *manager) | ||
4574 | 2140 | +{ | ||
4575 | 2141 | + g_return_val_if_fail (GSP_IS_APP_MANAGER (manager), NULL); | ||
4576 | 2142 | + | ||
4577 | 2143 | + return g_slist_copy (manager->priv->apps); | ||
4578 | 2144 | +} | ||
4579 | 2145 | Index: gnome-session/capplet/gsp-app-manager.h | ||
4580 | 2146 | =================================================================== | ||
4581 | 2147 | --- /dev/null | ||
4582 | 2148 | +++ gnome-session/capplet/gsp-app-manager.h | ||
4583 | 2149 | @@ -0,0 +1,81 @@ | ||
4584 | 2150 | +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- | ||
4585 | 2151 | + * | ||
4586 | 2152 | + * Copyright (C) 1999 Free Software Foundation, Inc. | ||
4587 | 2153 | + * Copyright (C) 2007, 2009 Vincent Untz. | ||
4588 | 2154 | + * Copyright (C) 2008 Lucas Rocha. | ||
4589 | 2155 | + * Copyright (C) 2008 William Jon McCann <jmccann@redhat.com> | ||
4590 | 2156 | + * | ||
4591 | 2157 | + * This program is free software; you can redistribute it and/or modify | ||
4592 | 2158 | + * it under the terms of the GNU General Public License as published by | ||
4593 | 2159 | + * the Free Software Foundation; either version 2 of the License, or | ||
4594 | 2160 | + * (at your option) any later version. | ||
4595 | 2161 | + * | ||
4596 | 2162 | + * This program is distributed in the hope that it will be useful, | ||
4597 | 2163 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
4598 | 2164 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
4599 | 2165 | + * GNU General Public License for more details. | ||
4600 | 2166 | + * | ||
4601 | 2167 | + * You should have received a copy of the GNU General Public License | ||
4602 | 2168 | + * along with this program; if not, write to the Free Software | ||
4603 | 2169 | + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
4604 | 2170 | + * | ||
4605 | 2171 | + */ | ||
4606 | 2172 | + | ||
4607 | 2173 | +#ifndef __GSP_APP_MANAGER_H | ||
4608 | 2174 | +#define __GSP_APP_MANAGER_H | ||
4609 | 2175 | + | ||
4610 | 2176 | +#include <glib-object.h> | ||
4611 | 2177 | + | ||
4612 | 2178 | +#include <gsp-app.h> | ||
4613 | 2179 | + | ||
4614 | 2180 | +G_BEGIN_DECLS | ||
4615 | 2181 | + | ||
4616 | 2182 | +#define GSP_TYPE_APP_MANAGER (gsp_app_manager_get_type ()) | ||
4617 | 2183 | +#define GSP_APP_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GSP_TYPE_APP_MANAGER, GspAppManager)) | ||
4618 | 2184 | +#define GSP_APP_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GSP_TYPE_APP_MANAGER, GspAppManagerClass)) | ||
4619 | 2185 | +#define GSP_IS_APP_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GSP_TYPE_APP_MANAGER)) | ||
4620 | 2186 | +#define GSP_IS_APP_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GSP_TYPE_APP_MANAGER)) | ||
4621 | 2187 | +#define GSP_APP_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GSP_TYPE_APP_MANAGER, GspAppManagerClass)) | ||
4622 | 2188 | + | ||
4623 | 2189 | +typedef struct _GspAppManager GspAppManager; | ||
4624 | 2190 | +typedef struct _GspAppManagerClass GspAppManagerClass; | ||
4625 | 2191 | + | ||
4626 | 2192 | +typedef struct _GspAppManagerPrivate GspAppManagerPrivate; | ||
4627 | 2193 | + | ||
4628 | 2194 | +struct _GspAppManagerClass | ||
4629 | 2195 | +{ | ||
4630 | 2196 | + GObjectClass parent_class; | ||
4631 | 2197 | + | ||
4632 | 2198 | + void (* added) (GspAppManager *manager, | ||
4633 | 2199 | + GspApp *app); | ||
4634 | 2200 | + void (* removed) (GspAppManager *manager, | ||
4635 | 2201 | + GspApp *app); | ||
4636 | 2202 | +}; | ||
4637 | 2203 | + | ||
4638 | 2204 | +struct _GspAppManager | ||
4639 | 2205 | +{ | ||
4640 | 2206 | + GObject parent_instance; | ||
4641 | 2207 | + | ||
4642 | 2208 | + GspAppManagerPrivate *priv; | ||
4643 | 2209 | +}; | ||
4644 | 2210 | + | ||
4645 | 2211 | +GType gsp_app_manager_get_type (void); | ||
4646 | 2212 | + | ||
4647 | 2213 | +GspAppManager *gsp_app_manager_get (void); | ||
4648 | 2214 | + | ||
4649 | 2215 | +void gsp_app_manager_fill (GspAppManager *manager); | ||
4650 | 2216 | + | ||
4651 | 2217 | +GSList *gsp_app_manager_get_apps (GspAppManager *manager); | ||
4652 | 2218 | + | ||
4653 | 2219 | +GspApp *gsp_app_manager_find_app_with_basename (GspAppManager *manager, | ||
4654 | 2220 | + const char *basename); | ||
4655 | 2221 | + | ||
4656 | 2222 | +const char *gsp_app_manager_get_dir (GspAppManager *manager, | ||
4657 | 2223 | + unsigned int index); | ||
4658 | 2224 | + | ||
4659 | 2225 | +void gsp_app_manager_add (GspAppManager *manager, | ||
4660 | 2226 | + GspApp *app); | ||
4661 | 2227 | + | ||
4662 | 2228 | +G_END_DECLS | ||
4663 | 2229 | + | ||
4664 | 2230 | +#endif /* __GSP_APP_MANAGER_H */ | ||
4665 | 2231 | Index: gnome-session/capplet/gsp-app.c | ||
4666 | 2232 | =================================================================== | ||
4667 | 2233 | --- /dev/null | ||
4668 | 2234 | +++ gnome-session/capplet/gsp-app.c | ||
4669 | 2235 | @@ -0,0 +1,1129 @@ | ||
4670 | 2236 | +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- | ||
4671 | 2237 | + * | ||
4672 | 2238 | + * Copyright (C) 1999 Free Software Foundation, Inc. | ||
4673 | 2239 | + * Copyright (C) 2007, 2009 Vincent Untz. | ||
4674 | 2240 | + * Copyright (C) 2008 Lucas Rocha. | ||
4675 | 2241 | + * Copyright (C) 2008 William Jon McCann <jmccann@redhat.com> | ||
4676 | 2242 | + * | ||
4677 | 2243 | + * This program is free software; you can redistribute it and/or modify | ||
4678 | 2244 | + * it under the terms of the GNU General Public License as published by | ||
4679 | 2245 | + * the Free Software Foundation; either version 2 of the License, or | ||
4680 | 2246 | + * (at your option) any later version. | ||
4681 | 2247 | + * | ||
4682 | 2248 | + * This program is distributed in the hope that it will be useful, | ||
4683 | 2249 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
4684 | 2250 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
4685 | 2251 | + * GNU General Public License for more details. | ||
4686 | 2252 | + * | ||
4687 | 2253 | + * You should have received a copy of the GNU General Public License | ||
4688 | 2254 | + * along with this program; if not, write to the Free Software | ||
4689 | 2255 | + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
4690 | 2256 | + * | ||
4691 | 2257 | + */ | ||
4692 | 2258 | + | ||
4693 | 2259 | +#ifdef HAVE_CONFIG_H | ||
4694 | 2260 | +#include <config.h> | ||
4695 | 2261 | +#endif | ||
4696 | 2262 | + | ||
4697 | 2263 | +#include <string.h> | ||
4698 | 2264 | +#include <sys/stat.h> | ||
4699 | 2265 | + | ||
4700 | 2266 | +#include <glib/gi18n.h> | ||
4701 | 2267 | +#include <glib/gstdio.h> | ||
4702 | 2268 | + | ||
4703 | 2269 | +#include "gsm-app-dialog.h" | ||
4704 | 2270 | +#include "gsm-properties-dialog.h" | ||
4705 | 2271 | +#include "gsm-util.h" | ||
4706 | 2272 | +#include "gsp-app-manager.h" | ||
4707 | 2273 | +#include "gsp-keyfile.h" | ||
4708 | 2274 | + | ||
4709 | 2275 | +#include "gsp-app.h" | ||
4710 | 2276 | + | ||
4711 | 2277 | +#define GSP_APP_SAVE_DELAY 2 | ||
4712 | 2278 | + | ||
4713 | 2279 | +#define GSP_ASP_SAVE_MASK_HIDDEN 0x0001 | ||
4714 | 2280 | +#define GSP_ASP_SAVE_MASK_ENABLED 0x0002 | ||
4715 | 2281 | +#define GSP_ASP_SAVE_MASK_NAME 0x0004 | ||
4716 | 2282 | +#define GSP_ASP_SAVE_MASK_EXEC 0x0008 | ||
4717 | 2283 | +#define GSP_ASP_SAVE_MASK_COMMENT 0x0010 | ||
4718 | 2284 | +#define GSP_ASP_SAVE_MASK_NO_DISPLAY 0x0020 | ||
4719 | 2285 | +#define GSP_ASP_SAVE_MASK_ALL 0xffff | ||
4720 | 2286 | + | ||
4721 | 2287 | +struct _GspAppPrivate { | ||
4722 | 2288 | + char *basename; | ||
4723 | 2289 | + char *path; | ||
4724 | 2290 | + | ||
4725 | 2291 | + gboolean hidden; | ||
4726 | 2292 | + gboolean no_display; | ||
4727 | 2293 | + gboolean enabled; | ||
4728 | 2294 | + gboolean shown; | ||
4729 | 2295 | + | ||
4730 | 2296 | + char *name; | ||
4731 | 2297 | + char *exec; | ||
4732 | 2298 | + char *comment; | ||
4733 | 2299 | + char *icon; | ||
4734 | 2300 | + | ||
4735 | 2301 | + GIcon *gicon; | ||
4736 | 2302 | + char *description; | ||
4737 | 2303 | + | ||
4738 | 2304 | + /* position of the directory in the XDG environment variable */ | ||
4739 | 2305 | + unsigned int xdg_position; | ||
4740 | 2306 | + /* position of the first system directory in the XDG env var containing | ||
4741 | 2307 | + * this autostart app too (G_MAXUINT means none) */ | ||
4742 | 2308 | + unsigned int xdg_system_position; | ||
4743 | 2309 | + | ||
4744 | 2310 | + unsigned int save_timeout; | ||
4745 | 2311 | + /* mask of what has changed */ | ||
4746 | 2312 | + unsigned int save_mask; | ||
4747 | 2313 | + /* path that contains the original file that needs to be saved */ | ||
4748 | 2314 | + char *old_system_path; | ||
4749 | 2315 | + /* after writing to file, we skip the next file monitor event of type | ||
4750 | 2316 | + * CHANGED */ | ||
4751 | 2317 | + gboolean skip_next_monitor_event; | ||
4752 | 2318 | +}; | ||
4753 | 2319 | + | ||
4754 | 2320 | +#define GSP_APP_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSP_TYPE_APP, GspAppPrivate)) | ||
4755 | 2321 | + | ||
4756 | 2322 | + | ||
4757 | 2323 | +enum { | ||
4758 | 2324 | + CHANGED, | ||
4759 | 2325 | + REMOVED, | ||
4760 | 2326 | + LAST_SIGNAL | ||
4761 | 2327 | +}; | ||
4762 | 2328 | + | ||
4763 | 2329 | +static guint gsp_app_signals[LAST_SIGNAL] = { 0 }; | ||
4764 | 2330 | + | ||
4765 | 2331 | + | ||
4766 | 2332 | +G_DEFINE_TYPE (GspApp, gsp_app, G_TYPE_OBJECT) | ||
4767 | 2333 | + | ||
4768 | 2334 | +static void gsp_app_dispose (GObject *object); | ||
4769 | 2335 | +static void gsp_app_finalize (GObject *object); | ||
4770 | 2336 | +static gboolean _gsp_app_save (gpointer data); | ||
4771 | 2337 | + | ||
4772 | 2338 | + | ||
4773 | 2339 | +static gboolean | ||
4774 | 2340 | +_gsp_str_equal (const char *a, | ||
4775 | 2341 | + const char *b) | ||
4776 | 2342 | +{ | ||
4777 | 2343 | + if (g_strcmp0 (a, b) == 0) { | ||
4778 | 2344 | + return TRUE; | ||
4779 | 2345 | + } | ||
4780 | 2346 | + | ||
4781 | 2347 | + if (a && !b && a[0] == '\0') { | ||
4782 | 2348 | + return TRUE; | ||
4783 | 2349 | + } | ||
4784 | 2350 | + | ||
4785 | 2351 | + if (b && !a && b[0] == '\0') { | ||
4786 | 2352 | + return TRUE; | ||
4787 | 2353 | + } | ||
4788 | 2354 | + | ||
4789 | 2355 | + return FALSE; | ||
4790 | 2356 | +} | ||
4791 | 2357 | + | ||
4792 | 2358 | + | ||
4793 | 2359 | +static void | ||
4794 | 2360 | +gsp_app_class_init (GspAppClass *class) | ||
4795 | 2361 | +{ | ||
4796 | 2362 | + GObjectClass *gobject_class = G_OBJECT_CLASS (class); | ||
4797 | 2363 | + | ||
4798 | 2364 | + gobject_class->dispose = gsp_app_dispose; | ||
4799 | 2365 | + gobject_class->finalize = gsp_app_finalize; | ||
4800 | 2366 | + | ||
4801 | 2367 | + gsp_app_signals[CHANGED] = | ||
4802 | 2368 | + g_signal_new ("changed", | ||
4803 | 2369 | + G_TYPE_FROM_CLASS (gobject_class), | ||
4804 | 2370 | + G_SIGNAL_RUN_LAST, | ||
4805 | 2371 | + G_STRUCT_OFFSET (GspAppClass, | ||
4806 | 2372 | + changed), | ||
4807 | 2373 | + NULL, | ||
4808 | 2374 | + NULL, | ||
4809 | 2375 | + g_cclosure_marshal_VOID__VOID, | ||
4810 | 2376 | + G_TYPE_NONE, 0); | ||
4811 | 2377 | + | ||
4812 | 2378 | + gsp_app_signals[REMOVED] = | ||
4813 | 2379 | + g_signal_new ("removed", | ||
4814 | 2380 | + G_TYPE_FROM_CLASS (gobject_class), | ||
4815 | 2381 | + G_SIGNAL_RUN_LAST, | ||
4816 | 2382 | + G_STRUCT_OFFSET (GspAppClass, | ||
4817 | 2383 | + removed), | ||
4818 | 2384 | + NULL, | ||
4819 | 2385 | + NULL, | ||
4820 | 2386 | + g_cclosure_marshal_VOID__VOID, | ||
4821 | 2387 | + G_TYPE_NONE, 0); | ||
4822 | 2388 | + | ||
4823 | 2389 | + g_type_class_add_private (class, sizeof (GspAppPrivate)); | ||
4824 | 2390 | +} | ||
4825 | 2391 | + | ||
4826 | 2392 | +static void | ||
4827 | 2393 | +gsp_app_init (GspApp *app) | ||
4828 | 2394 | +{ | ||
4829 | 2395 | + app->priv = GSP_APP_GET_PRIVATE (app); | ||
4830 | 2396 | + | ||
4831 | 2397 | + memset (app->priv, 0, sizeof (GspAppPrivate)); | ||
4832 | 2398 | + app->priv->xdg_position = G_MAXUINT; | ||
4833 | 2399 | + app->priv->xdg_system_position = G_MAXUINT; | ||
4834 | 2400 | +} | ||
4835 | 2401 | + | ||
4836 | 2402 | +static void | ||
4837 | 2403 | +_gsp_app_free_reusable_data (GspApp *app) | ||
4838 | 2404 | +{ | ||
4839 | 2405 | + if (app->priv->path) { | ||
4840 | 2406 | + g_free (app->priv->path); | ||
4841 | 2407 | + app->priv->path = NULL; | ||
4842 | 2408 | + } | ||
4843 | 2409 | + | ||
4844 | 2410 | + if (app->priv->name) { | ||
4845 | 2411 | + g_free (app->priv->name); | ||
4846 | 2412 | + app->priv->name = NULL; | ||
4847 | 2413 | + } | ||
4848 | 2414 | + | ||
4849 | 2415 | + if (app->priv->exec) { | ||
4850 | 2416 | + g_free (app->priv->exec); | ||
4851 | 2417 | + app->priv->exec = NULL; | ||
4852 | 2418 | + } | ||
4853 | 2419 | + | ||
4854 | 2420 | + if (app->priv->comment) { | ||
4855 | 2421 | + g_free (app->priv->comment); | ||
4856 | 2422 | + app->priv->comment = NULL; | ||
4857 | 2423 | + } | ||
4858 | 2424 | + | ||
4859 | 2425 | + if (app->priv->icon) { | ||
4860 | 2426 | + g_free (app->priv->icon); | ||
4861 | 2427 | + app->priv->icon = NULL; | ||
4862 | 2428 | + } | ||
4863 | 2429 | + | ||
4864 | 2430 | + if (app->priv->gicon) { | ||
4865 | 2431 | + g_object_unref (app->priv->gicon); | ||
4866 | 2432 | + app->priv->gicon = NULL; | ||
4867 | 2433 | + } | ||
4868 | 2434 | + | ||
4869 | 2435 | + if (app->priv->description) { | ||
4870 | 2436 | + g_free (app->priv->description); | ||
4871 | 2437 | + app->priv->description = NULL; | ||
4872 | 2438 | + } | ||
4873 | 2439 | + | ||
4874 | 2440 | + if (app->priv->old_system_path) { | ||
4875 | 2441 | + g_free (app->priv->old_system_path); | ||
4876 | 2442 | + app->priv->old_system_path = NULL; | ||
4877 | 2443 | + } | ||
4878 | 2444 | +} | ||
4879 | 2445 | + | ||
4880 | 2446 | +static void | ||
4881 | 2447 | +gsp_app_dispose (GObject *object) | ||
4882 | 2448 | +{ | ||
4883 | 2449 | + GspApp *app; | ||
4884 | 2450 | + | ||
4885 | 2451 | + g_return_if_fail (object != NULL); | ||
4886 | 2452 | + g_return_if_fail (GSP_IS_APP (object)); | ||
4887 | 2453 | + | ||
4888 | 2454 | + app = GSP_APP (object); | ||
4889 | 2455 | + | ||
4890 | 2456 | + /* we save in dispose since we might need to reference GspAppManager */ | ||
4891 | 2457 | + if (app->priv->save_timeout) { | ||
4892 | 2458 | + g_source_remove (app->priv->save_timeout); | ||
4893 | 2459 | + app->priv->save_timeout = 0; | ||
4894 | 2460 | + | ||
4895 | 2461 | + /* save now */ | ||
4896 | 2462 | + _gsp_app_save (app); | ||
4897 | 2463 | + } | ||
4898 | 2464 | + | ||
4899 | 2465 | + G_OBJECT_CLASS (gsp_app_parent_class)->dispose (object); | ||
4900 | 2466 | +} | ||
4901 | 2467 | + | ||
4902 | 2468 | +static void | ||
4903 | 2469 | +gsp_app_finalize (GObject *object) | ||
4904 | 2470 | +{ | ||
4905 | 2471 | + GspApp *app; | ||
4906 | 2472 | + | ||
4907 | 2473 | + g_return_if_fail (object != NULL); | ||
4908 | 2474 | + g_return_if_fail (GSP_IS_APP (object)); | ||
4909 | 2475 | + | ||
4910 | 2476 | + app = GSP_APP (object); | ||
4911 | 2477 | + | ||
4912 | 2478 | + if (app->priv->basename) { | ||
4913 | 2479 | + g_free (app->priv->basename); | ||
4914 | 2480 | + app->priv->basename = NULL; | ||
4915 | 2481 | + } | ||
4916 | 2482 | + | ||
4917 | 2483 | + _gsp_app_free_reusable_data (app); | ||
4918 | 2484 | + | ||
4919 | 2485 | + G_OBJECT_CLASS (gsp_app_parent_class)->finalize (object); | ||
4920 | 2486 | +} | ||
4921 | 2487 | + | ||
4922 | 2488 | +static void | ||
4923 | 2489 | +_gsp_app_emit_changed (GspApp *app) | ||
4924 | 2490 | +{ | ||
4925 | 2491 | + g_signal_emit (G_OBJECT (app), gsp_app_signals[CHANGED], 0); | ||
4926 | 2492 | +} | ||
4927 | 2493 | + | ||
4928 | 2494 | +static void | ||
4929 | 2495 | +_gsp_app_emit_removed (GspApp *app) | ||
4930 | 2496 | +{ | ||
4931 | 2497 | + g_signal_emit (G_OBJECT (app), gsp_app_signals[REMOVED], 0); | ||
4932 | 2498 | +} | ||
4933 | 2499 | + | ||
4934 | 2500 | +static void | ||
4935 | 2501 | +_gsp_app_update_description (GspApp *app) | ||
4936 | 2502 | +{ | ||
4937 | 2503 | + const char *primary; | ||
4938 | 2504 | + const char *secondary; | ||
4939 | 2505 | + | ||
4940 | 2506 | + if (!gsm_util_text_is_blank (app->priv->name)) { | ||
4941 | 2507 | + primary = app->priv->name; | ||
4942 | 2508 | + } else if (!gsm_util_text_is_blank (app->priv->exec)) { | ||
4943 | 2509 | + primary = app->priv->exec; | ||
4944 | 2510 | + } else { | ||
4945 | 2511 | + primary = _("No name"); | ||
4946 | 2512 | + } | ||
4947 | 2513 | + | ||
4948 | 2514 | + if (!gsm_util_text_is_blank (app->priv->comment)) { | ||
4949 | 2515 | + secondary = app->priv->comment; | ||
4950 | 2516 | + } else { | ||
4951 | 2517 | + secondary = _("No description"); | ||
4952 | 2518 | + } | ||
4953 | 2519 | + | ||
4954 | 2520 | + g_free (app->priv->description); | ||
4955 | 2521 | + app->priv->description = g_markup_printf_escaped ("<b>%s</b>\n%s", | ||
4956 | 2522 | + primary, | ||
4957 | 2523 | + secondary); | ||
4958 | 2524 | +} | ||
4959 | 2525 | + | ||
4960 | 2526 | +/* | ||
4961 | 2527 | + * Saving | ||
4962 | 2528 | + */ | ||
4963 | 2529 | + | ||
4964 | 2530 | +static void | ||
4965 | 2531 | +_gsp_ensure_user_autostart_dir (void) | ||
4966 | 2532 | +{ | ||
4967 | 2533 | + char *dir; | ||
4968 | 2534 | + | ||
4969 | 2535 | + dir = g_build_filename (g_get_user_config_dir (), "autostart", NULL); | ||
4970 | 2536 | + g_mkdir_with_parents (dir, S_IRWXU); | ||
4971 | 2537 | + | ||
4972 | 2538 | + g_free (dir); | ||
4973 | 2539 | +} | ||
4974 | 2540 | + | ||
4975 | 2541 | +static char * | ||
4976 | 2542 | +_gsp_get_current_desktop () | ||
4977 | 2543 | +{ | ||
4978 | 2544 | + static char *current_desktop = NULL; | ||
4979 | 2545 | + | ||
4980 | 2546 | + /* Support XDG_CURRENT_DESKTOP environment variable; this can be used | ||
4981 | 2547 | + * to abuse gnome-session in non-GNOME desktops. */ | ||
4982 | 2548 | + if (!current_desktop) { | ||
4983 | 2549 | + const char *desktop; | ||
4984 | 2550 | + | ||
4985 | 2551 | + desktop = g_getenv ("XDG_CURRENT_DESKTOP"); | ||
4986 | 2552 | + | ||
4987 | 2553 | + /* Note: if XDG_CURRENT_DESKTOP is set but empty, do as if it | ||
4988 | 2554 | + * was not set */ | ||
4989 | 2555 | + if (!desktop || desktop[0] == '\0') | ||
4990 | 2556 | + current_desktop = g_strdup ("GNOME"); | ||
4991 | 2557 | + else | ||
4992 | 2558 | + current_desktop = g_strdup (desktop); | ||
4993 | 2559 | + } | ||
4994 | 2560 | + | ||
4995 | 2561 | + /* Using "*" means skipping desktop-related checks */ | ||
4996 | 2562 | + if (g_strcmp0 (current_desktop, "*") == 0) | ||
4997 | 2563 | + return NULL; | ||
4998 | 2564 | + | ||
4999 | 2565 | + return current_desktop; | ||
5000 | 2566 | +} |
The diff has been truncated for viewing.
Thanks for the merge! debian/control needed an update for commenting out xwayland and @GNOME_TEAM@, I did that. Otherwise looks good, merged/uploaded.