Merge lp:~darkxst/ubuntu/utopic/gnome-settings-daemon/lp1372346 into lp:~ubuntu-desktop/gnome-settings-daemon/ubuntu

Proposed by Tim Lunn on 2014-09-29
Status: Merged
Approved by: Martin Pitt on 2014-09-30
Approved revision: 476
Merged at revision: 475
Proposed branch: lp:~darkxst/ubuntu/utopic/gnome-settings-daemon/lp1372346
Merge into: lp:~ubuntu-desktop/gnome-settings-daemon/ubuntu
Diff against target: 5622 lines (+4035/-1091)
28 files modified
debian/changelog (+510/-32)
debian/control (+27/-30)
debian/control.in (+26/-29)
debian/gnome-settings-daemon.examples (+1/-0)
debian/gnome-settings-daemon.install (+3/-3)
debian/gnome-settings-daemon.maintscript (+11/-8)
debian/gnome-update-wallpaper-cache.c (+0/-70)
debian/patches/43_disable_locale_settings.patch (+5/-5)
debian/patches/48_register_client_before_idle_callbacks.patch (+0/-116)
debian/patches/53_sync_input_sources_to_accountsservice.patch (+9/-9)
debian/patches/64_restore_terminal_keyboard_shortcut_schema.patch (+17/-23)
debian/patches/git_enable_auto_hidpi.patch (+0/-26)
debian/patches/git_hidpi_scalling.patch (+0/-169)
debian/patches/git_keybindings_add_screen_reader_toggle.patch (+0/-26)
debian/patches/git_lp1339244.patch (+0/-52)
debian/patches/git_micmute.patch (+0/-20)
debian/patches/git_new_screencast_keybinding.patch (+0/-202)
debian/patches/git_touchpad_scrolling.patch (+0/-56)
debian/patches/git_xsettings_segfaults.patch (+0/-33)
debian/patches/nexus-orientation.patch (+12/-12)
debian/patches/revert-gsettings-removals.patch (+113/-0)
debian/patches/revert_media-keys_fix_battery_key.patch (+112/-0)
debian/patches/revert_power_310.patch (+3143/-0)
debian/patches/series (+3/-9)
debian/patches/touchscreen_rotation.patch (+0/-114)
debian/patches/ubuntu-lid-close-suspend.patch (+25/-32)
debian/rules (+16/-13)
debian/watch (+2/-2)
To merge this branch: bzr merge lp:~darkxst/ubuntu/utopic/gnome-settings-daemon/lp1372346
Reviewer Review Type Date Requested Status
Martin Pitt 2014-09-29 Approve on 2014-09-30
Review via email: mp+236308@code.launchpad.net

Description of the change

Merge g-s-d 3.12 from debian

To post a comment you must log in.
Martin Pitt (pitti) wrote :

This mostly looks good to me. There is one removed key though:

--- /usr/share/glib-2.0/schemas/org.gnome.settings-daemon.peripherals.gschema.xml…………………2014-07-10 11:22:10.000000000 +0200
+++ ./usr/share/glib-2.0/schemas/org.gnome.settings-daemon.peripherals.gschema.xml………………2014-09-30 14:40:06.000000000 +0200
@@ -107,10 +107,6 @@
       <summary>NumLock state</summary>
       <description>The remembered state of the NumLock LED.</description>
     </key>
- <key name="input-sources-switcher" enum="org.gnome.settings-daemon.GsdInputSourcesSwitcher">
- <default>'off'</default>
- <summary>Modifiers-only input sources switcher shortcut</summary>
- </key>

together with the removed GsdInputSourcesSwitcher enum in org.gnome.settings-daemon.enums.xml. Is that a concern for backwards compatibility?

review: Needs Information
Sebastien Bacher (seb128) wrote :

Thanks Martin, cinnamon uses that key but it looks like they have renamed the schemas for their own use. I'm unsure if other code is relying on it but it would be safer to revert the change imho

Martin Pitt (pitti) wrote :

Ack, GsdInputSourcesSwitcher does not exist in unity-settings-daemon.

review: Approve

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-07-14 00:01:03 +0000
3+++ debian/changelog 2014-09-29 12:18:03 +0000
4@@ -1,3 +1,104 @@
5+gnome-settings-daemon (3.12.2-1ubuntu1) utopic; urgency=medium
6+
7+ * New Upstream Release (LP:# 1372346)
8+ * Merge with Debian, remaining changes:
9+ + Split out schemas into gnome-settings-daemon-schemas so
10+ unity-settings-daemon can use them
11+ + debian/patches:
12+ - 05_disable_corner_tapping.patch:
13+ Disable corner tapping when disabling tap to click
14+ - 43_disable_locale_settings.patch:
15+ Don't set locales after sourcing .profile
16+ - 45_suppress-printer-may-not-be-connected-notification.patch
17+ - 53_sync_input_sources_to_accountsservice.patch
18+ - 64_restore_terminal_keyboard_shortcut_schema.patch
19+ - correct_logout_action.patch
20+ display the logout action on ctrl-alt-del (lp: #961501)
21+ - migrate_metacity_keys.patch
22+ Migrate screenshot/terminal keys from metacity gconf as well
23+ (LP: #1058004)
24+ - nexus-orientation.patch
25+ Fix screen rotation on nexus7
26+ - ubuntu-lid-close-suspend.patch
27+ Reimplement support for setting lid close suspend actions
28+ - ubuntu-force-lock-group.patch
29+ Lock the XKB group when ISO_Next_Group is pressed (lp: #1318673)
30+ - revert_background_dropping.patch
31+ Keep gsettings keys background u-s-d needs them
32+ - revert-gsettings-removals.patch
33+ Revert gsettings keys that were dropped since 3.8, for u-s-d
34+ + debian/gnome-settings-daemon.install: Install apport hook
35+ + debian/rules: install upstart scripts
36+ * Revert power plugin to 3.10 until we have new Upower
37+
38+ -- Tim Lunn <tim@feathertop.org> Sat, 13 Sep 2014 11:15:22 +1000
39+
40+gnome-settings-daemon (3.12.2-1) unstable; urgency=medium
41+
42+ [ Laurent Bigonville ]
43+ * debian/rules: Install rfkill udev rules in /lib/udev/rules.d instead of
44+ /usr/lib/udev/rules.d
45+
46+ [ Andreas Henriksson ]
47+ * New upstream release.
48+ * Upload to unstable.
49+
50+ -- Andreas Henriksson <andreas@fatal.se> Tue, 15 Jul 2014 00:02:20 +0200
51+
52+gnome-settings-daemon (3.12.1-3) experimental; urgency=medium
53+
54+ * debian/gnome-settings-daemon.install,
55+ debian/rules:
56+ + Only install rfkill udev rules on linux.
57+
58+ -- Emilio Pozuelo Monfort <pochu@debian.org> Sat, 03 May 2014 11:35:17 +0200
59+
60+gnome-settings-daemon (3.12.1-2) experimental; urgency=medium
61+
62+ * Brown paper bag release.
63+ * debian/rules:
64+ + It's DEB_CONFIGURE_EXTRA_FLAGS, not _EXTRA_ARGS.
65+
66+ -- Emilio Pozuelo Monfort <pochu@debian.org> Fri, 02 May 2014 20:19:30 +0200
67+
68+gnome-settings-daemon (3.12.1-1) experimental; urgency=medium
69+
70+ * New upstream release.
71+ * debian/rules:
72+ + Disable rfkill support on !linux.
73+
74+ -- Emilio Pozuelo Monfort <pochu@debian.org> Fri, 02 May 2014 17:58:13 +0200
75+
76+gnome-settings-daemon (3.12.0-1) experimental; urgency=medium
77+
78+ * New upstream release.
79+
80+ -- Andreas Henriksson <andreas@fatal.se> Mon, 24 Mar 2014 20:12:45 +0100
81+
82+gnome-settings-daemon (3.11.91-1) experimental; urgency=medium
83+
84+ * New upstream release.
85+ * Update build-dependencies according to configure.ac:
86+ - bump upower to 0.99.0, gnome-desktop 3.11.1, geoclue 2.1.2
87+ - add xkb-data (xkeyboard-config)
88+ * Ship uaccess tagging udev rule
89+ * Ship input-devices-example.sh
90+ * Bump Standards-Version to 3.9.5
91+
92+ -- Andreas Henriksson <andreas@fatal.se> Tue, 04 Mar 2014 21:10:41 +0100
93+
94+gnome-settings-daemon (3.10.1-1) experimental; urgency=low
95+
96+ [ Sjoerd Simons ]
97+ * New upstream release
98+ * Sync b-d with Ubuntu's gnome3 teams packaging
99+
100+ [ Emilio Pozuelo Monfort ]
101+ * debian/patches/04_superP.patch:
102+ + Add upstream bug info.
103+
104+ -- Sjoerd Simons <sjoerd@debian.org> Fri, 01 Nov 2013 23:07:44 +0100
105+
106 gnome-settings-daemon (3.8.6.1-0ubuntu15) utopic; urgency=low
107
108 * debian/patches/git_lp1339244.patch:
109@@ -137,6 +238,27 @@
110
111 -- Sebastien Bacher <seb128@ubuntu.com> Wed, 06 Nov 2013 11:23:01 +0100
112
113+gnome-settings-daemon (3.8.5-2) unstable; urgency=low
114+
115+ [ Laurent Bigonville ]
116+ * debian/gnome-settings-daemon.examples: Install input-device-example.sh as
117+ an example (Closes: #709526)
118+
119+ [ Emilio Pozuelo Monfort ]
120+ * Upload to unstable.
121+
122+ -- Emilio Pozuelo Monfort <pochu@debian.org> Sun, 13 Oct 2013 17:37:46 +0200
123+
124+gnome-settings-daemon (3.8.5-1) experimental; urgency=low
125+
126+ * New upstream release.
127+ * debian/rules: Call dh-autoreconf with --as-needed to minimize the runtime
128+ dependencies
129+ * debian/gnome-settings-daemon.install: Install dbus service files, IBus
130+ support is shipping org.freedesktop.IBus.service
131+
132+ -- Laurent Bigonville <bigon@debian.org> Mon, 09 Sep 2013 20:14:29 +0200
133+
134 gnome-settings-daemon (3.8.5-0ubuntu12) trusty; urgency=low
135
136 * debian/patches/fix_media_keys_on_unity.patch: Another reworking. Try to
137@@ -309,6 +431,126 @@
138
139 -- Jeremy Bicha <jbicha@ubuntu.com> Mon, 09 Sep 2013 10:21:09 -0400
140
141+gnome-settings-daemon (3.8.4-2) experimental; urgency=low
142+
143+ * debian/control.in, debian/rules: Re-enable ibus support (Closes: #720489)
144+ * debian/control.in: Bump Standards-Version to 3.9.4 (no further changes)
145+ * debian/rules: Drop removed --enable-pulse configure flag
146+
147+ -- Laurent Bigonville <bigon@debian.org> Sat, 24 Aug 2013 14:25:09 +0200
148+
149+gnome-settings-daemon (3.8.4-1) experimental; urgency=low
150+
151+ [ Thomas Bechtold ]
152+ * New upstream release.
153+ * Bump Standards-Version to 3.9.4.
154+
155+ -- Andreas Henriksson <andreas@fatal.se> Fri, 16 Aug 2013 20:06:53 +0200
156+
157+gnome-settings-daemon (3.8.3-1) experimental; urgency=low
158+
159+ [ Deng Xiyue ]
160+ * Disable "-Wl,-z,defs" on mipsel in order to fix segfault.
161+ (Closes: #629351)
162+
163+ [ Emilio Pozuelo Monfort ]
164+ * New upstream release.
165+
166+ -- Emilio Pozuelo Monfort <pochu@debian.org> Sat, 08 Jun 2013 18:48:22 +0200
167+
168+gnome-settings-daemon (3.8.2-2) experimental; urgency=low
169+
170+ * debian/gnome-settings-daemon.maintscript:
171+ + Properly set the version so that users who upgraded to a package
172+ that had already stopped shipping the conffile also get it removed.
173+ Really closes: #704184.
174+
175+ -- Emilio Pozuelo Monfort <pochu@debian.org> Sun, 26 May 2013 19:49:26 +0200
176+
177+gnome-settings-daemon (3.8.2-1) experimental; urgency=low
178+
179+ [ Emilio Pozuelo Monfort ]
180+ * debian/gnome-settings-daemon.maintscript:
181+ + Remove obsolete conffile. Closes: #704184.
182+
183+ [ Andreas Henriksson ]
184+ * New upstream release.
185+ * Drop patches merged upstream:
186+ - 08-Fix-build-on-non-Linux-platforms.patch
187+ - 12-cursor-set-an-error-if-we-can-t-create-a-monitor.patch
188+ - 13-cursor-set-error-if-we-don-t-have-the-necessary-X-su.patch
189+ * Drop 11-cursor-add-error-quark.patch, not needed.
190+
191+ -- Andreas Henriksson <andreas@fatal.se> Sat, 25 May 2013 17:18:18 +0200
192+
193+gnome-settings-daemon (3.8.0-2) experimental; urgency=low
194+
195+ * debian/control.in:
196+ + Bump libgnome-desktop-3-dev build dependency to get a .symbols
197+ file with Build-Depends-Package, to ensure a proper runtime
198+ dependency.
199+
200+ -- Emilio Pozuelo Monfort <pochu@debian.org> Thu, 28 Mar 2013 12:59:02 +0100
201+
202+gnome-settings-daemon (3.8.0-1) experimental; urgency=low
203+
204+ * debian/patches/08-Fix-build-on-non-Linux-platforms.patch:
205+ + Fix the build on kfreebsd and hurd by including stdlib.h
206+ before using NULL.
207+ * New upstream release.
208+ + debian/control.in:
209+ - Bump libgnome-desktop3-dev requirement for the cursor fix.
210+ + debian/patches/05_disable_cursor_manager.patch:
211+ - Dropped, fixed upstream in a different way.
212+ + d/p/11-cursor-add-error-quark.patch
213+ d/p/12-cursor-set-an-error-if-we-can-t-create-a-monitor.patch
214+ d/p/13-cursor-set-error-if-we-don-t-have-the-necessary-X-su.patch:
215+ - New patches. The upstream fix to disable the cursor with
216+ Xorg < 1.14 was incomplete. With these patches we gracefully
217+ fail with Xorg < 1.14 and the cursor plugin will be enabled with
218+ Xorg >= 1.14.
219+
220+ -- Emilio Pozuelo Monfort <pochu@debian.org> Wed, 27 Mar 2013 16:48:21 +0100
221+
222+gnome-settings-daemon (3.7.92-1) experimental; urgency=low
223+
224+ [ Andreas Henriksson ]
225+ * New upstream release
226+ * Bump the following build-dependencies according to configure.ac
227+ - libglib2.0-dev, libgtk-3-dev, gsettings-desktop-schemas-dev,
228+ libgnome-desktop-3-dev, libpulse-dev, libwacom-dev
229+ * Add build-dependency on librsvg2-dev (>= 2.36.2)
230+ * Add a runtime dependency on systemd (except on hurd and kfreebsd)
231+ as needed by the power plugin.
232+ * Drop debian/patches/power-check-null-devices.patch, fixed upstream.
233+ * Drop debian/patches/power-ignore-bad-dbus-requests.patch, fixed upstream.
234+ * Remaining patches refreshed to apply cleanly.
235+
236+ [ Sjoerd Simons ]
237+ * debian/patches/revert_git_datetime_dropping.patch:
238+ - Dropped. Control center uses datetime directly now
239+ * debian/control.in: Break gnome-control-center (<< 3.7) as the DateTime
240+ mechanism is now dropped.
241+ * debian/control.in: Remove gstreamer build-depends, no longer needed
242+ * New upstream release (3.7.92)
243+ * debian/patches/05_disable_cursor_manager.patch
244+ + Added. Disable the cursor manager, causes crashes with Xorg 1.12. Remove
245+ once Xorg 1.14 is available or when bgo#696118 is fixed upstream
246+
247+ -- Sjoerd Simons <sjoerd@debian.org> Sat, 23 Mar 2013 16:34:51 +0100
248+
249+gnome-settings-daemon (3.6.4-1) experimental; urgency=low
250+
251+ [ Frederic Peters ]
252+ * debian/control.in: bump {build-,}dependency on gsettings-desktop-schemas.
253+
254+ [ Aron Xu ]
255+ * debian/control.in debian/rules: disable ibus integration (Closes: #694301).
256+
257+ [ Sjoerd Simons ]
258+ * New upstream release
259+
260+ -- Sjoerd Simons <sjoerd@debian.org> Fri, 15 Feb 2013 22:12:34 +0100
261 gnome-settings-daemon (3.6.4-0ubuntu19) saucy; urgency=low
262
263 * Install the ibus dbus service (LP: #1194138)
264@@ -572,6 +814,109 @@
265
266 -- Sebastien Bacher <seb128@ubuntu.com> Wed, 21 Nov 2012 17:16:23 +0100
267
268+gnome-settings-daemon (3.6.1-1) experimental; urgency=low
269+
270+ * New upstream release
271+ * debian/patches/10_smaller_syndaemon_timeout.patch:
272+ + Dropped, fixed upstream
273+ * debian/patches/22_backlight_optional.patch:
274+ + Dropped, fixed upstream
275+ * debian/control: Update build-depends
276+ * debian/patches/*: refreshed
277+
278+ -- Sjoerd Simons <sjoerd@debian.org> Sun, 14 Oct 2012 21:16:55 +0200
279+
280+gnome-settings-daemon (3.4.2+git20120925.a4c817-1) unstable; urgency=low
281+
282+ * debian/g-s-d.gsettings-override: disable remember-numlock-state,
283+ because of the infamous https://bugzilla.gnome.org/679151
284+ * New upstream git snapshot from the stable branch (which will not be
285+ released despite the amount of useful bug fixes).
286+ * 10_smaller_syndaemon_timeout.patch: refreshed.
287+ * Drop merged patches: power-update-fallback-status-icon.patch,
288+ 20_disable-wacom-support-on-s390-s390x.patch,
289+ 21_disable-wacom-on-non-Linux-platforms.patch,
290+ 24-common-Try-XI-2.2-if-XI-2.0-fails.patch.
291+ * Bump libwacom dependency.
292+
293+ -- Josselin Mouette <joss@debian.org> Sat, 29 Sep 2012 12:17:15 +0200
294+
295+gnome-settings-daemon (3.4.2-5) unstable; urgency=low
296+
297+ * debian/patches/power-update-fallback-status-icon.patch: Update battery
298+ status icon in fallback mode when switching between battery and AC power.
299+ Patch cherry-picked from upstream Git. (Closes: #678352)
300+
301+ -- Michael Biebl <biebl@debian.org> Thu, 30 Aug 2012 23:36:38 +0200
302+
303+gnome-settings-daemon (3.4.2-4) unstable; urgency=low
304+
305+ * debian/patches/24-common-Try-XI-2.2-if-XI-2.0-fails.patch:
306+ * Added: Fix keybindings for newer libxi2 (Closes: #678250) (From
307+ upstream git)
308+
309+ -- Sjoerd Simons <sjoerd@debian.org> Fri, 27 Jul 2012 16:06:28 +0200
310+
311+gnome-settings-daemon (3.4.2-3) unstable; urgency=low
312+
313+ [ Jeremy Bicha ]
314+ * debian/control.in: Stop depending on libgnome2-common
315+
316+ [ Michael Biebl ]
317+ * Upload to unstable.
318+ * Drop obsolete --enable-gconf-bridge configure switch and Build-Depends on
319+ libgconf2-dev.
320+ * Remove obsolete Breaks.
321+ * Add Breaks against gnome-shell (<< 3.4) for the incompatible changes in
322+ the Power D-Bus API. Closes: #675130
323+
324+ -- Michael Biebl <biebl@debian.org> Wed, 30 May 2012 12:43:11 +0200
325+
326+gnome-settings-daemon (3.4.2-2) experimental; urgency=low
327+
328+ * debian/patches/22_backlight_optional.patch: Don't enable backlight helper
329+ if GUdev is not available.
330+
331+ -- Michael Biebl <biebl@debian.org> Sun, 20 May 2012 06:19:23 +0200
332+
333+gnome-settings-daemon (3.4.2-1) experimental; urgency=low
334+
335+ [ Sjoerd Simons ]
336+ * New upstream release
337+ * debian/patches/01-xrandr-correct-the-type-of-the-rotation-parameter.patch:
338+ + Removed, fixed upstream
339+ * debian/patches/02-lock-screensaver-on-lid-close.patch:
340+ + Removed, fixed upstream
341+ * debian/patches/04_superP.patch: Refreshed
342+ * Sync with Ubuntu:
343+ + Update build-depend versions of various items
344+ + Add build-depend on libnss3-dev for smartcard support
345+ + Add build-depend on libwacom-dev, xserver-xorg-input-wacom and
346+ libxtst-dev for wacom support
347+ + debian/patches/10_smaller_syndaemon_timeout.patch:
348+ - Added: Only disable touchpach clicks, not mouse movements (bgo: #673055)
349+ + debian/patches/power-check-null-devices.patch:
350+ - Added: Fix crash when up_client_get_devices returns NULL (bgo: #674827)
351+ + debian/patches/power-ignore-bad-dbus-requests.patch:
352+ - Added: If we get a DBus request while the manager isn't active, ignore
353+ it (bgo: #674829)
354+ + debian/patches/revert_git_datetime_dropping.patch
355+ - Added: Don't switch to systemd for datetime functionality just yet
356+
357+ [ Michael Biebl ]
358+ * Refresh patches.
359+ * Drop dependency on hwdata. This is no longer necessary and handled via
360+ libgnome-desktop now.
361+ * Cherry-pick two upstream patches which disable wacom support on s390,
362+ s390x and non-Linux plattforms as xserver-xorg-input-wacom is not available
363+ there. Mark the xserver-xorg-input-wacom and libwacom-dev Build-Depends
364+ accordingly.
365+ * Bump Standards-Version to 3.9.3.
366+ * Remove libdbus-glib-1-dev dependency from gnome-settings-daemon-dev, no
367+ longer required.
368+
369+ -- Michael Biebl <biebl@debian.org> Sat, 19 May 2012 23:36:19 +0200
370+
371 gnome-settings-daemon (3.4.2-0ubuntu14) quantal; urgency=low
372
373 * debian/patches/git_power_dbus_path.patch:
374@@ -1014,6 +1359,43 @@
375
376 -- Sebastien Bacher <seb128@ubuntu.com> Wed, 15 Feb 2012 11:41:52 +0100
377
378+gnome-settings-daemon (3.2.2-3) unstable; urgency=low
379+
380+ * Correctly lock the screensaver on lid-close when lid-close action is set
381+ to blank and lock is enabled. Patch cherry-picked from upstream Git.
382+ Closes: #662747
383+
384+ -- Michael Biebl <biebl@debian.org> Fri, 16 Mar 2012 14:46:08 +0100
385+
386+gnome-settings-daemon (3.2.2-2) unstable; urgency=low
387+
388+ [ Sjoerd Simons ]
389+ * debian/patches/01-xrandr-correct-the-type-of-the-rotation-parameter.patch:
390+ + Added, fix handling of XF86RotateWindows (bgo#664363)
391+
392+ [ Michael Biebl ]
393+ * Upload to unstable.
394+
395+ -- Michael Biebl <biebl@debian.org> Sat, 17 Dec 2011 00:12:47 +0100
396+
397+gnome-settings-daemon (3.2.2-1) experimental; urgency=low
398+
399+ [ Sjoerd Simons ]
400+ * New upstream release (3.2.2-1)
401+ * debian/control.in: Add liblcms2-dev to the build-depends for display color
402+ management
403+ * debian/gnome-settings-daemon.install: Also install the helper service files
404+
405+ [ Josselin Mouette ]
406+ * Disable -z defs on ia64. This should really be avoided because it
407+ can cause runtime errors, but since binutils won’t be fixed it
408+ causes runtime errors anyway. Closes: #537572.
409+
410+ [ Sjoerd Simons ]
411+ * Set -z,defs *before* setting --warn-unresolved-symbols in the linker flags
412+ otherwise the build will fail with unresolved symbol *errors*
413+
414+ -- Sjoerd Simons <sjoerd@debian.org> Sun, 13 Nov 2011 16:25:33 +0100
415 gnome-settings-daemon (3.2.2-0ubuntu17) precise; urgency=low
416
417 * debian/patches/disable_three_touch_tap.patch
418@@ -1154,6 +1536,37 @@
419
420 -- Rodrigo Moya <rodrigo.moya@canonical.com> Thu, 10 Nov 2011 12:15:05 +0100
421
422+gnome-settings-daemon (3.2.1-1) experimental; urgency=low
423+
424+ [ Michael Biebl ]
425+ * Use the new maintscript facility in dh_installdeb to remove the obsolete
426+ conffiles:
427+ - Bump Build-Depends on debhelper to (>= 8.1.0~).
428+ - Add Pre-Depends: ${misc:Pre-Depends}.
429+ - Replace preinst/postinst/postrm scripts with a
430+ gnome-settings-daemon.maintscript file.
431+
432+ [ Josselin Mouette ]
433+ * 04_superP.patch: new patch. Allow to reconfigure the Super-P
434+ shortcut which is otherwise hardcoded to VIDEO_OUT.
435+
436+ [ Sjoerd Simons ]
437+ * New upstream release (3.2.1)
438+ * debian/patches/01_medias_keys_dont_go_up_to_11.patch:
439+ + Removed, merged upsteram
440+ * debian/patches/02_missing_format.patch:
441+ + Removed, fixed upstream
442+ * debian/patches/03_deal_with_absence_of_gnome-session.patch:
443+ + Removed, merged upstream
444+ * debian/patches/04_superP.patch: Refreshed
445+ * debian/control.in: Update build-depends
446+ * debian/control.in: Add hwdata and libcolord-dev build-depends
447+ * debian/control.in: make gnome-settings-daemon recommend hwdata
448+ * debian/control.in: Make the gsettings-desktop-schemas depend more precise
449+
450+ -- Sjoerd Simons <sjoerd@debian.org> Wed, 26 Oct 2011 14:01:21 +0200
451+
452+
453 gnome-settings-daemon (3.2.1-0ubuntu3) oneiric-proposed; urgency=low
454
455 * debian/patches/00git_remove_assertions.patch:
456@@ -1551,6 +1964,53 @@
457
458 -- Rodrigo Moya <rodrigo.moya@canonical.com> Fri, 24 Jun 2011 12:33:25 +0200
459
460+gnome-settings-daemon (3.0.3-3) unstable; urgency=low
461+
462+ * debian/patches/03_deal_with_absence_of_gnome-session.patch:
463+ - Deal with absence of gnome-session gracefully and don't crash if
464+ gnome-session is not running. Patch cherry-picked from upstream Git.
465+ Closes: #645429
466+ * Remove obsolete conffiles in /etc/gnome/config on upgrades.
467+ Closes: #645443
468+
469+ -- Michael Biebl <biebl@debian.org> Mon, 17 Oct 2011 18:07:27 +0200
470+
471+gnome-settings-daemon (3.0.3-2) unstable; urgency=low
472+
473+ * debian/control.in:
474+ - Make libgudev-1.0-dev linux-any.
475+
476+ -- Michael Biebl <biebl@debian.org> Fri, 14 Oct 2011 16:14:37 +0200
477+
478+gnome-settings-daemon (3.0.3-1) unstable; urgency=low
479+
480+ [ Jean Schurger ]
481+ * New upstream release.
482+ * Removed 01_numlock.patch (b-g-o #631989 is fixed)
483+ * Added 01_medias_keys_dont_go_up_to_11.patch
484+ * Added 02_missing_format.patch
485+ * debian/control.in
486+ - Standards-Version is 3.9.2, no changes needed.
487+ - Added dependencied to enable the update plugin (packagekit)
488+ - Bumped pulseaudio dependency according to the volume patch
489+
490+ [ Josselin Mouette ]
491+ * Move g-s-d-dev to libdevel. Closes: #640125.
492+
493+ [ Jordi Mallach ]
494+ * Update Vcs-* fields to new URLs.
495+
496+ [ Michael Biebl ]
497+ * Upload to unstable.
498+ * debian/watch:
499+ - Switch to version 3.
500+ - Track .xz tarballs.
501+ * Bump debhelper compatibility level to 8.
502+ - Update Build-Depends on debhelper.
503+ - Strip debian/tmp/ from .install files.
504+
505+ -- Michael Biebl <biebl@debian.org> Fri, 14 Oct 2011 13:17:13 +0200
506+
507 gnome-settings-daemon (3.0.2-1ubuntu4) oneiric; urgency=low
508
509 * debian/control.in: stop depending on libgnome2-common
510@@ -1583,6 +2043,40 @@
511
512 -- Rodrigo Moya <rodrigo.moya@canonical.com> Tue, 24 May 2011 11:27:08 +0200
513
514+gnome-settings-daemon (3.0.2-1) experimental; urgency=low
515+
516+ [ Guido Günther ]
517+ * Bump build-dependency on libgnome-desktop-3-dev (Closes: #622689)
518+
519+ [ Rodrigo Moya ]
520+ * Rebase from Debian, remaining Ubuntu changes:
521+ * debian/control:
522+ - Build-depend on libnotify4-dev, not libnotify-dev
523+ - Add Buil-depend on libappindicator3-dev
524+ - Add Vcs-Bzr URL
525+ * debian/gnome-settings-daemon.install:
526+ * debian/gnome-settings-daemon.postinst:
527+ - Keep autostart files in standard directories
528+ * debian/gnome-update-wallpaper-cache.c:
529+ * debian/rules:
530+ - Add wallpaper cache updater program
531+ * debian/patches/02_missing_libs.patch:
532+ - Add missing X11 libraries to build dependencies
533+ * debian/patches/05_disable_corner_tapping.patch:
534+ - Disable corner tapping when disabling tap to click
535+ * debian/patches/06_use_application_indicator.patch:
536+ - Use application indicators
537+ * debian/patches/16_use_synchronous_notifications.patch:
538+ - Use synchronous notifications when they are supported
539+ * debian/patches/17_react_when_streams_removed.patch:
540+ - React to stream-removed signal from GvcMixerControl
541+ * debian/patches/40_xres_lcddefault.patch:
542+ - OpenOffice.org subpixel font rendering broken with new cairo
543+ * debian/gnome-settings-daemon.gconf-defaults:
544+ - Needs to be moved to GSettings
545+
546+ -- Rodrigo Moya <rodrigo.moya@canonical.com> Wed, 04 May 2011 13:07:16 +0200
547+
548 gnome-settings-daemon (3.0.1-1ubuntu4) oneiric; urgency=low
549
550 * debian/gnome-settings-daemon.gconf-defaults:
551@@ -1638,38 +2132,6 @@
552
553 gnome-settings-daemon (3.0.0.1-1ubuntu1) oneiric; urgency=low
554
555- [ Guido Günther ]
556- * Bump build-dependency on libgnome-desktop-3-dev (Closes: #622689)
557-
558- [ Rodrigo Moya ]
559- * Rebase from Debian, remaining Ubuntu changes:
560- * debian/control:
561- - Build-depend on libnotify4-dev, not libnotify-dev
562- - Add Buil-depend on libappindicator3-dev
563- - Add Vcs-Bzr URL
564- * debian/gnome-settings-daemon.install:
565- * debian/gnome-settings-daemon.postinst:
566- - Keep autostart files in standard directories
567- * debian/gnome-update-wallpaper-cache.c:
568- * debian/rules:
569- - Add wallpaper cache updater program
570- * debian/patches/02_missing_libs.patch:
571- - Add missing X11 libraries to build dependencies
572- * debian/patches/05_disable_corner_tapping.patch:
573- - Disable corner tapping when disabling tap to click
574- * debian/patches/06_use_application_indicator.patch:
575- - Use application indicators
576- * debian/patches/16_use_synchronous_notifications.patch:
577- - Use synchronous notifications when they are supported
578- * debian/patches/17_react_when_streams_removed.patch:
579- - React to stream-removed signal from GvcMixerControl
580- * debian/patches/40_xres_lcddefault.patch:
581- - OpenOffice.org subpixel font rendering broken with new cairo
582- * debian/gnome-settings-daemon.gconf-defaults:
583- - Needs to be moved to GSettings
584-
585- -- Rodrigo Moya <rodrigo.moya@canonical.com> Wed, 04 May 2011 13:07:16 +0200
586-
587 gnome-settings-daemon (3.0.0.1-1) experimental; urgency=low
588
589 * New upstream release.
590@@ -1803,6 +2265,22 @@
591
592 -- Sjoerd Simons <sjoerd@debian.org> Sat, 11 Dec 2010 16:20:56 +0000
593
594+gnome-settings-daemon (2.30.2-4) unstable; urgency=low
595+
596+ * Update for libnotify 0.7. Closes: #630277
597+ - Bump Build-Depends on libnotify-dev to (>= 0.7.0).
598+ - Add debian/patches/14_libnotify_0.7.patch.
599+
600+ -- Michael Biebl <biebl@debian.org> Tue, 02 Aug 2011 05:14:40 +0200
601+
602+gnome-settings-daemon (2.30.2-3) unstable; urgency=low
603+
604+ * 11_retry-startup.patch: when starting the Xsettings manager, try
605+ again several times because there is a race condition on the X side.
606+ Closes: #614682.
607+
608+ -- Josselin Mouette <joss@debian.org> Sat, 09 Apr 2011 12:29:30 +0200
609+
610 gnome-settings-daemon (2.30.2-2) unstable; urgency=low
611
612 * 13_monitor_kfreebsd.patch: new patch. Don’t monitor fdescfs.
613
614=== modified file 'debian/control'
615--- debian/control 2014-05-28 12:42:05 +0000
616+++ debian/control 2014-09-29 12:18:03 +0000
617@@ -7,7 +7,7 @@
618 Priority: optional
619 Maintainer: Ubuntu Desktop Team <ubuntu-desktop@lists.ubuntu.com>
620 XSBC-Original-Maintainer: Debian GNOME Maintainers <pkg-gnome-maintainers@lists.alioth.debian.org>
621-Uploaders: Debian GNOME Maintainers <pkg-gnome-maintainers@lists.alioth.debian.org>
622+Uploaders: Andreas Henriksson <andreas@fatal.se>, Debian GNOME Maintainers <pkg-gnome-maintainers@lists.alioth.debian.org>, Emilio Pozuelo Monfort <pochu@debian.org>, Sjoerd Simons <sjoerd@debian.org>
623 Build-Depends: cdbs,
624 debhelper (>= 9),
625 gnome-pkg-tools,
626@@ -15,37 +15,37 @@
627 dh-autoreconf,
628 autotools-dev,
629 intltool (>= 0.37.1),
630- libdbus-glib-1-dev (>= 0.74),
631- libglib2.0-dev (>= 2.35.3),
632+ libaccountsservice-dev (>= 0.6.34),
633+ libglib2.0-dev (>= 2.37.7),
634 libgtk-3-dev (>= 3.7.8),
635- libnotify-dev (>= 0.7.0),
636+ libnotify-dev (>= 0.7.3),
637 libxt-dev,
638 libxi-dev,
639+ libxtst-dev,
640 libfontconfig1-dev,
641 libxext-dev,
642 libx11-dev,
643- libxtst-dev,
644- gsettings-desktop-schemas-dev (>= 3.7.2.1),
645- libgnome-desktop-3-dev (>= 3.7.90),
646+ libibus-1.0-dev (>= 1.5.2),
647+ gsettings-desktop-schemas-dev (>= 3.9.91),
648+ libgnome-desktop-3-dev (>= 3.11.1),
649 libpulse-dev (>= 1:2.0),
650- librsvg2-dev (>= 2.36.2),
651 libcanberra-gtk3-dev,
652 libcups2-dev,
653 libpolkit-gobject-1-dev,
654- libaccountsservice-dev (>= 0.6.34),
655- libappindicator3-dev (>= 0.4.90),
656- hwdata,
657- libupower-glib-dev (>= 0.9.11),
658- libcolord-dev (>= 0.1.12),
659+ libpackagekit-glib2-dev (>= 0.6.4),
660+ libupower-glib-dev (>= 0.9.0),
661+ libgudev-1.0-dev [linux-any],
662+ libcolord-dev (>= 1.0.2),
663 liblcms2-dev,
664 libnss3-dev,
665- libgudev-1.0-dev,
666- libwacom-dev (>= 0.7),
667- xserver-xorg-input-wacom,
668- libgnomekbd-dev (>= 3.5.1),
669- libxklavier-dev,
670- libsystemd-login-dev (>= 183),
671- libibus-1.0-dev (>= 1.5.0)
672+ libwacom-dev (>= 0.7) [!hurd-any !kfreebsd-any !s390 !s390x],
673+ xserver-xorg-input-wacom [!hurd-any !kfreebsd-any !s390 !s390x],
674+ librsvg2-dev (>= 2.36.2),
675+ libgweather-3-dev (>= 3.9.5),
676+ libgeocode-glib-dev (>= 3.10.0),
677+ geoclue-2.0 (>= 2.1.2),
678+ xkb-data,
679+ libxkbfile-dev,
680 Standards-Version: 3.9.5
681 Vcs-Bzr: https://code.launchpad.net/~ubuntu-desktop/gnome-settings-daemon/ubuntu
682
683@@ -53,23 +53,19 @@
684 Architecture: any
685 Depends: ${shlibs:Depends},
686 ${misc:Depends},
687- accountsservice (>= 0.6.34),
688- gsettings-desktop-schemas (>= 3.7.2.1),
689+ systemd [!hurd-any !kfreebsd-any],
690+ gsettings-desktop-schemas (>= 3.10.0),
691 nautilus-data (>= 2.91.3-1),
692 gnome-settings-daemon-schemas (= ${source:Version})
693 Recommends: ibus (>= 1.5.0),
694 pulseaudio,
695- systemd-services
696 Pre-Depends: ${misc:Pre-Depends}
697-Breaks: rhythmbox (<< 0.11.5),
698- banshee (<< 0.13.2+dfsg-7),
699- totem (<< 2.22.0),
700- gnome-control-center (<< 1:3.6.3-0ubuntu35),
701- gnome-session (<< 3.9.90-0ubuntu6),
702+Breaks: gnome-session (<< 2.24),
703 gnome-screensaver (<< 2.28.0),
704 gnome-color-manager (<< 3.0),
705- unity-greeter (<< 0.2.1-0ubuntu1),
706- indicator-datetime (<< 12.10.3daily13.03.26)
707+ gnome-shell ( << 3.7),
708+ gnome-control-center ( << 3.7),
709+ gdm (<< 3.0)
710 Suggests: x11-xserver-utils,
711 gnome-screensaver,
712 metacity | x-window-manager
713@@ -98,6 +94,7 @@
714 This package contains the schemas used by gnome-settings-daemon
715
716 Package: gnome-settings-daemon-dev
717+Section: libdevel
718 Architecture: any
719 Depends: ${shlibs:Depends},
720 ${misc:Depends},
721
722=== modified file 'debian/control.in'
723--- debian/control.in 2014-05-28 12:42:05 +0000
724+++ debian/control.in 2014-09-29 12:18:03 +0000
725@@ -11,37 +11,37 @@
726 dh-autoreconf,
727 autotools-dev,
728 intltool (>= 0.37.1),
729- libdbus-glib-1-dev (>= 0.74),
730- libglib2.0-dev (>= 2.35.3),
731+ libaccountsservice-dev (>= 0.6.34),
732+ libglib2.0-dev (>= 2.37.7),
733 libgtk-3-dev (>= 3.7.8),
734- libnotify-dev (>= 0.7.0),
735+ libnotify-dev (>= 0.7.3),
736 libxt-dev,
737 libxi-dev,
738+ libxtst-dev,
739 libfontconfig1-dev,
740 libxext-dev,
741 libx11-dev,
742- libxtst-dev,
743- gsettings-desktop-schemas-dev (>= 3.7.2.1),
744- libgnome-desktop-3-dev (>= 3.7.90),
745+ libibus-1.0-dev (>= 1.5.2),
746+ gsettings-desktop-schemas-dev (>= 3.9.91),
747+ libgnome-desktop-3-dev (>= 3.11.1),
748 libpulse-dev (>= 1:2.0),
749- librsvg2-dev (>= 2.36.2),
750 libcanberra-gtk3-dev,
751 libcups2-dev,
752 libpolkit-gobject-1-dev,
753- libaccountsservice-dev (>= 0.6.34),
754- libappindicator3-dev (>= 0.4.90),
755- hwdata,
756- libupower-glib-dev (>= 0.9.11),
757- libcolord-dev (>= 0.1.12),
758+ libpackagekit-glib2-dev (>= 0.6.4),
759+ libupower-glib-dev (>= 0.9.0),
760+ libgudev-1.0-dev [linux-any],
761+ libcolord-dev (>= 1.0.2),
762 liblcms2-dev,
763 libnss3-dev,
764- libgudev-1.0-dev,
765- libwacom-dev (>= 0.7),
766- xserver-xorg-input-wacom,
767- libgnomekbd-dev (>= 3.5.1),
768- libxklavier-dev,
769- libsystemd-login-dev (>= 183),
770- libibus-1.0-dev (>= 1.5.0)
771+ libwacom-dev (>= 0.7) [!hurd-any !kfreebsd-any !s390 !s390x],
772+ xserver-xorg-input-wacom [!hurd-any !kfreebsd-any !s390 !s390x],
773+ librsvg2-dev (>= 2.36.2),
774+ libgweather-3-dev (>= 3.9.5),
775+ libgeocode-glib-dev (>= 3.10.0),
776+ geoclue-2.0 (>= 2.1.2),
777+ xkb-data,
778+ libxkbfile-dev,
779 Standards-Version: 3.9.5
780 Vcs-Bzr: https://code.launchpad.net/~ubuntu-desktop/gnome-settings-daemon/ubuntu
781
782@@ -49,23 +49,19 @@
783 Architecture: any
784 Depends: ${shlibs:Depends},
785 ${misc:Depends},
786- accountsservice (>= 0.6.34),
787- gsettings-desktop-schemas (>= 3.7.2.1),
788+ systemd [!hurd-any !kfreebsd-any],
789+ gsettings-desktop-schemas (>= 3.10.0),
790 nautilus-data (>= 2.91.3-1),
791 gnome-settings-daemon-schemas (= ${source:Version})
792 Recommends: ibus (>= 1.5.0),
793 pulseaudio,
794- systemd-services
795 Pre-Depends: ${misc:Pre-Depends}
796-Breaks: rhythmbox (<< 0.11.5),
797- banshee (<< 0.13.2+dfsg-7),
798- totem (<< 2.22.0),
799- gnome-control-center (<< 1:3.6.3-0ubuntu35),
800- gnome-session (<< 3.9.90-0ubuntu6),
801+Breaks: gnome-session (<< 2.24),
802 gnome-screensaver (<< 2.28.0),
803 gnome-color-manager (<< 3.0),
804- unity-greeter (<< 0.2.1-0ubuntu1),
805- indicator-datetime (<< 12.10.3daily13.03.26)
806+ gnome-shell ( << 3.7),
807+ gnome-control-center ( << 3.7),
808+ gdm (<< 3.0)
809 Suggests: x11-xserver-utils,
810 gnome-screensaver,
811 metacity | x-window-manager
812@@ -94,6 +90,7 @@
813 This package contains the schemas used by gnome-settings-daemon
814
815 Package: gnome-settings-daemon-dev
816+Section: libdevel
817 Architecture: any
818 Depends: ${shlibs:Depends},
819 ${misc:Depends},
820
821=== added file 'debian/gnome-settings-daemon.examples'
822--- debian/gnome-settings-daemon.examples 1970-01-01 00:00:00 +0000
823+++ debian/gnome-settings-daemon.examples 2014-09-29 12:18:03 +0000
824@@ -0,0 +1,1 @@
825+debian/tmp/usr/share/gnome-settings-daemon-3.0/input-device-example.sh
826
827=== modified file 'debian/gnome-settings-daemon.install'
828--- debian/gnome-settings-daemon.install 2014-02-07 15:53:04 +0000
829+++ debian/gnome-settings-daemon.install 2014-09-29 12:18:03 +0000
830@@ -1,9 +1,9 @@
831-etc
832+etc/xdg/autostart
833 usr/lib/gnome-settings-daemon*
834-usr/share/dbus-1
835+usr/share/dbus-1/services
836 usr/share/icons
837 usr/share/locale
838-usr/share/gnome-settings-daemon
839+usr/share/gnome-settings-daemon*
840 usr/share/polkit-1
841 debian/source_gnome-settings-daemon.py /usr/share/apport/package-hooks
842
843
844=== modified file 'debian/gnome-settings-daemon.maintscript'
845--- debian/gnome-settings-daemon.maintscript 2014-02-20 10:33:02 +0000
846+++ debian/gnome-settings-daemon.maintscript 2014-09-29 12:18:03 +0000
847@@ -1,8 +1,11 @@
848-rm_conffile /etc/gnome/config/Editres.ad 3.6.3-0ubuntu3~
849-rm_conffile /etc/gnome/config/Emacs.ad 3.6.3-0ubuntu3~
850-rm_conffile /etc/gnome/config/General.ad 3.6.3-0ubuntu3~
851-rm_conffile /etc/gnome/config/Motif.ad 3.6.3-0ubuntu3~
852-rm_conffile /etc/gnome/config/Tk.ad 3.6.3-0ubuntu3~
853-rm_conffile /etc/gnome/config/Xaw.ad 3.6.3-0ubuntu3~
854-rm_conffile /etc/dbus-1/system.d/org.gnome.SettingsDaemon.DateTimeMechanism.conf 3.6.4-0ubuntu7~
855-rm_conffile /etc/xdg/autostart/gnome-fallback-mount-helper.desktop 3.8.6.1-0ubuntu9~
856+rm_conffile /etc/xdg/autostart/gnome-settings-daemon.desktop 2.26.1-1~ gnome-settings-daemon
857+rm_conffile /etc/gnome/config/xrdb 2.26.1-1~ gnome-settings-daemon
858+rm_conffile /etc/gnome/config/Editres.ad 3.0.3-3~ gnome-settings-daemon
859+rm_conffile /etc/gnome/config/Tk.ad 3.0.3-3~ gnome-settings-daemon
860+rm_conffile /etc/gnome/config/Emacs.ad 3.0.3-3~ gnome-settings-daemon
861+rm_conffile /etc/gnome/config/Motif.ad 3.0.3-3~ gnome-settings-daemon
862+rm_conffile /etc/gnome/config/General.ad 3.0.3-3~ gnome-settings-daemon
863+rm_conffile /etc/gnome/config/Xaw.ad 3.0.3-3~ gnome-settings-daemon
864+rm_conffile /etc/dbus-1/system.d/org.gnome.SettingsDaemon.DateTimeMechanism.conf 3.6.4-0ubuntu7~ gnome-settings-daemon
865+rm_conffile /etc/xdg/autostart/gnome-fallback-mount-helper.desktop 3.8.6.1-0ubuntu9~ gnome-settings-daemon
866+
867
868=== removed file 'debian/gnome-update-wallpaper-cache.c'
869--- debian/gnome-update-wallpaper-cache.c 2010-11-19 09:13:10 +0000
870+++ debian/gnome-update-wallpaper-cache.c 1970-01-01 00:00:00 +0000
871@@ -1,70 +0,0 @@
872-/*
873- * Copyright (C) 2010 Canonical, Ltd.
874- *
875- * This program is free software; you can redistribute it and/or modify
876- * it under the terms of the GNU General Public License as published by
877- * the Free Software Foundation; either version 3 of the License, or
878- * (at your option) any later version.
879- *
880- * This program is distributed in the hope that it will be useful,
881- * but WITHOUT ANY WARRANTY; without even the implied warranty of
882- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
883- * GNU General Public License version 3.0 for more details.
884- *
885- * You should have received a copy of the GNU General Public License
886- * along with this program. If not, see <http://www.gnu.org/licenses/>.
887- *
888- * Authored by Didier Roche <didrocks@ubuntu.com>
889- *
890- * Bug: https://bugs.launchpad.net/bugs/530024
891- */
892-
893-#include <glib.h>
894-#include <gdk/gdk.h>
895-#define GNOME_DESKTOP_USE_UNSTABLE_API
896-#include <libgnome-desktop/gnome-bg.h>
897-
898-static GOptionEntry entries[] =
899-{
900- { NULL }
901-};
902-
903-main (int argc, char *argv[])
904-{
905- GOptionContext *context = NULL;
906- GError *error = NULL;
907-
908- GdkScreen *screen;
909- GdkRectangle rect;
910- GnomeBG *bg;
911- GSettings *settings;
912- GdkPixbuf *pixbuf;
913-
914- gdk_init (&argc, &argv);
915-
916- context = g_option_context_new ("- refresh wallpaper cache");
917- g_option_context_add_main_entries (context, entries, NULL);
918- if (!g_option_context_parse (context, &argc, &argv, &error)) {
919- g_printerr ("option parsing failed: %s\n", error->message);
920- g_option_context_free(context);
921- g_error_free (error);
922- return (1);
923- }
924- if (context)
925- g_option_context_free (context);
926-
927- /* cache only the first monitor */
928- screen = gdk_screen_get_default ();
929- gdk_screen_get_monitor_geometry (screen, 0, &rect);
930-
931- bg = gnome_bg_new ();
932- settings = g_settings_new ("org.gnome.desktop.background");
933- gnome_bg_load_from_preferences (bg, settings);
934-
935- pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, rect.width, rect.height);
936- gnome_bg_draw (bg, pixbuf, screen, FALSE);
937-
938- g_object_unref (settings);
939-
940- return (0);
941-}
942
943=== modified file 'debian/patches/43_disable_locale_settings.patch'
944--- debian/patches/43_disable_locale_settings.patch 2013-08-29 08:40:06 +0000
945+++ debian/patches/43_disable_locale_settings.patch 2014-09-29 12:18:03 +0000
946@@ -9,14 +9,14 @@
947 * settings by editing ~/.profile.
948 *
949
950-Index: gnome-settings-daemon-3.7.3/gnome-settings-daemon/main.c
951+Index: gnome-settings-daemon-3.12.2/gnome-settings-daemon/main.c
952 ===================================================================
953---- gnome-settings-daemon-3.7.3.orig/gnome-settings-daemon/main.c 2012-12-20 09:33:43.000000000 -0500
954-+++ gnome-settings-daemon-3.7.3/gnome-settings-daemon/main.c 2012-12-20 23:57:37.873288435 -0500
955-@@ -348,9 +348,6 @@
956+--- gnome-settings-daemon-3.12.2.orig/gnome-settings-daemon/main.c
957++++ gnome-settings-daemon-3.12.2/gnome-settings-daemon/main.c
958+@@ -312,9 +312,6 @@ name_acquired_handler (GDBusConnection *
959 GDBusProxy *proxy;
960
961- proxy = gnome_settings_session_get_session_proxy ();
962+ proxy = G_DBUS_PROXY (gnome_settings_bus_get_session_proxy ());
963 - /* Always call this first, as Setenv can only be called before
964 - any client registers */
965 - set_locale (proxy);
966
967=== removed file 'debian/patches/48_register_client_before_idle_callbacks.patch'
968--- debian/patches/48_register_client_before_idle_callbacks.patch 2013-07-08 15:23:17 +0000
969+++ debian/patches/48_register_client_before_idle_callbacks.patch 1970-01-01 00:00:00 +0000
970@@ -1,116 +0,0 @@
971-Index: gnome-settings-daemon-3.6.1/gnome-settings-daemon/main.c
972-===================================================================
973---- gnome-settings-daemon-3.6.1.orig/gnome-settings-daemon/main.c 2012-10-26 10:19:49.467004174 +0200
974-+++ gnome-settings-daemon-3.6.1/gnome-settings-daemon/main.c 2012-10-26 10:19:49.527004177 +0200
975-@@ -303,28 +303,6 @@
976- }
977- #endif
978-
979--static void
980--got_session_proxy (GObject *source_object,
981-- GAsyncResult *res,
982-- gpointer user_data)
983--{
984-- GDBusProxy *proxy;
985-- GError *error = NULL;
986--
987-- proxy = g_dbus_proxy_new_finish (res, &error);
988-- if (proxy == NULL) {
989-- g_debug ("Could not connect to the Session manager: %s", error->message);
990-- g_error_free (error);
991-- } else {
992--#ifdef HAVE_IBUS
993-- /* This will register with gnome-session after calling Setenv. */
994-- set_legacy_ibus_env_vars (proxy);
995--#else
996-- register_with_gnome_session (proxy);
997--#endif
998-- }
999--}
1000--
1001- static gboolean
1002- on_term_signal_pipe_closed (GIOChannel *source,
1003- GIOCondition condition,
1004-@@ -374,16 +352,6 @@
1005- {
1006- g_assert (bus != NULL);
1007-
1008-- g_dbus_proxy_new (bus,
1009-- G_DBUS_PROXY_FLAGS_NONE,
1010-- NULL,
1011-- GNOME_SESSION_DBUS_NAME,
1012-- GNOME_SESSION_DBUS_OBJECT,
1013-- GNOME_SESSION_DBUS_INTERFACE,
1014-- NULL,
1015-- (GAsyncReadyCallback) got_session_proxy,
1016-- NULL);
1017--
1018- watch_for_term_signal (manager);
1019- }
1020-
1021-@@ -406,6 +374,56 @@
1022- gtk_main_quit ();
1023- }
1024-
1025-+static gboolean
1026-+do_register_client (gpointer user_data)
1027-+{
1028-+ GDBusProxy *proxy = (GDBusProxy *) user_data;
1029-+ g_assert (proxy != NULL);
1030-+
1031-+ const char *startup_id = g_getenv ("DESKTOP_AUTOSTART_ID");
1032-+ g_dbus_proxy_call (proxy,
1033-+ "RegisterClient",
1034-+ g_variant_new ("(ss)", "gnome-settings-daemon", startup_id ? startup_id : ""),
1035-+ G_DBUS_CALL_FLAGS_NONE,
1036-+ -1,
1037-+ NULL,
1038-+ (GAsyncReadyCallback) on_client_registered,
1039-+ manager);
1040-+
1041-+ return FALSE;
1042-+}
1043-+
1044-+static void
1045-+queue_register_client (void)
1046-+{
1047-+ GDBusConnection *bus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL);
1048-+ if (!bus)
1049-+ return;
1050-+
1051-+ GError *error = NULL;
1052-+ GDBusProxy *proxy = g_dbus_proxy_new_sync (bus,
1053-+ G_DBUS_PROXY_FLAGS_NONE,
1054-+ NULL,
1055-+ GNOME_SESSION_DBUS_NAME,
1056-+ GNOME_SESSION_DBUS_OBJECT,
1057-+ GNOME_SESSION_DBUS_INTERFACE,
1058-+ NULL,
1059-+ &error);
1060-+ g_object_unref (bus);
1061-+
1062-+ if (proxy == NULL) {
1063-+ g_debug ("Could not connect to the Session manager: %s", error->message);
1064-+ g_error_free (error);
1065-+ return;
1066-+ }
1067-+
1068-+ /* Register the daemon with gnome-session */
1069-+ g_signal_connect (G_OBJECT (proxy), "g-signal",
1070-+ G_CALLBACK (on_session_over), NULL);
1071-+
1072-+ g_idle_add_full (G_PRIORITY_DEFAULT, do_register_client, proxy, NULL);
1073-+}
1074-+
1075- static void
1076- bus_register (void)
1077- {
1078-@@ -499,6 +517,8 @@
1079-
1080- notify_init ("gnome-settings-daemon");
1081-
1082-+ queue_register_client ();
1083-+
1084- bus_register ();
1085-
1086- gnome_settings_profile_start ("gnome_settings_manager_new");
1087
1088=== modified file 'debian/patches/53_sync_input_sources_to_accountsservice.patch'
1089--- debian/patches/53_sync_input_sources_to_accountsservice.patch 2013-09-10 05:03:12 +0000
1090+++ debian/patches/53_sync_input_sources_to_accountsservice.patch 2014-09-29 12:18:03 +0000
1091@@ -1,15 +1,15 @@
1092 --- a/plugins/keyboard/gsd-keyboard-manager.c
1093 +++ b/plugins/keyboard/gsd-keyboard-manager.c
1094-@@ -50,6 +50,8 @@
1095+@@ -47,6 +47,8 @@
1096 #include <ibus.h>
1097 #endif
1098
1099 +#include <act/act.h>
1100 +
1101- #include "gnome-settings-session.h"
1102+ #include "gnome-settings-bus.h"
1103 #include "gnome-settings-profile.h"
1104 #include "gsd-keyboard-manager.h"
1105-@@ -969,6 +971,67 @@
1106+@@ -953,6 +955,67 @@
1107 g_free (rules_file_path);
1108 }
1109
1110@@ -77,7 +77,7 @@
1111 static gboolean
1112 apply_input_sources_settings (GSettings *settings,
1113 gpointer keys,
1114-@@ -984,11 +1047,20 @@
1115+@@ -968,11 +1031,20 @@
1116 gchar *layout = NULL;
1117 gchar *variant = NULL;
1118 gchar **options = NULL;
1119@@ -100,12 +100,12 @@
1120
1121 --- a/configure.ac
1122 +++ b/configure.ac
1123-@@ -195,7 +195,7 @@
1124+@@ -200,7 +200,7 @@
1125 fi
1126 AM_CONDITIONAL(HAVE_IBUS, test "x$enable_ibus" == "xyes")
1127
1128--PKG_CHECK_MODULES(KEYBOARD, xkbfile $IBUS_MODULE gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION)
1129-+PKG_CHECK_MODULES(KEYBOARD, accountsservice xkbfile $IBUS_MODULE gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION)
1130+-PKG_CHECK_MODULES(KEYBOARD, xkbfile xkeyboard-config $IBUS_MODULE gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION)
1131++PKG_CHECK_MODULES(KEYBOARD, accountsservice xkbfile xkeyboard-config $IBUS_MODULE gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED_VERSION)
1132
1133- dnl ---------------------------------------------------------------------------
1134- dnl - Housekeeping plugin stuff
1135+ XKB_BASE=$($PKG_CONFIG --variable xkb_base xkeyboard-config)
1136+ AC_SUBST(XKB_BASE)
1137
1138=== modified file 'debian/patches/64_restore_terminal_keyboard_shortcut_schema.patch'
1139--- debian/patches/64_restore_terminal_keyboard_shortcut_schema.patch 2013-08-29 08:40:06 +0000
1140+++ debian/patches/64_restore_terminal_keyboard_shortcut_schema.patch 2014-09-29 12:18:03 +0000
1141@@ -1,10 +1,8 @@
1142-Index: gnome-settings-daemon-3.7.91/data/org.gnome.settings-daemon.plugins.media-keys.gschema.xml.in.in
1143-===================================================================
1144---- gnome-settings-daemon-3.7.91.orig/data/org.gnome.settings-daemon.plugins.media-keys.gschema.xml.in.in 2013-03-08 18:25:20.441961407 -0500
1145-+++ gnome-settings-daemon-3.7.91/data/org.gnome.settings-daemon.plugins.media-keys.gschema.xml.in.in 2013-03-08 18:25:20.437961407 -0500
1146-@@ -130,6 +130,11 @@
1147- <_summary>Copy a screenshot of an area to clipboard</_summary>
1148- <_description>Binding to copy a screenshot of an area to clipboard.</_description>
1149+--- a/data/org.gnome.settings-daemon.plugins.media-keys.gschema.xml.in.in
1150++++ b/data/org.gnome.settings-daemon.plugins.media-keys.gschema.xml.in.in
1151+@@ -135,6 +135,11 @@
1152+ <_summary>Record a short video of the screen</_summary>
1153+ <description>Binding to record a short video of the screen</description>
1154 </key>
1155 + <key name="terminal" type="s">
1156 + <default>'&lt;Primary&gt;&lt;Alt&gt;t'</default>
1157@@ -14,11 +12,9 @@
1158 <key name="www" type="s">
1159 <default>'XF86WWW'</default>
1160 <_summary>Launch web browser</_summary>
1161-Index: gnome-settings-daemon-3.7.91/plugins/media-keys/gsd-media-keys-manager.c
1162-===================================================================
1163---- gnome-settings-daemon-3.7.91.orig/plugins/media-keys/gsd-media-keys-manager.c 2013-03-08 18:25:20.441961407 -0500
1164-+++ gnome-settings-daemon-3.7.91/plugins/media-keys/gsd-media-keys-manager.c 2013-03-08 18:25:20.441961407 -0500
1165-@@ -960,6 +960,22 @@
1166+--- a/plugins/media-keys/gsd-media-keys-manager.c
1167++++ b/plugins/media-keys/gsd-media-keys-manager.c
1168+@@ -979,6 +979,22 @@
1169 }
1170
1171 static void
1172@@ -41,9 +37,9 @@
1173 gnome_session_shutdown (GsdMediaKeysManager *manager)
1174 {
1175 GError *error = NULL;
1176-@@ -2250,6 +2266,9 @@
1177- case AREA_SCREENSHOT_CLIP_KEY:
1178- gsd_screenshot_take (type);
1179+@@ -2319,6 +2335,9 @@
1180+ case SCREENCAST_KEY:
1181+ do_screencast_action (manager);
1182 break;
1183 + case TERMINAL_KEY:
1184 + do_terminal_action (manager);
1185@@ -51,22 +47,20 @@
1186 case WWW_KEY:
1187 do_url_action (manager, "http", timestamp);
1188 break;
1189-Index: gnome-settings-daemon-3.7.91/plugins/media-keys/shortcuts-list.h
1190-===================================================================
1191---- gnome-settings-daemon-3.7.91.orig/plugins/media-keys/shortcuts-list.h 2013-03-08 18:25:20.441961407 -0500
1192-+++ gnome-settings-daemon-3.7.91/plugins/media-keys/shortcuts-list.h 2013-03-08 18:25:34.201960831 -0500
1193-@@ -51,6 +51,7 @@
1194- SCREENSHOT_CLIP_KEY,
1195+--- a/plugins/media-keys/shortcuts-list.h
1196++++ b/plugins/media-keys/shortcuts-list.h
1197+@@ -52,6 +52,7 @@
1198 WINDOW_SCREENSHOT_CLIP_KEY,
1199 AREA_SCREENSHOT_CLIP_KEY,
1200+ SCREENCAST_KEY,
1201 + TERMINAL_KEY,
1202 WWW_KEY,
1203 PLAY_KEY,
1204 PAUSE_KEY,
1205-@@ -122,6 +123,7 @@
1206- { SCREENSHOT_CLIP_KEY, "screenshot-clip", NULL, NULL, SHELL_KEYBINDING_MODE_ALL },
1207+@@ -126,6 +127,7 @@
1208 { WINDOW_SCREENSHOT_CLIP_KEY, "window-screenshot-clip", NULL, NULL, SHELL_KEYBINDING_MODE_NORMAL },
1209 { AREA_SCREENSHOT_CLIP_KEY, "area-screenshot-clip", NULL, NULL, SHELL_KEYBINDING_MODE_ALL },
1210+ { SCREENCAST_KEY, "screencast", NULL, NULL, SHELL_KEYBINDING_MODE_ALL },
1211 + { TERMINAL_KEY, "terminal", NULL, NULL, GSD_KEYBINDING_MODE_LAUNCHER },
1212 { WWW_KEY, "www", NULL, NULL, GSD_KEYBINDING_MODE_LAUNCHER },
1213 { PLAY_KEY, "play", NULL, NULL, SHELL_KEYBINDING_MODE_ALL },
1214
1215=== removed file 'debian/patches/git_enable_auto_hidpi.patch'
1216--- debian/patches/git_enable_auto_hidpi.patch 2014-02-18 18:01:34 +0000
1217+++ debian/patches/git_enable_auto_hidpi.patch 1970-01-01 00:00:00 +0000
1218@@ -1,26 +0,0 @@
1219-From 260359bc74dda450dda6bff1c4a17dd126a61b18 Mon Sep 17 00:00:00 2001
1220-From: Alexander Larsson <alexl@redhat.com>
1221-Date: Tue, 20 Aug 2013 12:30:29 +0000
1222-Subject: xsettings: Enable the automatic hidpi selection
1223-
1224-gnome-shell can now handle Gtk+ enabling scaling by default, so its
1225-now safe to automatically enable this.
1226----
1227-diff --git a/plugins/xsettings/gsd-xsettings-manager.c b/plugins/xsettings/gsd-xsettings-manager.c
1228-index 1620566..cb018a0 100644
1229---- a/plugins/xsettings/gsd-xsettings-manager.c
1230-+++ b/plugins/xsettings/gsd-xsettings-manager.c
1231-@@ -454,11 +454,6 @@ get_window_scale (GnomeXSettingsManager *manager)
1232- if (dpi_x > HIDPI_LIMIT && dpi_y > HIDPI_LIMIT)
1233- window_scale = 2;
1234- }
1235--
1236-- /* TODO: For now we don't support automatic scale picking, because it
1237-- any scale but 1 breaks gnome-shell. Remove this when gnome-shell
1238-- is fixed. */
1239-- window_scale = 1;
1240- }
1241-
1242- return window_scale;
1243---
1244-cgit v0.9.2
1245
1246=== removed file 'debian/patches/git_hidpi_scalling.patch'
1247--- debian/patches/git_hidpi_scalling.patch 2014-02-03 16:17:38 +0000
1248+++ debian/patches/git_hidpi_scalling.patch 1970-01-01 00:00:00 +0000
1249@@ -1,169 +0,0 @@
1250-From 047f030235972fdab5e15aff484006caf914216a Mon Sep 17 00:00:00 2001
1251-From: Alexander Larsson <alexl@redhat.com>
1252-Date: Mon, 01 Jul 2013 12:14:23 +0000
1253-Subject: xsettings: Add support for window-scaling
1254-
1255-We read the scale-factor gsettings and propagate to gdk, including doing
1256-auto-detection if the setting is 0.
1257-
1258-NOTE: The auto-detection code is currently disabled as enabling
1259-scaling breaks gnome-shell. When this is fixed we want to enable this.
1260-
1261-We also scale the old Xft.DPI setting by the window scale so that old
1262-applications get a decent size on very high dpi monitors, plus we report the
1263-unscaled dpi so that window scale aware apps (like gtk) can avoid this
1264-dpi scaling.
1265-
1266-We also scale the cursor theme size so that you will get matching sizes
1267-for cursors.
1268----
1269-Index: gnome-settings-daemon-3.8.6.1/plugins/xsettings/gsd-xsettings-manager.c
1270-===================================================================
1271---- gnome-settings-daemon-3.8.6.1.orig/plugins/xsettings/gsd-xsettings-manager.c 2014-02-03 12:06:40.014501405 +0000
1272-+++ gnome-settings-daemon-3.8.6.1/plugins/xsettings/gsd-xsettings-manager.c 2014-02-03 12:08:05.314504245 +0000
1273-@@ -59,6 +59,8 @@
1274- #define GTK_MODULES_ENABLED_KEY "enabled-gtk-modules"
1275-
1276- #define TEXT_SCALING_FACTOR_KEY "text-scaling-factor"
1277-+#define SCALING_FACTOR_KEY "scaling-factor"
1278-+#define CURSOR_SIZE_KEY "cursor-size"
1279-
1280- #define FONT_ANTIALIASING_KEY "antialiasing"
1281- #define FONT_HINTING_KEY "hinting"
1282-@@ -218,6 +220,8 @@
1283- */
1284- #define DPI_FALLBACK 96
1285-
1286-+#define HIDPI_LIMIT (DPI_FALLBACK * 2)
1287-+
1288- typedef struct _TranslationEntry TranslationEntry;
1289- typedef void (* TranslationFunc) (GnomeXSettingsManager *manager,
1290- TranslationEntry *trans,
1291-@@ -359,7 +363,7 @@
1292- { "org.gnome.desktop.interface", "menubar-accel", "Gtk/MenuBarAccel", translate_string_string },
1293- { "org.gnome.desktop.interface", "enable-animations", "Gtk/EnableAnimations", translate_bool_int },
1294- { "org.gnome.desktop.interface", "cursor-theme", "Gtk/CursorThemeName", translate_string_string },
1295-- { "org.gnome.desktop.interface", "cursor-size", "Gtk/CursorThemeSize", translate_int_int },
1296-+ /* cursor-size is handled via the Xft side as it needs the scaling factor */
1297- { "org.gnome.desktop.interface", "show-input-method-menu", "Gtk/ShowInputMethodMenu", translate_bool_int },
1298- { "org.gnome.desktop.interface", "show-unicode-menu", "Gtk/ShowUnicodeMenu", translate_bool_int },
1299- { "org.gnome.desktop.interface", "automatic-mnemonics", "Gtk/AutoMnemonics", translate_bool_int },
1300-@@ -408,10 +412,56 @@
1301- return dpi * factor;
1302- }
1303-
1304-+static int
1305-+get_window_scale (GnomeXSettingsManager *manager)
1306-+{
1307-+ GSettings *interface_settings;
1308-+ int window_scale;
1309-+ GdkRectangle rect;
1310-+ GdkDisplay *display;
1311-+ GdkScreen *screen;
1312-+ int width_mm, height_mm;
1313-+ int monitor_scale;
1314-+ double dpi_x, dpi_y;
1315-+
1316-+ interface_settings = g_hash_table_lookup (manager->priv->settings, INTERFACE_SETTINGS_SCHEMA);
1317-+ window_scale =
1318-+ g_settings_get_uint (interface_settings, SCALING_FACTOR_KEY);
1319-+ if (window_scale == 0) {
1320-+ display = gdk_display_get_default ();
1321-+ screen = gdk_display_get_default_screen (display);
1322-+ gdk_screen_get_monitor_geometry (screen, 0, &rect);
1323-+ width_mm = gdk_screen_get_monitor_width_mm (screen, 0);
1324-+ height_mm = gdk_screen_get_monitor_height_mm (screen, 0);
1325-+ monitor_scale = gdk_screen_get_monitor_scale_factor (screen, 0);
1326-+
1327-+ window_scale = 1;
1328-+ if (width_mm > 0 && height_mm > 0) {
1329-+ dpi_x = (double)rect.width * monitor_scale / (width_mm / 25.4);
1330-+ dpi_y = (double)rect.height * monitor_scale / (height_mm / 25.4);
1331-+ /* We don't completely trust these values so both
1332-+ must be high, and never pick higher ratio than
1333-+ 2 automatically */
1334-+ if (dpi_x > HIDPI_LIMIT && dpi_y > HIDPI_LIMIT)
1335-+ window_scale = 2;
1336-+ }
1337-+
1338-+ /* TODO: For now we don't support automatic scale picking, because it
1339-+ any scale but 1 breaks gnome-shell. Remove this when gnome-shell
1340-+ is fixed. */
1341-+ window_scale = 1;
1342-+ }
1343-+
1344-+ return window_scale;
1345-+}
1346-+
1347- typedef struct {
1348- gboolean antialias;
1349- gboolean hinting;
1350-+ int scaled_dpi;
1351- int dpi;
1352-+ int window_scale;
1353-+ int cursor_size;
1354- const char *rgba;
1355- const char *hintstyle;
1356- } GnomeXftSettings;
1357-@@ -421,10 +471,15 @@
1358- xft_settings_get (GnomeXSettingsManager *manager,
1359- GnomeXftSettings *settings)
1360- {
1361-+ GSettings *interface_settings;
1362- GsdFontAntialiasingMode antialiasing;
1363- GsdFontHinting hinting;
1364- GsdFontRgbaOrder order;
1365- gboolean use_rgba = FALSE;
1366-+ double dpi;
1367-+ int cursor_size;
1368-+
1369-+ interface_settings = g_hash_table_lookup (manager->priv->settings, INTERFACE_SETTINGS_SCHEMA);
1370-
1371- antialiasing = g_settings_get_enum (manager->priv->plugin_settings, FONT_ANTIALIASING_KEY);
1372- hinting = g_settings_get_enum (manager->priv->plugin_settings, FONT_HINTING_KEY);
1373-@@ -432,7 +487,12 @@
1374-
1375- settings->antialias = (antialiasing != GSD_FONT_ANTIALIASING_MODE_NONE);
1376- settings->hinting = (hinting != GSD_FONT_HINTING_NONE);
1377-- settings->dpi = get_dpi_from_gsettings (manager) * 1024; /* Xft wants 1/1024ths of an inch */
1378-+ settings->window_scale = get_window_scale (manager);
1379-+ dpi = get_dpi_from_gsettings (manager);
1380-+ settings->dpi = dpi * 1024; /* Xft wants 1/1024ths of an inch */
1381-+ settings->scaled_dpi = dpi * settings->window_scale * 1024;
1382-+ cursor_size = g_settings_get_int (interface_settings, CURSOR_SIZE_KEY);
1383-+ settings->cursor_size = cursor_size * settings->window_scale;
1384- settings->rgba = "rgb";
1385- settings->hintstyle = "hintfull";
1386-
1387-@@ -498,8 +558,11 @@
1388- xsettings_manager_set_int (manager->priv->managers [i], "Xft/Antialias", settings->antialias);
1389- xsettings_manager_set_int (manager->priv->managers [i], "Xft/Hinting", settings->hinting);
1390- xsettings_manager_set_string (manager->priv->managers [i], "Xft/HintStyle", settings->hintstyle);
1391-- xsettings_manager_set_int (manager->priv->managers [i], "Xft/DPI", settings->dpi);
1392-+ xsettings_manager_set_int (manager->priv->managers [i], "Gdk/WindowScalingFactor", settings->window_scale);
1393-+ xsettings_manager_set_int (manager->priv->managers [i], "Gdk/UnscaledDPI", settings->dpi);
1394-+ xsettings_manager_set_int (manager->priv->managers [i], "Xft/DPI", settings->scaled_dpi);
1395- xsettings_manager_set_string (manager->priv->managers [i], "Xft/RGBA", settings->rgba);
1396-+ xsettings_manager_set_int (manager->priv->managers [i], "Gtk/CursorThemeSize", settings->cursor_size);
1397- }
1398- gnome_settings_profile_end (NULL);
1399- }
1400-@@ -552,7 +615,7 @@
1401- g_debug("xft_settings_set_xresources: orig res '%s'", add_string->str);
1402-
1403- update_property (add_string, "Xft.dpi",
1404-- g_ascii_dtostr (dpibuf, sizeof (dpibuf), (double) settings->dpi / 1024.0));
1405-+ g_ascii_dtostr (dpibuf, sizeof (dpibuf), (double) settings->scaled_dpi / 1024.0));
1406- update_property (add_string, "Xft.antialias",
1407- settings->antialias ? "1" : "0");
1408- update_property (add_string, "Xft.hinting",
1409-@@ -810,7 +873,8 @@
1410- guint i;
1411- GVariant *value;
1412-
1413-- if (g_str_equal (key, TEXT_SCALING_FACTOR_KEY)) {
1414-+ if (g_str_equal (key, TEXT_SCALING_FACTOR_KEY) ||
1415-+ g_str_equal (key, SCALING_FACTOR_KEY)) {
1416- xft_callback (NULL, key, manager);
1417- return;
1418- }
1419
1420=== removed file 'debian/patches/git_keybindings_add_screen_reader_toggle.patch'
1421--- debian/patches/git_keybindings_add_screen_reader_toggle.patch 2013-08-22 02:56:26 +0000
1422+++ debian/patches/git_keybindings_add_screen_reader_toggle.patch 1970-01-01 00:00:00 +0000
1423@@ -1,26 +0,0 @@
1424-From f20df9907933d24519a5e69d565cf25715349fda Mon Sep 17 00:00:00 2001
1425-From: =?UTF-8?q?Alejandro=20Pi=C3=B1eiro?= <apinheiro@igalia.com>
1426-Date: Tue, 13 Aug 2013 20:41:49 +0200
1427-Subject: [PATCH] Adding shortcut for toggle screen reader
1428-
1429-https://bugzilla.gnome.org/show_bug.cgi?id=705929
1430----
1431- data/org.gnome.settings-daemon.plugins.media-keys.gschema.xml.in.in | 2 +-
1432- 1 file changed, 1 insertion(+), 1 deletion(-)
1433-
1434-diff --git a/data/org.gnome.settings-daemon.plugins.media-keys.gschema.xml.in.in b/data/org.gnome.settings-daemon.plugins.media-keys.gschema.xml.in.in
1435-index a46888d..0af3978 100644
1436---- a/data/org.gnome.settings-daemon.plugins.media-keys.gschema.xml.in.in
1437-+++ b/data/org.gnome.settings-daemon.plugins.media-keys.gschema.xml.in.in
1438-@@ -146,7 +146,7 @@
1439- <_description>Binding to show the screen magnifier</_description>
1440- </key>
1441- <key name="screenreader" type="s">
1442-- <default>''</default>
1443-+ <default>'&lt;Alt&gt;&lt;Super&gt;s'</default>
1444- <_summary>Toggle screen reader</_summary>
1445- <_description>Binding to start the screen reader</_description>
1446- </key>
1447---
1448-1.8.3.2
1449-
1450
1451=== removed file 'debian/patches/git_lp1339244.patch'
1452--- debian/patches/git_lp1339244.patch 2014-07-14 00:01:03 +0000
1453+++ debian/patches/git_lp1339244.patch 1970-01-01 00:00:00 +0000
1454@@ -1,52 +0,0 @@
1455-From 2329da7dad28f61109cecd8ca8ce93580f62f349 Mon Sep 17 00:00:00 2001
1456-From: Bastien Nocera <hadess@hadess.net>
1457-Date: Fri, 25 Apr 2014 15:42:39 +0200
1458-Subject: common: Check the exit status of hotplug scripts correctly
1459-
1460-Instead of comparing the shell's exit code by hand, use
1461-g_spawn_check_exit_status() to get the script's exit code.
1462-
1463-https://bugzilla.gnome.org/show_bug.cgi?id=710791
1464-
1465-Index: gnome-settings-daemon-3.8.6.1/plugins/common/gsd-input-helper.c
1466-===================================================================
1467---- gnome-settings-daemon-3.8.6.1.orig/plugins/common/gsd-input-helper.c
1468-+++ gnome-settings-daemon-3.8.6.1/plugins/common/gsd-input-helper.c
1469-@@ -499,6 +499,7 @@ run_custom_command (GdkDevice
1470- CustomCommand command)
1471- {
1472- GSettings *settings;
1473-+ GError *error = NULL;
1474- char *cmd;
1475- char *argv[7];
1476- int exit_status;
1477-@@ -526,15 +527,25 @@ run_custom_command (GdkDevice
1478- argv[6] = NULL;
1479-
1480- rc = g_spawn_sync (g_get_home_dir (), argv, NULL, G_SPAWN_SEARCH_PATH,
1481-- NULL, NULL, NULL, NULL, &exit_status, NULL);
1482-+ NULL, NULL, NULL, NULL, &exit_status, &error);
1483-
1484-- if (rc == FALSE)
1485-- g_warning ("Couldn't execute command '%s', verify that this is a valid command.", cmd);
1486-+ if (rc == FALSE) {
1487-+ g_warning ("Couldn't execute command '%s', verify that this is a valid command: %s", cmd, error->message);
1488-+ g_clear_error (&error);
1489-+ }
1490-
1491- g_free (argv[0]);
1492- g_free (argv[4]);
1493-
1494-- return (exit_status == 1);
1495-+ if (!g_spawn_check_exit_status (exit_status, &error)) {
1496-+ if (g_error_matches (error, G_SPAWN_EXIT_ERROR, 1)) {
1497-+ g_clear_error (&error);
1498-+ return TRUE;
1499-+ }
1500-+ g_clear_error (&error);
1501-+ }
1502-+
1503-+ return FALSE;
1504- }
1505-
1506- GList *
1507
1508=== removed file 'debian/patches/git_micmute.patch'
1509--- debian/patches/git_micmute.patch 2014-03-14 06:21:12 +0000
1510+++ debian/patches/git_micmute.patch 1970-01-01 00:00:00 +0000
1511@@ -1,20 +0,0 @@
1512-Author: Bastien Nocera <hadess@hadess.net>
1513-Origion: upstream
1514-Description: media-keys: Add XF86AudioMicMute as a mic mute key
1515- Needed because of https://bugs.freedesktop.org/show_bug.cgi?id=54171 being fixed
1516-Applied-Upstream: https://git.gnome.org/browse/gnome-settings-daemon/commit/?id=3a8beaaf380a483ce33363031d8d276c371d7af1
1517----
1518----
1519- plugins/media-keys/shortcuts-list.h | 1 +
1520- 1 file changed, 1 insertion(+)
1521-
1522---- a/plugins/media-keys/shortcuts-list.h
1523-+++ b/plugins/media-keys/shortcuts-list.h
1524-@@ -109,6 +109,7 @@ static struct {
1525- { VOLUME_DOWN_KEY, "volume-down", NULL, NULL, SHELL_KEYBINDING_MODE_ALL },
1526- { VOLUME_UP_KEY, "volume-up", NULL, NULL, SHELL_KEYBINDING_MODE_ALL },
1527- { MIC_MUTE_KEY, NULL, N_("Microphone Mute"), "F20", SHELL_KEYBINDING_MODE_ALL },
1528-+ { MIC_MUTE_KEY, NULL, N_("Microphone Mute"), "XF86AudioMicMute", SHELL_KEYBINDING_MODE_ALL },
1529- { MUTE_QUIET_KEY, NULL, N_("Quiet Volume Mute"), "<Alt>XF86AudioMute", SHELL_KEYBINDING_MODE_ALL },
1530- { VOLUME_DOWN_QUIET_KEY, NULL, N_("Quiet Volume Down"), "<Alt>XF86AudioLowerVolume", SHELL_KEYBINDING_MODE_ALL },
1531- { VOLUME_UP_QUIET_KEY, NULL, N_("Quiet Volume Up"), "<Alt>XF86AudioRaiseVolume", SHELL_KEYBINDING_MODE_ALL },
1532
1533=== removed file 'debian/patches/git_new_screencast_keybinding.patch'
1534--- debian/patches/git_new_screencast_keybinding.patch 2014-05-28 12:42:05 +0000
1535+++ debian/patches/git_new_screencast_keybinding.patch 1970-01-01 00:00:00 +0000
1536@@ -1,202 +0,0 @@
1537-From 1ae70dc6ff141e248e8198ee1d82e1bec6ed4434 Mon Sep 17 00:00:00 2001
1538-From: Jasper St. Pierre <jstpierre@mecheye.net>
1539-Date: Thu, 18 Jul 2013 01:10:02 +0000
1540-Subject: media-keys: Add a binding to take a short screencast of the screen
1541-
1542-https://bugzilla.gnome.org/show_bug.cgi?id=704435
1543----
1544-Index: gnome-settings-daemon-3.8.6.1/data/org.gnome.settings-daemon.plugins.media-keys.gschema.xml.in.in
1545-===================================================================
1546---- gnome-settings-daemon-3.8.6.1.orig/data/org.gnome.settings-daemon.plugins.media-keys.gschema.xml.in.in
1547-+++ gnome-settings-daemon-3.8.6.1/data/org.gnome.settings-daemon.plugins.media-keys.gschema.xml.in.in
1548-@@ -135,6 +135,11 @@
1549- <_summary>Launch terminal</_summary>
1550- <_description>Binding to launch the terminal.</_description>
1551- </key>
1552-+ <key name="screencast" type="s">
1553-+ <default>'&lt;Ctrl&gt;&lt;Shift&gt;&lt;Alt&gt;R'</default>
1554-+ <_summary>Record a short video of the screen</_summary>
1555-+ <description>Binding to record a short video of the screen</description>
1556-+ </key>
1557- <key name="www" type="s">
1558- <default>'XF86WWW'</default>
1559- <_summary>Launch web browser</_summary>
1560-Index: gnome-settings-daemon-3.8.6.1/plugins/media-keys/gsd-media-keys-manager.c
1561-===================================================================
1562---- gnome-settings-daemon-3.8.6.1.orig/plugins/media-keys/gsd-media-keys-manager.c
1563-+++ gnome-settings-daemon-3.8.6.1/plugins/media-keys/gsd-media-keys-manager.c
1564-@@ -80,6 +80,9 @@
1565-
1566- #define SHELL_GRABBER_RETRY_INTERVAL 1
1567-
1568-+/* Screencasts last for 5 mins */
1569-+#define SCREENCAST_LENGTH 300
1570-+
1571- static const gchar introspection_xml[] =
1572- "<node name='/org/gnome/SettingsDaemon/MediaKeys'>"
1573- " <interface name='org.gnome.SettingsDaemon.MediaKeys'>"
1574-@@ -172,6 +175,11 @@ struct GsdMediaKeysManagerPrivate
1575- GCancellable *shell_cancellable;
1576- GCancellable *grab_cancellable;
1577-
1578-+ /* Screencast stuff */
1579-+ GDBusProxy *screencast_proxy;
1580-+ guint screencast_timeout_id;
1581-+ GCancellable *screencast_cancellable;
1582-+
1583- /* systemd stuff */
1584- GDBusProxy *logind_proxy;
1585- gint inhibit_keys_fd;
1586-@@ -1967,6 +1975,61 @@ do_battery_action (GsdMediaKeysManager *
1587- }
1588-
1589- static void
1590-+screencast_stop (GsdMediaKeysManager *manager)
1591-+{
1592-+ if (manager->priv->screencast_timeout_id > 0) {
1593-+ g_source_remove (manager->priv->screencast_timeout_id);
1594-+ manager->priv->screencast_timeout_id = 0;
1595-+ }
1596-+
1597-+ g_dbus_proxy_call (manager->priv->screencast_proxy,
1598-+ "StopScreencast", NULL,
1599-+ G_DBUS_CALL_FLAGS_NONE, -1,
1600-+ manager->priv->screencast_cancellable,
1601-+ NULL, NULL);
1602-+}
1603-+
1604-+static gboolean
1605-+screencast_timeout (gpointer user_data)
1606-+{
1607-+ GsdMediaKeysManager *manager = user_data;
1608-+ screencast_stop (manager);
1609-+ return G_SOURCE_REMOVE;
1610-+}
1611-+
1612-+static void
1613-+screencast_start (GsdMediaKeysManager *manager)
1614-+{
1615-+ g_dbus_proxy_call (manager->priv->screencast_proxy,
1616-+ "Screencast",
1617-+ /* Translators: this is a filename used for screencast
1618-+ * recording, where "%d" and "%t" date and time, e.g.
1619-+ * "Screencast from 07-17-2013 10:00:46 PM.webm" */
1620-+ /* xgettext:no-c-format */
1621-+ g_variant_new_parsed ("(%s, @a{sv} {})",
1622-+ _("Screencast from %d %t.webm")),
1623-+ G_DBUS_CALL_FLAGS_NONE, -1,
1624-+ manager->priv->screencast_cancellable,
1625-+ NULL, NULL);
1626-+
1627-+ manager->priv->screencast_timeout_id = g_timeout_add_seconds (SCREENCAST_LENGTH,
1628-+ screencast_timeout,
1629-+ manager);
1630-+}
1631-+
1632-+static void
1633-+do_screencast_action (GsdMediaKeysManager *manager)
1634-+{
1635-+ if (manager->priv->screencast_proxy == NULL)
1636-+ return;
1637-+
1638-+ if (manager->priv->screencast_timeout_id == 0)
1639-+ screencast_start (manager);
1640-+ else
1641-+ screencast_stop (manager);
1642-+}
1643-+
1644-+static void
1645- do_custom_action (GsdMediaKeysManager *manager,
1646- guint deviceid,
1647- MediaKey *key,
1648-@@ -2044,6 +2107,9 @@ do_action (GsdMediaKeysManager *manager,
1649- case TERMINAL_KEY:
1650- do_terminal_action (manager);
1651- break;
1652-+ case SCREENCAST_KEY:
1653-+ do_screencast_action (manager);
1654-+ break;
1655- case WWW_KEY:
1656- do_url_action (manager, "http", timestamp);
1657- break;
1658-@@ -2221,6 +2287,17 @@ on_shell_proxy_ready (GObject *sour
1659- }
1660-
1661- static void
1662-+on_screencast_proxy_ready (GObject *source,
1663-+ GAsyncResult *result,
1664-+ gpointer data)
1665-+{
1666-+ GsdMediaKeysManager *manager = data;
1667-+
1668-+ manager->priv->screencast_proxy =
1669-+ g_dbus_proxy_new_for_bus_finish (result, NULL);
1670-+}
1671-+
1672-+static void
1673- on_key_grabber_ready (GObject *source,
1674- GAsyncResult *result,
1675- gpointer data)
1676-@@ -2261,6 +2338,14 @@ on_shell_appeared (GDBusConnection *co
1677- SHELL_DBUS_NAME,
1678- manager->priv->shell_cancellable,
1679- on_shell_proxy_ready, manager);
1680-+
1681-+ g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION,
1682-+ 0, NULL,
1683-+ name_owner,
1684-+ SHELL_DBUS_PATH "/Screencast",
1685-+ SHELL_DBUS_NAME ".Screencast",
1686-+ manager->priv->screencast_cancellable,
1687-+ on_screencast_proxy_ready, manager);
1688- }
1689-
1690- static void
1691-@@ -2330,6 +2415,7 @@ start_media_keys_idle_cb (GsdMediaKeysMa
1692-
1693- ensure_cancellable (&manager->priv->grab_cancellable);
1694- ensure_cancellable (&manager->priv->shell_cancellable);
1695-+ ensure_cancellable (&manager->priv->screencast_cancellable);
1696-
1697- manager->priv->name_owner_id =
1698- g_bus_watch_name (G_BUS_TYPE_SESSION,
1699-@@ -2399,6 +2485,7 @@ gsd_media_keys_manager_stop (GsdMediaKey
1700- g_clear_object (&priv->power_proxy);
1701- g_clear_object (&priv->power_screen_proxy);
1702- g_clear_object (&priv->power_keyboard_proxy);
1703-+ g_clear_object (&priv->screencast_proxy);
1704-
1705- if (manager->priv->name_owner_id) {
1706- g_bus_unwatch_name (manager->priv->name_owner_id);
1707-@@ -2434,6 +2521,11 @@ gsd_media_keys_manager_stop (GsdMediaKey
1708- g_clear_object (&priv->shell_cancellable);
1709- }
1710-
1711-+ if (priv->screencast_cancellable != NULL) {
1712-+ g_cancellable_cancel (priv->screencast_cancellable);
1713-+ g_clear_object (&priv->screencast_cancellable);
1714-+ }
1715-+
1716- g_clear_object (&priv->sink);
1717- g_clear_object (&priv->source);
1718- g_clear_object (&priv->volume);
1719-Index: gnome-settings-daemon-3.8.6.1/plugins/media-keys/shortcuts-list.h
1720-===================================================================
1721---- gnome-settings-daemon-3.8.6.1.orig/plugins/media-keys/shortcuts-list.h
1722-+++ gnome-settings-daemon-3.8.6.1/plugins/media-keys/shortcuts-list.h
1723-@@ -51,6 +51,7 @@ typedef enum {
1724- SCREENSHOT_CLIP_KEY,
1725- WINDOW_SCREENSHOT_CLIP_KEY,
1726- AREA_SCREENSHOT_CLIP_KEY,
1727-+ SCREENCAST_KEY,
1728- TERMINAL_KEY,
1729- WWW_KEY,
1730- PLAY_KEY,
1731-@@ -123,6 +124,7 @@ static struct {
1732- { SCREENSHOT_CLIP_KEY, "screenshot-clip", NULL, NULL, SHELL_KEYBINDING_MODE_ALL },
1733- { WINDOW_SCREENSHOT_CLIP_KEY, "window-screenshot-clip", NULL, NULL, SHELL_KEYBINDING_MODE_NORMAL },
1734- { AREA_SCREENSHOT_CLIP_KEY, "area-screenshot-clip", NULL, NULL, SHELL_KEYBINDING_MODE_ALL },
1735-+ { SCREENCAST_KEY, "screencast", NULL, NULL, SHELL_KEYBINDING_MODE_ALL },
1736- { TERMINAL_KEY, "terminal", NULL, NULL, GSD_KEYBINDING_MODE_LAUNCHER },
1737- { WWW_KEY, "www", NULL, NULL, GSD_KEYBINDING_MODE_LAUNCHER },
1738- { PLAY_KEY, "play", NULL, NULL, SHELL_KEYBINDING_MODE_ALL },
1739
1740=== removed file 'debian/patches/git_touchpad_scrolling.patch'
1741--- debian/patches/git_touchpad_scrolling.patch 2013-10-16 14:38:52 +0000
1742+++ debian/patches/git_touchpad_scrolling.patch 1970-01-01 00:00:00 +0000
1743@@ -1,56 +0,0 @@
1744-From 36920e3a9c193badec2898a9a8b979f51d7be094 Mon Sep 17 00:00:00 2001
1745-From: Ondrej Holy <oholy@redhat.com>
1746-Date: Fri, 11 Oct 2013 10:52:37 +0000
1747-Subject: mouse: fix two finger scrolling detection
1748-
1749-https://bugzilla.gnome.org/show_bug.cgi?id=702858
1750----
1751-diff --git a/plugins/mouse/gsd-mouse-manager.c b/plugins/mouse/gsd-mouse-manager.c
1752-index 768a1e3..e86c709 100644
1753---- a/plugins/mouse/gsd-mouse-manager.c
1754-+++ b/plugins/mouse/gsd-mouse-manager.c
1755-@@ -717,19 +717,16 @@ set_scroll_method (GsdMouseManager *manager,
1756- {
1757- int rc;
1758- XDevice *xdevice;
1759-- Atom act_type, prop_edge, prop_twofinger;
1760-+ Atom act_type, prop, prop_edge, prop_twofinger;
1761- int act_format;
1762- unsigned long nitems, bytes_after;
1763- unsigned char *data;
1764-
1765-+ prop = XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), "Synaptics Capabilities", True);
1766- prop_edge = XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), "Synaptics Edge Scrolling", False);
1767- prop_twofinger = XInternAtom (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), "Synaptics Two-Finger Scrolling", False);
1768-- if (!prop_twofinger && method == GSD_TOUCHPAD_SCROLL_METHOD_TWO_FINGER_SCROLLING) {
1769-- method = GSD_TOUCHPAD_SCROLL_METHOD_EDGE_SCROLLING;
1770-- g_settings_set_enum (manager->priv->touchpad_settings, KEY_SCROLL_METHOD, method);
1771-- }
1772-
1773-- if (!prop_edge || !prop_twofinger)
1774-+ if (!prop_edge || !prop_twofinger || !prop)
1775- return;
1776-
1777- xdevice = open_gdk_device (device);
1778-@@ -745,6 +742,20 @@ set_scroll_method (GsdMouseManager *manager,
1779-
1780- gdk_error_trap_push ();
1781- rc = XGetDeviceProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice,
1782-+ prop, 0, 2, False,
1783-+ XA_INTEGER, &act_type, &act_format, &nitems,
1784-+ &bytes_after, &data);
1785-+ if (rc == Success && act_type != None) {
1786-+ if (!(data[3]) && method == GSD_TOUCHPAD_SCROLL_METHOD_TWO_FINGER_SCROLLING) {
1787-+ g_warning ("Two finger scroll is not supported by %s", gdk_device_get_name (device));
1788-+ method = GSD_TOUCHPAD_SCROLL_METHOD_EDGE_SCROLLING;
1789-+ g_settings_set_enum (manager->priv->touchpad_settings, KEY_SCROLL_METHOD, method);
1790-+ }
1791-+
1792-+ XFree (data);
1793-+ }
1794-+
1795-+ rc = XGetDeviceProperty (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), xdevice,
1796- prop_edge, 0, 1, False,
1797- XA_INTEGER, &act_type, &act_format, &nitems,
1798- &bytes_after, &data);
1799---
1800
1801=== removed file 'debian/patches/git_xsettings_segfaults.patch'
1802--- debian/patches/git_xsettings_segfaults.patch 2014-05-28 12:42:05 +0000
1803+++ debian/patches/git_xsettings_segfaults.patch 1970-01-01 00:00:00 +0000
1804@@ -1,33 +0,0 @@
1805-From a1acdc0aa5af1c2716ff30bcfb8987de7ca3acc9 Mon Sep 17 00:00:00 2001
1806-From: Tim Lunn <tim@feathertop.org>
1807-Date: Sat, 9 Nov 2013 10:59:54 +1100
1808-Subject: xsettings: unwatch dbus before destroying xsettings managers
1809-
1810-fix possible race since notify_have_shell is getting called after the
1811-managers are destroyed.
1812-
1813-https://bugzilla.gnome.org/show_bug.cgi?id=711238
1814-
1815-
1816---- a/plugins/xsettings/gsd-xsettings-manager.c
1817-+++ b/plugins/xsettings/gsd-xsettings-manager.c
1818-@@ -966,6 +966,9 @@
1819-
1820- g_debug ("Stopping xsettings manager");
1821-
1822-+ if (p->shell_name_watch_id > 0)
1823-+ g_bus_unwatch_name (p->shell_name_watch_id);
1824-+
1825- if (p->managers != NULL) {
1826- for (i = 0; p->managers [i]; ++i)
1827- xsettings_manager_destroy (p->managers [i]);
1828-@@ -981,9 +984,6 @@
1829-
1830- stop_fontconfig_monitor (manager);
1831-
1832-- if (manager->priv->shell_name_watch_id > 0)
1833-- g_bus_unwatch_name (manager->priv->shell_name_watch_id);
1834--
1835- if (p->settings != NULL) {
1836- g_hash_table_destroy (p->settings);
1837- p->settings = NULL;
1838
1839=== modified file 'debian/patches/nexus-orientation.patch'
1840--- debian/patches/nexus-orientation.patch 2013-07-08 15:23:17 +0000
1841+++ debian/patches/nexus-orientation.patch 2014-09-29 12:18:03 +0000
1842@@ -1,11 +1,11 @@
1843 ## Description: Autorotate Nexus screen
1844 ## Origin/Author: jani@ubuntu.com
1845 ## Bug: https://bugs.launchpad.net/ubuntu-nexus7/+bug/1110360
1846-Index: gnome-settings-daemon-3.6.4/plugins/orientation/gsd-orientation-manager.c
1847+Index: gnome-settings-daemon-3.12.2/plugins/orientation/gsd-orientation-manager.c
1848 ===================================================================
1849---- gnome-settings-daemon-3.6.4.orig/plugins/orientation/gsd-orientation-manager.c 2013-02-13 13:36:14.606221356 +0200
1850-+++ gnome-settings-daemon-3.6.4/plugins/orientation/gsd-orientation-manager.c 2013-02-13 13:36:38.130337989 +0200
1851-@@ -23,6 +23,7 @@
1852+--- gnome-settings-daemon-3.12.2.orig/plugins/orientation/gsd-orientation-manager.c
1853++++ gnome-settings-daemon-3.12.2/plugins/orientation/gsd-orientation-manager.c
1854+@@ -22,6 +22,7 @@
1855
1856 #include "config.h"
1857
1858@@ -13,7 +13,7 @@
1859 #include <glib.h>
1860 #include <gtk/gtk.h>
1861 #include <gdk/gdk.h>
1862-@@ -87,6 +88,14 @@
1863+@@ -88,6 +89,14 @@ G_DEFINE_TYPE (GsdOrientationManager, gs
1864
1865 static gpointer manager_object = NULL;
1866
1867@@ -25,10 +25,10 @@
1868 +static char *mpu6050_accel_y = NULL;
1869 +static gboolean mpu_timer(GsdOrientationManager *manager);
1870 +
1871- static GObject *
1872- gsd_orientation_manager_constructor (GType type,
1873- guint n_construct_properties,
1874-@@ -312,8 +321,11 @@
1875+ static void
1876+ gsd_orientation_manager_class_init (GsdOrientationManagerClass *klass)
1877+ {
1878+@@ -290,8 +299,11 @@ orientation_lock_changed_cb (GSettings
1879 return;
1880
1881 manager->priv->orientation_lock = new;
1882@@ -41,7 +41,7 @@
1883 /* Handle the rotations that could have occurred while
1884 * we were locked */
1885 do_rotation (manager);
1886-@@ -372,12 +384,14 @@
1887+@@ -358,12 +370,14 @@ on_bus_gotten (GObject *so
1888 static GUdevDevice *
1889 get_accelerometer (GUdevClient *client)
1890 {
1891@@ -57,7 +57,7 @@
1892 for (l = list; l != NULL; l = l->next) {
1893 GUdevDevice *dev;
1894
1895-@@ -408,6 +422,53 @@
1896+@@ -394,6 +408,53 @@ get_accelerometer (GUdevClient *client)
1897 return ret;
1898 }
1899
1900@@ -111,7 +111,7 @@
1901 static gboolean
1902 gsd_orientation_manager_idle_cb (GsdOrientationManager *manager)
1903 {
1904-@@ -432,6 +493,16 @@
1905+@@ -419,6 +480,16 @@ gsd_orientation_manager_idle_cb (GsdOrie
1906 g_debug ("Found accelerometer at sysfs path '%s'", manager->priv->sysfs_path);
1907
1908 manager->priv->prev_orientation = get_orientation_from_device (dev);
1909
1910=== added file 'debian/patches/revert-gsettings-removals.patch'
1911--- debian/patches/revert-gsettings-removals.patch 1970-01-01 00:00:00 +0000
1912+++ debian/patches/revert-gsettings-removals.patch 2014-09-29 12:18:03 +0000
1913@@ -0,0 +1,113 @@
1914+From 4d13c5025c73f0f4cdc6cefb7c81c40313790623 Mon Sep 17 00:00:00 2001
1915+From: Tim Lunn <tim@feathertop.org>
1916+Date: Sat, 13 Sep 2014 11:57:02 +1000
1917+ Revert gsettings key removals, these are still need by unity-settings-daemon
1918+
1919+---
1920+ ...ings-daemon.peripherals.wacom.gschema.xml.in.in | 5 +++
1921+ ...gnome.settings-daemon.plugins.gschema.xml.in.in | 13 +++++++
1922+ ...settings-daemon.plugins.power.gschema.xml.in.in | 40 ++++++++++++++++++++++
1923+ plugins/power/gsd-power-manager.c | 32 +++++++++++++++++
1924+ 5 files changed, 94 insertions(+)
1925+
1926+diff --git a/data/org.gnome.settings-daemon.peripherals.wacom.gschema.xml.in.in b/data/org.gnome.settings-daemon.peripherals.wacom.gschema.xml.in.in
1927+index 5908fbc..d642c85 100644
1928+--- a/data/org.gnome.settings-daemon.peripherals.wacom.gschema.xml.in.in
1929++++ b/data/org.gnome.settings-daemon.peripherals.wacom.gschema.xml.in.in
1930+@@ -41,6 +41,11 @@
1931+ <_summary>Wacom touch feature</_summary>
1932+ <_description>Enable this to move the cursor when the user touches the tablet.</_description>
1933+ </key>
1934++ <key name="tablet-pc-button" type="b">
1935++ <default>false</default>
1936++ <_summary>Wacom tablet PC feature</_summary>
1937++ <_description>Enable this to only report stylus events when the tip is pressed.</_description>
1938++ </key>
1939+ <key name="last-calibrated-resolution" type="(ii)">
1940+ <default>(-1, -1)</default>
1941+ <_summary>Wacom last calibrated resolution</_summary>
1942+diff --git a/data/org.gnome.settings-daemon.plugins.gschema.xml.in.in b/data/org.gnome.settings-daemon.plugins.gschema.xml.in.in
1943+index 65682df..57a058d 100644
1944+--- a/data/org.gnome.settings-daemon.plugins.gschema.xml.in.in
1945++++ b/data/org.gnome.settings-daemon.plugins.gschema.xml.in.in
1946+@@ -23,6 +23,7 @@
1947+ <child name="orientation" schema="org.gnome.settings-daemon.plugins.orientation"/>
1948+ <child name="power" schema="org.gnome.settings-daemon.plugins.power"/>
1949+ <child name="print-notifications" schema="org.gnome.settings-daemon.plugins.print-notifications"/>
1950++ <child name="remote-display" schema="org.gnome.settings-daemon.plugins.remote-display"/>
1951+ <child name="screensaver-proxy" schema="org.gnome.settings-daemon.plugins.screensaver-proxy"/>
1952+ <child name="smartcard" schema="org.gnome.settings-daemon.plugins.smartcard"/>
1953+ <child name="sound" schema="org.gnome.settings-daemon.plugins.sound"/>
1954+@@ -90,6 +91,18 @@
1955+ <_description>Priority to use for this plugin in gnome-settings-daemon startup queue</_description>
1956+ </key>
1957+ </schema>
1958++ <schema gettext-domain="@GETTEXT_PACKAGE@" id="org.gnome.settings-daemon.plugins.remote-display" path="/org/gnome/settings-daemon/plugins/remote-display/">
1959++ <key name="active" type="b">
1960++ <default>true</default>
1961++ <_summary>Activation of this plugin</_summary>
1962++ <_description>Whether this plugin would be activated by gnome-settings-daemon or not</_description>
1963++ </key>
1964++ <key name="priority" type="i">
1965++ <default>0</default>
1966++ <_summary>Priority to use for this plugin</_summary>
1967++ <_description>Priority to use for this plugin in gnome-settings-daemon startup queue</_description>
1968++ </key>
1969++ </schema>
1970+ <schema gettext-domain="@GETTEXT_PACKAGE@" id="org.gnome.settings-daemon.plugins.rfkill" path="/org/gnome/settings-daemon/plugins/rfkill/">
1971+ <key name="active" type="b">
1972+ <default>true</default>
1973+diff --git a/data/org.gnome.settings-daemon.plugins.power.gschema.xml.in.in b/data/org.gnome.settings-daemon.plugins.power.gschema.xml.in.in
1974+index 1fd60e7..8db3973 100644
1975+--- a/data/org.gnome.settings-daemon.plugins.power.gschema.xml.in.in
1976++++ b/data/org.gnome.settings-daemon.plugins.power.gschema.xml.in.in
1977+@@ -66,5 +66,45 @@
1978+ <summary>Battery critical low action</summary>
1979+ <description>The action to take when the battery is critically low.</description>
1980+ </key>
1981++ <key name="percentage-low" type="i">
1982++ <default>10</default>
1983++ <_summary>Percentage considered low</_summary>
1984++ <_description>The percentage of the battery when it is considered low. Only valid when use-time-for-policy is false.</_description>
1985++ </key>
1986++ <key name="percentage-critical" type="i">
1987++ <default>3</default>
1988++ <_summary>Percentage considered critical</_summary>
1989++ <_description>The percentage of the battery when it is considered critical. Only valid when use-time-for-policy is false.</_description>
1990++ </key>
1991++ <key name="percentage-action" type="i">
1992++ <default>2</default>
1993++ <_summary>Percentage action is taken</_summary>
1994++ <_description>The percentage of the battery when the critical action is performed. Only valid when use-time-for-policy is false.</_description>
1995++ </key>
1996++ <key name="time-low" type="i">
1997++ <default>1200</default>
1998++ <_summary>The time remaining when low</_summary>
1999++ <_description>The time remaining in seconds of the battery when it is considered low. Only valid when use-time-for-policy is true.</_description>
2000++ </key>
2001++ <key name="time-critical" type="i">
2002++ <default>300</default>
2003++ <_summary>The time remaining when critical</_summary>
2004++ <_description>The time remaining in seconds of the battery when it is considered critical. Only valid when use-time-for-policy is true.</_description>
2005++ </key>
2006++ <key name="time-action" type="i">
2007++ <default>120</default>
2008++ <_summary>The time remaining when action is taken</_summary>
2009++ <_description>The time remaining in seconds of the battery when critical action is taken. Only valid when use-time-for-policy is true.</_description>
2010++ </key>
2011++ <key name="use-time-for-policy" type="b">
2012++ <default>true</default>
2013++ <_summary>Whether to use time-based notifications</_summary>
2014++ <_description>If time based notifications should be used. If set to false, then the percentage change is used instead, which may fix a broken ACPI BIOS.</_description>
2015++ </key>
2016++ <key name="notify-perhaps-recall" type="b">
2017++ <default>true</default>
2018++ <_summary>If we should show the recalled battery warning for a broken battery</_summary>
2019++ <_description>If we should show the recalled battery warning for a broken battery. Set this to false only if you know your battery is okay.</_description>
2020++ </key>
2021+ </schema>
2022+ </schemalist>
2023+--
2024+2.1.0
2025+
2026+
2027
2028=== added file 'debian/patches/revert_media-keys_fix_battery_key.patch'
2029--- debian/patches/revert_media-keys_fix_battery_key.patch 1970-01-01 00:00:00 +0000
2030+++ debian/patches/revert_media-keys_fix_battery_key.patch 2014-09-29 12:18:03 +0000
2031@@ -0,0 +1,112 @@
2032+From 2b112903b45497747bb196be80fa5eb49d18a562 Mon Sep 17 00:00:00 2001
2033+From: Tim Lunn <tim@feathertop.org>
2034+Date: Tue, 16 Sep 2014 12:18:59 +1000
2035+Subject: [PATCH] Revert "media-keys: Fix battery key handling"
2036+
2037+This reverts commit 79ce8533b0b7d406744fc5b1732fcc67ebc74b4f.
2038+---
2039+ configure.ac | 2 +-
2040+ plugins/media-keys/gsd-media-keys-manager.c | 34 ++++++++++-------------------
2041+ 2 files changed, 12 insertions(+), 24 deletions(-)
2042+
2043+diff --git a/configure.ac b/configure.ac
2044+index 501cb43..930e12f 100644
2045+--- a/configure.ac
2046++++ b/configure.ac
2047+@@ -208,7 +208,7 @@ dnl ---------------------------------------------------------------------------
2048+ dnl - media-keys plugin stuff
2049+ dnl ---------------------------------------------------------------------------
2050+
2051+-PKG_CHECK_MODULES(MEDIA_KEYS, [gio-unix-2.0 libpulse >= $PA_REQUIRED_VERSION $GUDEV_PKG libpulse-mainloop-glib >= $PA_REQUIRED_VERSION libcanberra-gtk3 upower-glib >= $UPOWER_REQUIRED_VERSION])
2052++PKG_CHECK_MODULES(MEDIA_KEYS, [gio-unix-2.0 libpulse >= $PA_REQUIRED_VERSION $GUDEV_PKG libpulse-mainloop-glib >= $PA_REQUIRED_VERSION libcanberra-gtk3])
2053+ PKG_CHECK_MODULES(GVC, [gobject-2.0 libpulse >= $PA_REQUIRED_VERSION libpulse-mainloop-glib >= $PA_REQUIRED_VERSION])
2054+ AM_CONDITIONAL(HAVE_INTROSPECTION, false)
2055+
2056+diff --git a/plugins/media-keys/gsd-media-keys-manager.c b/plugins/media-keys/gsd-media-keys-manager.c
2057+index 71eb16c..5e628f4 100644
2058+--- a/plugins/media-keys/gsd-media-keys-manager.c
2059++++ b/plugins/media-keys/gsd-media-keys-manager.c
2060+@@ -39,8 +39,6 @@
2061+ #include <gio/gdesktopappinfo.h>
2062+ #include <gio/gunixfdlist.h>
2063+
2064+-#include <libupower-glib/upower.h>
2065+-
2066+ #ifdef HAVE_GUDEV
2067+ #include <gudev/gudev.h>
2068+ #endif
2069+@@ -162,7 +160,6 @@ struct GsdMediaKeysManagerPrivate
2070+ GDBusProxy *power_proxy;
2071+ GDBusProxy *power_screen_proxy;
2072+ GDBusProxy *power_keyboard_proxy;
2073+- UpDevice *composite_device;
2074+
2075+ /* Shell stuff */
2076+ GsdShell *shell_proxy;
2077+@@ -1950,24 +1947,21 @@ do_brightness_action (GsdMediaKeysManager *manager,
2078+ static void
2079+ do_battery_action (GsdMediaKeysManager *manager)
2080+ {
2081+- gdouble percentage;
2082+- UpDeviceKind kind;
2083+- gchar *icon_name;
2084++ GVariant *icon_var, *percentage;
2085++ char *label = NULL;
2086+
2087+- g_return_if_fail (manager->priv->composite_device != NULL);
2088++ if (manager->priv->power_proxy == NULL)
2089++ return;
2090+
2091+- g_object_get (manager->priv->composite_device,
2092+- "kind", &kind,
2093+- "icon-name", &icon_name,
2094+- "percentage", &percentage,
2095+- NULL);
2096++ icon_var = g_dbus_proxy_get_cached_property (manager->priv->power_proxy, "Icon");
2097++ percentage = g_dbus_proxy_get_cached_property (manager->priv->power_proxy, "Percentage");
2098+
2099+- if (kind == UP_DEVICE_KIND_UPS || kind == UP_DEVICE_KIND_BATTERY) {
2100+- g_debug ("showing battery level OSD");
2101+- show_osd (manager, icon_name, NULL, percentage);
2102+- }
2103++ if (g_variant_get_double (percentage) >= 0.0)
2104++ label = g_strdup_printf ("%d %%", (int) g_variant_get_double (percentage));
2105+
2106+- g_free (icon_name);
2107++ show_osd (manager, g_variant_get_string (icon_var, NULL),
2108++ label, g_variant_get_double (percentage));
2109++ g_free (label);
2110+ }
2111+
2112+ static void
2113+@@ -2488,7 +2482,6 @@ gsd_media_keys_manager_stop (GsdMediaKeysManager *manager)
2114+ g_clear_object (&priv->power_proxy);
2115+ g_clear_object (&priv->power_screen_proxy);
2116+ g_clear_object (&priv->power_keyboard_proxy);
2117+- g_clear_object (&priv->composite_device);
2118+ g_clear_object (&priv->mpris_controller);
2119+ g_clear_object (&priv->screencast_proxy);
2120+
2121+@@ -2712,7 +2705,6 @@ on_bus_gotten (GObject *source_object,
2122+ {
2123+ GDBusConnection *connection;
2124+ GError *error = NULL;
2125+- UpClient *up_client;
2126+
2127+ if (manager->priv->bus_cancellable == NULL ||
2128+ g_cancellable_is_cancelled (manager->priv->bus_cancellable)) {
2129+@@ -2775,10 +2767,6 @@ on_bus_gotten (GObject *source_object,
2130+ NULL,
2131+ (GAsyncReadyCallback) power_keyboard_ready_cb,
2132+ manager);
2133+-
2134+- up_client = up_client_new ();
2135+- manager->priv->composite_device = up_client_get_display_device (up_client);
2136+- g_object_unref (up_client);
2137+ }
2138+
2139+ static void
2140+--
2141+2.1.0
2142+
2143+
2144
2145=== added file 'debian/patches/revert_power_310.patch'
2146--- debian/patches/revert_power_310.patch 1970-01-01 00:00:00 +0000
2147+++ debian/patches/revert_power_310.patch 2014-09-29 12:18:03 +0000
2148@@ -0,0 +1,3143 @@
2149+From 092b9692f6be1c5c57bee8146ff26f26fa360c0b Mon Sep 17 00:00:00 2001
2150+From: Tim Lunn <tim@feathertop.org>
2151+Date: Tue, 16 Sep 2014 08:51:23 +1000
2152+Subject: [PATCH] revert power panel to 3.10
2153+
2154+---
2155+ plugins/power/Makefile.am | 2 +-
2156+ plugins/power/gpm-common.c | 904 +++++++++++++++++++-
2157+ plugins/power/gpm-common.h | 12 +-
2158+ plugins/power/gsd-power-constants.h | 3 +-
2159+ plugins/power/gsd-power-manager.c | 1394 +++++++++++++++++++++++++++----
2160+ plugins/power/gsd-power-manager.h | 3 +-
2161+ plugins/power/gsd-power-plugin.c | 3 +-
2162+ plugins/power/gsm-inhibitor-flag.h | 4 +-
2163+ plugins/power/gsm-manager-logout-mode.h | 3 +-
2164+ plugins/power/gsm-presence-flag.h | 4 +-
2165+ plugins/power/test.py | 22 +-
2166+ 11 files changed, 2158 insertions(+), 196 deletions(-)
2167+
2168+Index: gnome-settings-daemon/plugins/power/Makefile.am
2169+===================================================================
2170+--- gnome-settings-daemon.orig/plugins/power/Makefile.am
2171++++ gnome-settings-daemon/plugins/power/Makefile.am
2172+@@ -77,7 +77,7 @@ gsd_test_power_SOURCES = \
2173+ test-power.c
2174+
2175+ gsd_test_power_CFLAGS = $(libpower_la_CFLAGS)
2176+-gsd_test_power_CPPFLAGS = $(libpower_la_CPPFLAGS) -DGSD_MOCK=1
2177++gsd_test_power_CPPFLAGS = $(libpower_la_CPPFLAGS) -DGSD_MOCK=1 -DGSD_ACTION_DELAY=1
2178+ gsd_test_power_LDADD = \
2179+ -lm \
2180+ $(top_builddir)/plugins/common/libcommon.la \
2181+Index: gnome-settings-daemon/plugins/power/gpm-common.c
2182+===================================================================
2183+--- gnome-settings-daemon.orig/plugins/power/gpm-common.c
2184++++ gnome-settings-daemon/plugins/power/gpm-common.c
2185+@@ -98,6 +98,892 @@ gpm_get_timestring (guint time_secs)
2186+ return timestring;
2187+ }
2188+
2189++static const gchar *
2190++gpm_upower_get_device_icon_index (UpDevice *device)
2191++{
2192++ gdouble percentage;
2193++ /* get device properties */
2194++ g_object_get (device, "percentage", &percentage, NULL);
2195++ if (percentage < 10)
2196++ return "000";
2197++ else if (percentage < 30)
2198++ return "020";
2199++ else if (percentage < 50)
2200++ return "040";
2201++ else if (percentage < 70)
2202++ return "060";
2203++ else if (percentage < 90)
2204++ return "080";
2205++ return "100";
2206++}
2207++
2208++static const gchar *
2209++gpm_upower_get_device_icon_suffix (UpDevice *device)
2210++{
2211++ gdouble percentage;
2212++ /* get device properties */
2213++ g_object_get (device, "percentage", &percentage, NULL);
2214++ if (percentage < 10)
2215++ return "caution";
2216++ else if (percentage < 30)
2217++ return "low";
2218++ else if (percentage < 60)
2219++ return "good";
2220++ return "full";
2221++}
2222++
2223++GIcon *
2224++gpm_upower_get_device_icon (UpDevice *device, gboolean use_symbolic)
2225++{
2226++ GString *filename;
2227++ gchar **iconnames;
2228++ const gchar *kind_str;
2229++ const gchar *suffix_str;
2230++ const gchar *index_str;
2231++ UpDeviceKind kind;
2232++ UpDeviceState state;
2233++ gboolean is_present;
2234++ gdouble percentage;
2235++ GIcon *icon = NULL;
2236++
2237++ g_return_val_if_fail (device != NULL, NULL);
2238++
2239++ /* get device properties */
2240++ g_object_get (device,
2241++ "kind", &kind,
2242++ "state", &state,
2243++ "percentage", &percentage,
2244++ "is-present", &is_present,
2245++ NULL);
2246++
2247++ /* get correct icon prefix */
2248++ filename = g_string_new (NULL);
2249++
2250++ /* get the icon from some simple rules */
2251++ if (kind == UP_DEVICE_KIND_LINE_POWER) {
2252++ if (use_symbolic)
2253++ g_string_append (filename, "ac-adapter-symbolic;");
2254++ g_string_append (filename, "ac-adapter;");
2255++
2256++ } else if (kind == UP_DEVICE_KIND_MONITOR) {
2257++ if (use_symbolic)
2258++ g_string_append (filename, "gpm-monitor-symbolic;");
2259++ g_string_append (filename, "gpm-monitor;");
2260++
2261++ } else {
2262++
2263++ kind_str = up_device_kind_to_string (kind);
2264++ if (!is_present) {
2265++ if (use_symbolic)
2266++ g_string_append (filename, "battery-missing-symbolic;");
2267++ g_string_append_printf (filename, "gpm-%s-missing;", kind_str);
2268++ g_string_append_printf (filename, "gpm-%s-000;", kind_str);
2269++ g_string_append (filename, "battery-missing;");
2270++
2271++ } else {
2272++ switch (state) {
2273++ case UP_DEVICE_STATE_EMPTY:
2274++ if (use_symbolic)
2275++ g_string_append (filename, "battery-empty-symbolic;");
2276++ g_string_append_printf (filename, "gpm-%s-empty;", kind_str);
2277++ g_string_append_printf (filename, "gpm-%s-000;", kind_str);
2278++ g_string_append (filename, "battery-empty;");
2279++ break;
2280++ case UP_DEVICE_STATE_FULLY_CHARGED:
2281++ if (use_symbolic) {
2282++ g_string_append (filename, "battery-full-charged-symbolic;");
2283++ g_string_append (filename, "battery-full-charging-symbolic;");
2284++ }
2285++ g_string_append_printf (filename, "gpm-%s-full;", kind_str);
2286++ g_string_append_printf (filename, "gpm-%s-100;", kind_str);
2287++ g_string_append (filename, "battery-full-charged;");
2288++ g_string_append (filename, "battery-full-charging;");
2289++ break;
2290++ case UP_DEVICE_STATE_CHARGING:
2291++ case UP_DEVICE_STATE_PENDING_CHARGE:
2292++ suffix_str = gpm_upower_get_device_icon_suffix (device);
2293++ index_str = gpm_upower_get_device_icon_index (device);
2294++ if (use_symbolic)
2295++ g_string_append_printf (filename, "battery-%s-charging-symbolic;", suffix_str);
2296++ g_string_append_printf (filename, "gpm-%s-%s-charging;", kind_str, index_str);
2297++ g_string_append_printf (filename, "battery-%s-charging;", suffix_str);
2298++ break;
2299++ case UP_DEVICE_STATE_DISCHARGING:
2300++ case UP_DEVICE_STATE_PENDING_DISCHARGE:
2301++ suffix_str = gpm_upower_get_device_icon_suffix (device);
2302++ index_str = gpm_upower_get_device_icon_index (device);
2303++ if (use_symbolic)
2304++ g_string_append_printf (filename, "battery-%s-symbolic;", suffix_str);
2305++ g_string_append_printf (filename, "gpm-%s-%s;", kind_str, index_str);
2306++ g_string_append_printf (filename, "battery-%s;", suffix_str);
2307++ break;
2308++ default:
2309++ if (use_symbolic)
2310++ g_string_append (filename, "battery-missing-symbolic;");
2311++ g_string_append (filename, "gpm-battery-missing;");
2312++ g_string_append (filename, "battery-missing;");
2313++ }
2314++ }
2315++ }
2316++
2317++ /* nothing matched */
2318++ if (filename->len == 0) {
2319++ g_warning ("nothing matched, falling back to default icon");
2320++ g_string_append (filename, "dialog-warning;");
2321++ }
2322++
2323++ g_debug ("got filename: %s", filename->str);
2324++
2325++ iconnames = g_strsplit (filename->str, ";", -1);
2326++ icon = g_themed_icon_new_from_names (iconnames, -1);
2327++
2328++ g_strfreev (iconnames);
2329++ g_string_free (filename, TRUE);
2330++ return icon;
2331++}
2332++
2333++/**
2334++ * gpm_precision_round_down:
2335++ * @value: The input value
2336++ * @smallest: The smallest increment allowed
2337++ *
2338++ * 101, 10 100
2339++ * 95, 10 90
2340++ * 0, 10 0
2341++ * 112, 10 110
2342++ * 100, 10 100
2343++ **/
2344++static gint
2345++gpm_precision_round_down (gfloat value, gint smallest)
2346++{
2347++ gfloat division;
2348++ if (fabs (value) < 0.01)
2349++ return 0;
2350++ if (smallest == 0) {
2351++ g_warning ("divisor zero");
2352++ return 0;
2353++ }
2354++ division = (gfloat) value / (gfloat) smallest;
2355++ division = floorf (division);
2356++ division *= smallest;
2357++ return (gint) division;
2358++}
2359++
2360++gchar *
2361++gpm_upower_get_device_summary (UpDevice *device)
2362++{
2363++ const gchar *kind_desc = NULL;
2364++ const gchar *device_desc = NULL;
2365++ GString *description;
2366++ guint time_to_full_round;
2367++ guint time_to_empty_round;
2368++ gchar *time_to_full_str = NULL;
2369++ gchar *time_to_empty_str = NULL;
2370++ UpDeviceKind kind;
2371++ UpDeviceState state;
2372++ gdouble percentage;
2373++ gboolean is_present;
2374++ gint64 time_to_full;
2375++ gint64 time_to_empty;
2376++
2377++ /* get device properties */
2378++ g_object_get (device,
2379++ "kind", &kind,
2380++ "state", &state,
2381++ "percentage", &percentage,
2382++ "is-present", &is_present,
2383++ "time-to-full", &time_to_full,
2384++ "time-to-empty", &time_to_empty,
2385++ NULL);
2386++
2387++ description = g_string_new (NULL);
2388++ kind_desc = gpm_device_kind_to_localised_string (kind, 1);
2389++ device_desc = gpm_device_to_localised_string (device);
2390++
2391++ /* not installed */
2392++ if (!is_present) {
2393++ g_string_append (description, device_desc);
2394++ goto out;
2395++ }
2396++
2397++ /* don't display all the extra stuff for keyboards and mice */
2398++ if (kind == UP_DEVICE_KIND_MOUSE ||
2399++ kind == UP_DEVICE_KIND_KEYBOARD ||
2400++ kind == UP_DEVICE_KIND_PDA) {
2401++ g_string_append (description, kind_desc);
2402++ g_string_append_printf (description, " (%.0f%%)", percentage);
2403++ goto out;
2404++ }
2405++
2406++ /* we care if we are on AC */
2407++ if (kind == UP_DEVICE_KIND_PHONE) {
2408++ if (state == UP_DEVICE_STATE_CHARGING || !(state == UP_DEVICE_STATE_DISCHARGING)) {
2409++ g_string_append (description, device_desc);
2410++ g_string_append_printf (description, " (%.0f%%)", percentage);
2411++ goto out;
2412++ }
2413++ g_string_append (description, kind_desc);
2414++ g_string_append_printf (description, " (%.0f%%)", percentage);
2415++ goto out;
2416++ }
2417++
2418++ /* precalculate so we don't get Unknown time remaining */
2419++ time_to_full_round = gpm_precision_round_down (time_to_full, GPM_UP_TIME_PRECISION);
2420++ time_to_empty_round = gpm_precision_round_down (time_to_empty, GPM_UP_TIME_PRECISION);
2421++
2422++ /* we always display "Laptop battery 16 minutes remaining" as we need to clarify what device we are refering to */
2423++ if (state == UP_DEVICE_STATE_FULLY_CHARGED) {
2424++
2425++ g_string_append (description, device_desc);
2426++
2427++ if (kind == UP_DEVICE_KIND_BATTERY && time_to_empty_round > GPM_UP_TEXT_MIN_TIME) {
2428++ time_to_empty_str = gpm_get_timestring (time_to_empty_round);
2429++ g_string_append (description, " - ");
2430++ /* TRANSLATORS: The laptop battery is charged, and we know a time.
2431++ * The parameter is the time, e.g. 7 hours 6 minutes */
2432++ g_string_append_printf (description, _("provides %s laptop runtime"), time_to_empty_str);
2433++ }
2434++ goto out;
2435++ }
2436++ if (state == UP_DEVICE_STATE_DISCHARGING) {
2437++
2438++ if (time_to_empty_round > GPM_UP_TEXT_MIN_TIME) {
2439++ time_to_empty_str = gpm_get_timestring (time_to_empty_round);
2440++ /* TRANSLATORS: the device is discharging, and we have a time remaining
2441++ * The first parameter is the device type, e.g. "Laptop battery" and
2442++ * the second is the time, e.g. 7 hours 6 minutes */
2443++ g_string_append_printf (description, _("%s %s remaining"),
2444++ kind_desc, time_to_empty_str);
2445++ g_string_append_printf (description, " (%.0f%%)", percentage);
2446++ } else {
2447++ g_string_append (description, device_desc);
2448++ g_string_append_printf (description, " (%.0f%%)", percentage);
2449++ }
2450++ goto out;
2451++ }
2452++ if (state == UP_DEVICE_STATE_CHARGING) {
2453++
2454++ if (time_to_full_round > GPM_UP_TEXT_MIN_TIME &&
2455++ time_to_empty_round > GPM_UP_TEXT_MIN_TIME) {
2456++
2457++ /* display both discharge and charge time */
2458++ time_to_full_str = gpm_get_timestring (time_to_full_round);
2459++ time_to_empty_str = gpm_get_timestring (time_to_empty_round);
2460++
2461++ /* TRANSLATORS: device is charging, and we have a time to full and a percentage
2462++ * The first parameter is the device type, e.g. "Laptop battery" and
2463++ * the second is the time, e.g. "7 hours 6 minutes" */
2464++ g_string_append_printf (description, _("%s %s until charged"),
2465++ kind_desc, time_to_full_str);
2466++ g_string_append_printf (description, " (%.0f%%)", percentage);
2467++
2468++ g_string_append (description, " - ");
2469++ /* TRANSLATORS: the device is charging, and we have a time to full and empty.
2470++ * The parameter is a time string, e.g. "7 hours 6 minutes" */
2471++ g_string_append_printf (description, _("provides %s battery runtime"),
2472++ time_to_empty_str);
2473++ } else if (time_to_full_round > GPM_UP_TEXT_MIN_TIME) {
2474++
2475++ /* display only charge time */
2476++ time_to_full_str = gpm_get_timestring (time_to_full_round);
2477++
2478++ /* TRANSLATORS: device is charging, and we have a time to full and a percentage.
2479++ * The first parameter is the device type, e.g. "Laptop battery" and
2480++ * the second is the time, e.g. "7 hours 6 minutes" */
2481++ g_string_append_printf (description, _("%s %s until charged"),
2482++ kind_desc, time_to_full_str);
2483++ g_string_append_printf (description, " (%.0f%%)", percentage);
2484++ } else {
2485++ g_string_append (description, device_desc);
2486++ g_string_append_printf (description, " (%.0f%%)", percentage);
2487++ }
2488++ goto out;
2489++ }
2490++ if (state == UP_DEVICE_STATE_PENDING_DISCHARGE) {
2491++ g_string_append (description, device_desc);
2492++ g_string_append_printf (description, " (%.0f%%)", percentage);
2493++ goto out;
2494++ }
2495++ if (state == UP_DEVICE_STATE_PENDING_CHARGE) {
2496++ g_string_append (description, device_desc);
2497++ g_string_append_printf (description, " (%.0f%%)", percentage);
2498++ goto out;
2499++ }
2500++ if (state == UP_DEVICE_STATE_EMPTY) {
2501++ g_string_append (description, device_desc);
2502++ goto out;
2503++ }
2504++
2505++ /* fallback */
2506++ g_warning ("in an undefined state we are not charging or "
2507++ "discharging and the batteries are also not charged");
2508++ g_string_append (description, device_desc);
2509++ g_string_append_printf (description, " (%.0f%%)", percentage);
2510++out:
2511++ g_free (time_to_full_str);
2512++ g_free (time_to_empty_str);
2513++ return g_string_free (description, FALSE);
2514++}
2515++
2516++gchar *
2517++gpm_upower_get_device_description (UpDevice *device)
2518++{
2519++ GString *details;
2520++ const gchar *text;
2521++ gchar *time_str;
2522++ UpDeviceKind kind;
2523++ UpDeviceState state;
2524++ UpDeviceTechnology technology;
2525++ gdouble percentage;
2526++ gdouble capacity;
2527++ gdouble energy;
2528++ gdouble energy_full;
2529++ gdouble energy_full_design;
2530++ gdouble energy_rate;
2531++ gboolean is_present;
2532++ gint64 time_to_full;
2533++ gint64 time_to_empty;
2534++ gchar *vendor = NULL;
2535++ gchar *serial = NULL;
2536++ gchar *model = NULL;
2537++
2538++ g_return_val_if_fail (device != NULL, NULL);
2539++
2540++ /* get device properties */
2541++ g_object_get (device,
2542++ "kind", &kind,
2543++ "state", &state,
2544++ "percentage", &percentage,
2545++ "is-present", &is_present,
2546++ "time-to-full", &time_to_full,
2547++ "time-to-empty", &time_to_empty,
2548++ "technology", &technology,
2549++ "capacity", &capacity,
2550++ "energy", &energy,
2551++ "energy-full", &energy_full,
2552++ "energy-full-design", &energy_full_design,
2553++ "energy-rate", &energy_rate,
2554++ "vendor", &vendor,
2555++ "serial", &serial,
2556++ "model", &model,
2557++ NULL);
2558++
2559++ details = g_string_new ("");
2560++ text = gpm_device_kind_to_localised_string (kind, 1);
2561++ /* TRANSLATORS: the type of data, e.g. Laptop battery */
2562++ g_string_append_printf (details, "<b>%s</b> %s\n", _("Product:"), text);
2563++
2564++ if (!is_present) {
2565++ /* TRANSLATORS: device is missing */
2566++ g_string_append_printf (details, "<b>%s</b> %s\n", _("Status:"), _("Missing"));
2567++ } else if (state == UP_DEVICE_STATE_FULLY_CHARGED) {
2568++ /* TRANSLATORS: device is charged */
2569++ g_string_append_printf (details, "<b>%s</b> %s\n", _("Status:"), _("Charged"));
2570++ } else if (state == UP_DEVICE_STATE_CHARGING) {
2571++ /* TRANSLATORS: device is charging */
2572++ g_string_append_printf (details, "<b>%s</b> %s\n", _("Status:"), _("Charging"));
2573++ } else if (state == UP_DEVICE_STATE_DISCHARGING) {
2574++ /* TRANSLATORS: device is discharging */
2575++ g_string_append_printf (details, "<b>%s</b> %s\n", _("Status:"), _("Discharging"));
2576++ }
2577++
2578++ if (percentage >= 0) {
2579++ /* TRANSLATORS: percentage */
2580++ g_string_append_printf (details, "<b>%s</b> %.1f%%\n", _("Percentage charge:"), percentage);
2581++ }
2582++ if (vendor) {
2583++ /* TRANSLATORS: manufacturer */
2584++ g_string_append_printf (details, "<b>%s</b> %s\n", _("Vendor:"), vendor);
2585++ }
2586++ if (technology != UP_DEVICE_TECHNOLOGY_UNKNOWN) {
2587++ text = gpm_device_technology_to_localised_string (technology);
2588++ /* TRANSLATORS: how the battery is made, e.g. Lithium Ion */
2589++ g_string_append_printf (details, "<b>%s</b> %s\n", _("Technology:"), text);
2590++ }
2591++ if (serial) {
2592++ /* TRANSLATORS: serial number of the battery */
2593++ g_string_append_printf (details, "<b>%s</b> %s\n", _("Serial number:"), serial);
2594++ }
2595++ if (model) {
2596++ /* TRANSLATORS: model number of the battery */
2597++ g_string_append_printf (details, "<b>%s</b> %s\n", _("Model:"), model);
2598++ }
2599++ if (time_to_full > 0) {
2600++ time_str = gpm_get_timestring (time_to_full);
2601++ /* TRANSLATORS: time to fully charged */
2602++ g_string_append_printf (details, "<b>%s</b> %s\n", _("Charge time:"), time_str);
2603++ g_free (time_str);
2604++ }
2605++ if (time_to_empty > 0) {
2606++ time_str = gpm_get_timestring (time_to_empty);
2607++ /* TRANSLATORS: time to empty */
2608++ g_string_append_printf (details, "<b>%s</b> %s\n", _("Discharge time:"), time_str);
2609++ g_free (time_str);
2610++ }
2611++ if (capacity > 0) {
2612++ const gchar *condition;
2613++ if (capacity > 99) {
2614++ /* TRANSLATORS: Excellent, Good, Fair and Poor are all related to battery Capacity */
2615++ condition = _("Excellent");
2616++ } else if (capacity > 90) {
2617++ condition = _("Good");
2618++ } else if (capacity > 70) {
2619++ condition = _("Fair");
2620++ } else {
2621++ condition = _("Poor");
2622++ }
2623++ /* TRANSLATORS: %.1f is a percentage and %s the condition (Excellent, Good, ...) */
2624++ g_string_append_printf (details, "<b>%s</b> %.1f%% (%s)\n",
2625++ _("Capacity:"), capacity, condition);
2626++ }
2627++ if (kind == UP_DEVICE_KIND_BATTERY) {
2628++ if (energy > 0) {
2629++ /* TRANSLATORS: current charge */
2630++ g_string_append_printf (details, "<b>%s</b> %.1f Wh\n",
2631++ _("Current charge:"), energy);
2632++ }
2633++ if (energy_full > 0 &&
2634++ energy_full_design != energy_full) {
2635++ /* TRANSLATORS: last full is the charge the battery was seen to charge to */
2636++ g_string_append_printf (details, "<b>%s</b> %.1f Wh\n",
2637++ _("Last full charge:"), energy_full);
2638++ }
2639++ if (energy_full_design > 0) {
2640++ /* Translators: */
2641++ /* TRANSLATORS: Design charge is the amount of charge the battery is designed to have when brand new */
2642++ g_string_append_printf (details, "<b>%s</b> %.1f Wh\n",
2643++ _("Design charge:"), energy_full_design);
2644++ }
2645++ if (energy_rate > 0) {
2646++ /* TRANSLATORS: the charge or discharge rate */
2647++ g_string_append_printf (details, "<b>%s</b> %.1f W\n",
2648++ _("Charge rate:"), energy_rate);
2649++ }
2650++ }
2651++ if (kind == UP_DEVICE_KIND_MOUSE ||
2652++ kind == UP_DEVICE_KIND_KEYBOARD) {
2653++ if (energy > 0) {
2654++ /* TRANSLATORS: the current charge for CSR devices */
2655++ g_string_append_printf (details, "<b>%s</b> %.0f/7\n",
2656++ _("Current charge:"), energy);
2657++ }
2658++ if (energy_full_design > 0) {
2659++ /* TRANSLATORS: the design charge for CSR devices */
2660++ g_string_append_printf (details, "<b>%s</b> %.0f/7\n",
2661++ _("Design charge:"), energy_full_design);
2662++ }
2663++ }
2664++ /* remove the last \n */
2665++ g_string_truncate (details, details->len-1);
2666++
2667++ g_free (vendor);
2668++ g_free (serial);
2669++ g_free (model);
2670++ return g_string_free (details, FALSE);
2671++}
2672++
2673++const gchar *
2674++gpm_device_kind_to_localised_string (UpDeviceKind kind, guint number)
2675++{
2676++ const gchar *text = NULL;
2677++ switch (kind) {
2678++ case UP_DEVICE_KIND_LINE_POWER:
2679++ /* TRANSLATORS: system power cord */
2680++ text = ngettext ("AC adapter", "AC adapters", number);
2681++ break;
2682++ case UP_DEVICE_KIND_BATTERY:
2683++ /* TRANSLATORS: laptop primary battery */
2684++ text = ngettext ("Laptop battery", "Laptop batteries", number);
2685++ break;
2686++ case UP_DEVICE_KIND_UPS:
2687++ /* TRANSLATORS: battery-backed AC power source */
2688++ text = ngettext ("UPS", "UPSs", number);
2689++ break;
2690++ case UP_DEVICE_KIND_MONITOR:
2691++ /* TRANSLATORS: a monitor is a device to measure voltage and current */
2692++ text = ngettext ("Monitor", "Monitors", number);
2693++ break;
2694++ case UP_DEVICE_KIND_MOUSE:
2695++ /* TRANSLATORS: wireless mice with internal batteries */
2696++ text = ngettext ("Mouse", "Mice", number);
2697++ break;
2698++ case UP_DEVICE_KIND_KEYBOARD:
2699++ /* TRANSLATORS: wireless keyboard with internal battery */
2700++ text = ngettext ("Keyboard", "Keyboards", number);
2701++ break;
2702++ case UP_DEVICE_KIND_PDA:
2703++ /* TRANSLATORS: portable device */
2704++ text = ngettext ("PDA", "PDAs", number);
2705++ break;
2706++ case UP_DEVICE_KIND_PHONE:
2707++ /* TRANSLATORS: cell phone (mobile...) */
2708++ text = ngettext ("Cell phone", "Cell phones", number);
2709++ break;
2710++#if UP_CHECK_VERSION(0,9,5)
2711++ case UP_DEVICE_KIND_MEDIA_PLAYER:
2712++ /* TRANSLATORS: media player, mp3 etc */
2713++ text = ngettext ("Media player", "Media players", number);
2714++ break;
2715++ case UP_DEVICE_KIND_TABLET:
2716++ /* TRANSLATORS: tablet device */
2717++ text = ngettext ("Tablet", "Tablets", number);
2718++ break;
2719++ case UP_DEVICE_KIND_COMPUTER:
2720++ /* TRANSLATORS: tablet device */
2721++ text = ngettext ("Computer", "Computers", number);
2722++ break;
2723++#endif
2724++ default:
2725++ g_warning ("enum unrecognised: %i", kind);
2726++ text = up_device_kind_to_string (kind);
2727++ }
2728++ return text;
2729++}
2730++
2731++const gchar *
2732++gpm_device_kind_to_icon (UpDeviceKind kind)
2733++{
2734++ const gchar *icon = NULL;
2735++ switch (kind) {
2736++ case UP_DEVICE_KIND_LINE_POWER:
2737++ icon = "ac-adapter";
2738++ break;
2739++ case UP_DEVICE_KIND_BATTERY:
2740++ icon = "battery";
2741++ break;
2742++ case UP_DEVICE_KIND_UPS:
2743++ icon = "network-wired";
2744++ break;
2745++ case UP_DEVICE_KIND_MONITOR:
2746++ icon = "application-certificate";
2747++ break;
2748++ case UP_DEVICE_KIND_MOUSE:
2749++ icon = "input-mouse";
2750++ break;
2751++ case UP_DEVICE_KIND_KEYBOARD:
2752++ icon = "input-keyboard";
2753++ break;
2754++ case UP_DEVICE_KIND_PDA:
2755++ icon = "pda";
2756++ break;
2757++ case UP_DEVICE_KIND_PHONE:
2758++ icon = "phone";
2759++ break;
2760++#if UP_CHECK_VERSION(0,9,5)
2761++ case UP_DEVICE_KIND_MEDIA_PLAYER:
2762++ icon = "multimedia-player";
2763++ break;
2764++ case UP_DEVICE_KIND_TABLET:
2765++ icon = "input-tablet";
2766++ break;
2767++ case UP_DEVICE_KIND_COMPUTER:
2768++ icon = "computer-apple-ipad";
2769++ break;
2770++#endif
2771++ default:
2772++ g_warning ("enum unrecognised: %i", kind);
2773++ icon = "gtk-help";
2774++ }
2775++ return icon;
2776++}
2777++
2778++const gchar *
2779++gpm_device_technology_to_localised_string (UpDeviceTechnology technology_enum)
2780++{
2781++ const gchar *technology = NULL;
2782++ switch (technology_enum) {
2783++ case UP_DEVICE_TECHNOLOGY_LITHIUM_ION:
2784++ /* TRANSLATORS: battery technology */
2785++ technology = _("Lithium Ion");
2786++ break;
2787++ case UP_DEVICE_TECHNOLOGY_LITHIUM_POLYMER:
2788++ /* TRANSLATORS: battery technology */
2789++ technology = _("Lithium Polymer");
2790++ break;
2791++ case UP_DEVICE_TECHNOLOGY_LITHIUM_IRON_PHOSPHATE:
2792++ /* TRANSLATORS: battery technology */
2793++ technology = _("Lithium Iron Phosphate");
2794++ break;
2795++ case UP_DEVICE_TECHNOLOGY_LEAD_ACID:
2796++ /* TRANSLATORS: battery technology */
2797++ technology = _("Lead acid");
2798++ break;
2799++ case UP_DEVICE_TECHNOLOGY_NICKEL_CADMIUM:
2800++ /* TRANSLATORS: battery technology */
2801++ technology = _("Nickel Cadmium");
2802++ break;
2803++ case UP_DEVICE_TECHNOLOGY_NICKEL_METAL_HYDRIDE:
2804++ /* TRANSLATORS: battery technology */
2805++ technology = _("Nickel metal hydride");
2806++ break;
2807++ case UP_DEVICE_TECHNOLOGY_UNKNOWN:
2808++ /* TRANSLATORS: battery technology */
2809++ technology = _("Unknown technology");
2810++ break;
2811++ default:
2812++ g_assert_not_reached ();
2813++ break;
2814++ }
2815++ return technology;
2816++}
2817++
2818++const gchar *
2819++gpm_device_state_to_localised_string (UpDeviceState state)
2820++{
2821++ const gchar *state_string = NULL;
2822++
2823++ switch (state) {
2824++ case UP_DEVICE_STATE_CHARGING:
2825++ /* TRANSLATORS: battery state */
2826++ state_string = _("Charging");
2827++ break;
2828++ case UP_DEVICE_STATE_DISCHARGING:
2829++ /* TRANSLATORS: battery state */
2830++ state_string = _("Discharging");
2831++ break;
2832++ case UP_DEVICE_STATE_EMPTY:
2833++ /* TRANSLATORS: battery state */
2834++ state_string = _("Empty");
2835++ break;
2836++ case UP_DEVICE_STATE_FULLY_CHARGED:
2837++ /* TRANSLATORS: battery state */
2838++ state_string = _("Charged");
2839++ break;
2840++ case UP_DEVICE_STATE_PENDING_CHARGE:
2841++ /* TRANSLATORS: battery state */
2842++ state_string = _("Waiting to charge");
2843++ break;
2844++ case UP_DEVICE_STATE_PENDING_DISCHARGE:
2845++ /* TRANSLATORS: battery state */
2846++ state_string = _("Waiting to discharge");
2847++ break;
2848++ default:
2849++ g_assert_not_reached ();
2850++ break;
2851++ }
2852++ return state_string;
2853++}
2854++
2855++const gchar *
2856++gpm_device_to_localised_string (UpDevice *device)
2857++{
2858++ UpDeviceState state;
2859++ UpDeviceKind kind;
2860++ gboolean present;
2861++
2862++ /* get device parameters */
2863++ g_object_get (device,
2864++ "is-present", &present,
2865++ "kind", &kind,
2866++ "state", &state,
2867++ NULL);
2868++
2869++ /* laptop battery */
2870++ if (kind == UP_DEVICE_KIND_BATTERY) {
2871++
2872++ if (!present) {
2873++ /* TRANSLATORS: device not present */
2874++ return _("Laptop battery not present");
2875++ }
2876++ if (state == UP_DEVICE_STATE_CHARGING) {
2877++ /* TRANSLATORS: battery state */
2878++ return _("Laptop battery is charging");
2879++ }
2880++ if (state == UP_DEVICE_STATE_DISCHARGING) {
2881++ /* TRANSLATORS: battery state */
2882++ return _("Laptop battery is discharging");
2883++ }
2884++ if (state == UP_DEVICE_STATE_EMPTY) {
2885++ /* TRANSLATORS: battery state */
2886++ return _("Laptop battery is empty");
2887++ }
2888++ if (state == UP_DEVICE_STATE_FULLY_CHARGED) {
2889++ /* TRANSLATORS: battery state */
2890++ return _("Laptop battery is charged");
2891++ }
2892++ if (state == UP_DEVICE_STATE_PENDING_CHARGE) {
2893++ /* TRANSLATORS: battery state */
2894++ return _("Laptop battery is waiting to charge");
2895++ }
2896++ if (state == UP_DEVICE_STATE_PENDING_DISCHARGE) {
2897++ /* TRANSLATORS: battery state */
2898++ return _("Laptop battery is waiting to discharge");
2899++ }
2900++ }
2901++
2902++ /* UPS */
2903++ if (kind == UP_DEVICE_KIND_UPS) {
2904++
2905++ if (state == UP_DEVICE_STATE_CHARGING) {
2906++ /* TRANSLATORS: battery state */
2907++ return _("UPS is charging");
2908++ }
2909++ if (state == UP_DEVICE_STATE_DISCHARGING) {
2910++ /* TRANSLATORS: battery state */
2911++ return _("UPS is discharging");
2912++ }
2913++ if (state == UP_DEVICE_STATE_EMPTY) {
2914++ /* TRANSLATORS: battery state */
2915++ return _("UPS is empty");
2916++ }
2917++ if (state == UP_DEVICE_STATE_FULLY_CHARGED) {
2918++ /* TRANSLATORS: battery state */
2919++ return _("UPS is charged");
2920++ }
2921++ }
2922++
2923++ /* mouse */
2924++ if (kind == UP_DEVICE_KIND_MOUSE) {
2925++
2926++ if (state == UP_DEVICE_STATE_CHARGING) {
2927++ /* TRANSLATORS: battery state */
2928++ return _("Mouse is charging");
2929++ }
2930++ if (state == UP_DEVICE_STATE_DISCHARGING) {
2931++ /* TRANSLATORS: battery state */
2932++ return _("Mouse is discharging");
2933++ }
2934++ if (state == UP_DEVICE_STATE_EMPTY) {
2935++ /* TRANSLATORS: battery state */
2936++ return _("Mouse is empty");
2937++ }
2938++ if (state == UP_DEVICE_STATE_FULLY_CHARGED) {
2939++ /* TRANSLATORS: battery state */
2940++ return _("Mouse is charged");
2941++ }
2942++ }
2943++
2944++ /* keyboard */
2945++ if (kind == UP_DEVICE_KIND_KEYBOARD) {
2946++
2947++ if (state == UP_DEVICE_STATE_CHARGING) {
2948++ /* TRANSLATORS: battery state */
2949++ return _("Keyboard is charging");
2950++ }
2951++ if (state == UP_DEVICE_STATE_DISCHARGING) {
2952++ /* TRANSLATORS: battery state */
2953++ return _("Keyboard is discharging");
2954++ }
2955++ if (state == UP_DEVICE_STATE_EMPTY) {
2956++ /* TRANSLATORS: battery state */
2957++ return _("Keyboard is empty");
2958++ }
2959++ if (state == UP_DEVICE_STATE_FULLY_CHARGED) {
2960++ /* TRANSLATORS: battery state */
2961++ return _("Keyboard is charged");
2962++ }
2963++ }
2964++
2965++ /* PDA */
2966++ if (kind == UP_DEVICE_KIND_PDA) {
2967++
2968++ if (state == UP_DEVICE_STATE_CHARGING) {
2969++ /* TRANSLATORS: battery state */
2970++ return _("PDA is charging");
2971++ }
2972++ if (state == UP_DEVICE_STATE_DISCHARGING) {
2973++ /* TRANSLATORS: battery state */
2974++ return _("PDA is discharging");
2975++ }
2976++ if (state == UP_DEVICE_STATE_EMPTY) {
2977++ /* TRANSLATORS: battery state */
2978++ return _("PDA is empty");
2979++ }
2980++ if (state == UP_DEVICE_STATE_FULLY_CHARGED) {
2981++ /* TRANSLATORS: battery state */
2982++ return _("PDA is charged");
2983++ }
2984++ }
2985++
2986++ /* phone */
2987++ if (kind == UP_DEVICE_KIND_PHONE) {
2988++
2989++ if (state == UP_DEVICE_STATE_CHARGING) {
2990++ /* TRANSLATORS: battery state */
2991++ return _("Cell phone is charging");
2992++ }
2993++ if (state == UP_DEVICE_STATE_DISCHARGING) {
2994++ /* TRANSLATORS: battery state */
2995++ return _("Cell phone is discharging");
2996++ }
2997++ if (state == UP_DEVICE_STATE_EMPTY) {
2998++ /* TRANSLATORS: battery state */
2999++ return _("Cell phone is empty");
3000++ }
3001++ if (state == UP_DEVICE_STATE_FULLY_CHARGED) {
3002++ /* TRANSLATORS: battery state */
3003++ return _("Cell phone is charged");
3004++ }
3005++ }
3006++#if UP_CHECK_VERSION(0,9,5)
3007++
3008++ /* media player */
3009++ if (kind == UP_DEVICE_KIND_MEDIA_PLAYER) {
3010++
3011++ if (state == UP_DEVICE_STATE_CHARGING) {
3012++ /* TRANSLATORS: battery state */
3013++ return _("Media player is charging");
3014++ }
3015++ if (state == UP_DEVICE_STATE_DISCHARGING) {
3016++ /* TRANSLATORS: battery state */
3017++ return _("Media player is discharging");
3018++ }
3019++ if (state == UP_DEVICE_STATE_EMPTY) {
3020++ /* TRANSLATORS: battery state */
3021++ return _("Media player is empty");
3022++ }
3023++ if (state == UP_DEVICE_STATE_FULLY_CHARGED) {
3024++ /* TRANSLATORS: battery state */
3025++ return _("Media player is charged");
3026++ }
3027++ }
3028++
3029++ /* tablet */
3030++ if (kind == UP_DEVICE_KIND_TABLET) {
3031++
3032++ if (state == UP_DEVICE_STATE_CHARGING) {
3033++ /* TRANSLATORS: battery state */
3034++ return _("Tablet is charging");
3035++ }
3036++ if (state == UP_DEVICE_STATE_DISCHARGING) {
3037++ /* TRANSLATORS: battery state */
3038++ return _("Tablet is discharging");
3039++ }
3040++ if (state == UP_DEVICE_STATE_EMPTY) {
3041++ /* TRANSLATORS: battery state */
3042++ return _("Tablet is empty");
3043++ }
3044++ if (state == UP_DEVICE_STATE_FULLY_CHARGED) {
3045++ /* TRANSLATORS: battery state */
3046++ return _("Tablet is charged");
3047++ }
3048++ }
3049++
3050++ /* computer */
3051++ if (kind == UP_DEVICE_KIND_COMPUTER) {
3052++
3053++ if (state == UP_DEVICE_STATE_CHARGING) {
3054++ /* TRANSLATORS: battery state */
3055++ return _("Computer is charging");
3056++ }
3057++ if (state == UP_DEVICE_STATE_DISCHARGING) {
3058++ /* TRANSLATORS: battery state */
3059++ return _("Computer is discharging");
3060++ }
3061++ if (state == UP_DEVICE_STATE_EMPTY) {
3062++ /* TRANSLATORS: battery state */
3063++ return _("Computer is empty");
3064++ }
3065++ if (state == UP_DEVICE_STATE_FULLY_CHARGED) {
3066++ /* TRANSLATORS: battery state */
3067++ return _("Computer is charged");
3068++ }
3069++ }
3070++#endif
3071++
3072++ return gpm_device_kind_to_localised_string (kind, 1);
3073++}
3074++
3075+ static gboolean
3076+ parse_vm_kernel_cmdline (gboolean *is_virtual_machine)
3077+ {
3078+@@ -576,7 +1462,7 @@ backlight_get_max (GnomeRRScreen *rr_scr
3079+
3080+ gboolean
3081+ backlight_set_percentage (GnomeRRScreen *rr_screen,
3082+- gint *value,
3083++ guint value,
3084+ GError **error)
3085+ {
3086+ GnomeRROutput *output;
3087+@@ -587,23 +1473,17 @@ backlight_set_percentage (GnomeRRScreen
3088+
3089+ /* prefer xbacklight */
3090+ output = get_primary_output (rr_screen);
3091+- if (output != NULL) {
3092+- if (!gnome_rr_output_set_backlight (output, *value, error))
3093+- return ret;
3094+- *value = gnome_rr_output_get_backlight (output);
3095+- return TRUE;
3096+- }
3097++ if (output != NULL)
3098++ return gnome_rr_output_set_backlight (output, value, error);
3099+
3100+ /* fall back to the polkit helper */
3101+ max = backlight_helper_get_value ("get-max-brightness", error);
3102+ if (max < 0)
3103+ return ret;
3104+- discrete = PERCENTAGE_TO_ABS (min, max, *value);
3105++ discrete = PERCENTAGE_TO_ABS (min, max, value);
3106+ ret = backlight_helper_set_value ("set-brightness",
3107+ discrete,
3108+ error);
3109+- if (ret)
3110+- *value = ABS_TO_PERCENTAGE (min, max, discrete);
3111+
3112+ return ret;
3113+ }
3114+@@ -639,7 +1519,7 @@ backlight_step_up (GnomeRRScreen *rr_scr
3115+ now = gnome_rr_output_get_backlight (output);
3116+ if (now < 0)
3117+ return percentage_value;
3118+- step = MAX(gnome_rr_output_get_min_backlight_step (output), BRIGHTNESS_STEP_AMOUNT(max - min + 1));
3119++ step = BRIGHTNESS_STEP_AMOUNT (max - min + 1);
3120+ discrete = MIN (now + step, max);
3121+ ret = gnome_rr_output_set_backlight (output,
3122+ discrete,
3123+@@ -698,7 +1578,7 @@ backlight_step_down (GnomeRRScreen *rr_s
3124+ now = gnome_rr_output_get_backlight (output);
3125+ if (now < 0)
3126+ return percentage_value;
3127+- step = MAX (gnome_rr_output_get_min_backlight_step (output), BRIGHTNESS_STEP_AMOUNT (max - min + 1));
3128++ step = BRIGHTNESS_STEP_AMOUNT (max - min + 1);
3129+ discrete = MAX (now - step, 0);
3130+ ret = gnome_rr_output_set_backlight (output,
3131+ discrete,
3132+Index: gnome-settings-daemon/plugins/power/gpm-common.h
3133+===================================================================
3134+--- gnome-settings-daemon.orig/plugins/power/gpm-common.h
3135++++ gnome-settings-daemon/plugins/power/gpm-common.h
3136+@@ -29,6 +29,16 @@ G_BEGIN_DECLS
3137+
3138+ /* UPower helpers */
3139+ gchar *gpm_get_timestring (guint time);
3140++const gchar *gpm_device_to_localised_string (UpDevice *device);
3141++const gchar *gpm_device_kind_to_localised_string (UpDeviceKind kind,
3142++ guint number);
3143++const gchar *gpm_device_kind_to_icon (UpDeviceKind kind);
3144++const gchar *gpm_device_technology_to_localised_string (UpDeviceTechnology technology_enum);
3145++const gchar *gpm_device_state_to_localised_string (UpDeviceState state);
3146++GIcon *gpm_upower_get_device_icon (UpDevice *device,
3147++ gboolean use_symbolic);
3148++gchar *gpm_upower_get_device_summary (UpDevice *device);
3149++gchar *gpm_upower_get_device_description (UpDevice *device);
3150+
3151+ /* Power helpers */
3152+ gboolean gsd_power_is_hardware_a_vm (void);
3153+@@ -50,7 +60,7 @@ int backlight_get_percentag
3154+ int backlight_get_min (GnomeRRScreen *rr_screen);
3155+ int backlight_get_max (GnomeRRScreen *rr_screen, GError **error);
3156+ gboolean backlight_set_percentage (GnomeRRScreen *rr_screen,
3157+- gint *value,
3158++ guint value,
3159+ GError **error);
3160+ int backlight_step_up (GnomeRRScreen *rr_screen, GError **error);
3161+ int backlight_step_down (GnomeRRScreen *rr_screen, GError **error);
3162+Index: gnome-settings-daemon/plugins/power/gsd-power-constants.h
3163+===================================================================
3164+--- gnome-settings-daemon.orig/plugins/power/gsd-power-constants.h
3165++++ gnome-settings-daemon/plugins/power/gsd-power-constants.h
3166+@@ -13,7 +13,8 @@
3167+ * GNU General Public License for more details.
3168+ *
3169+ * You should have received a copy of the GNU General Public License
3170+- * along with this program; if not, see <http://www.gnu.org/licenses/>.
3171++ * along with this program; if not, write to the Free Software
3172++ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
3173+ *
3174+ */
3175+
3176+Index: gnome-settings-daemon/plugins/power/gsd-power-manager.c
3177+===================================================================
3178+--- gnome-settings-daemon.orig/plugins/power/gsd-power-manager.c
3179++++ gnome-settings-daemon/plugins/power/gsd-power-manager.c
3180+@@ -16,7 +16,8 @@
3181+ * GNU General Public License for more details.
3182+ *
3183+ * You should have received a copy of the GNU General Public License
3184+- * along with this program; if not, see <http://www.gnu.org/licenses/>.
3185++ * along with this program; if not, write to the Free Software
3186++ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
3187+ *
3188+ */
3189+
3190+@@ -71,17 +72,31 @@
3191+ #define GSD_POWER_MANAGER_NOTIFY_TIMEOUT_SHORT 10 * 1000 /* ms */
3192+ #define GSD_POWER_MANAGER_NOTIFY_TIMEOUT_LONG 30 * 1000 /* ms */
3193+
3194++#define GSD_POWER_MANAGER_RECALL_DELAY 30 /* seconds */
3195++
3196+ #define SYSTEMD_DBUS_NAME "org.freedesktop.login1"
3197+ #define SYSTEMD_DBUS_PATH "/org/freedesktop/login1"
3198+ #define SYSTEMD_DBUS_INTERFACE "org.freedesktop.login1.Manager"
3199+
3200+-/* Time between notifying the user about a critical action and the action itself in UPower. */
3201++/* Time between notifying the user about a critical action and executing it.
3202++ * This can be changed with the GSD_ACTION_DELAY constant. */
3203++#ifndef GSD_ACTION_DELAY
3204+ #define GSD_ACTION_DELAY 20
3205+-/* And the time before we stop the warning sound */
3206+-#define GSD_STOP_SOUND_DELAY GSD_ACTION_DELAY - 2
3207++#endif /* !GSD_ACTION_DELAY */
3208+
3209+ static const gchar introspection_xml[] =
3210+ "<node>"
3211++" <interface name='org.gnome.SettingsDaemon.Power'>"
3212++" <property name='Icon' type='s' access='read'/>"
3213++" <property name='Tooltip' type='s' access='read'/>"
3214++" <property name='Percentage' type='d' access='read'/>"
3215++" <method name='GetPrimaryDevice'>"
3216++" <arg name='device' type='(susdut)' direction='out' />"
3217++" </method>"
3218++" <method name='GetDevices'>"
3219++" <arg name='devices' type='a(susdut)' direction='out' />"
3220++" </method>"
3221++" </interface>"
3222+ " <interface name='org.gnome.SettingsDaemon.Power.Screen'>"
3223+ " <property name='Brightness' type='i' access='readwrite'/>"
3224+ " <method name='StepUp'>"
3225+@@ -130,6 +145,14 @@ struct GsdPowerManagerPrivate
3226+ GSettings *settings_screensaver;
3227+ GSettings *settings_xrandr;
3228+
3229++ gboolean use_time_primary;
3230++ guint action_percentage;
3231++ guint action_time;
3232++ guint critical_percentage;
3233++ guint critical_time;
3234++ guint low_percentage;
3235++ guint low_time;
3236++
3237+ /* Screensaver */
3238+ GsdScreenSaver *screensaver_proxy;
3239+ gboolean screensaver_active;
3240+@@ -138,12 +161,15 @@ struct GsdPowerManagerPrivate
3241+ gboolean lid_is_present;
3242+ gboolean lid_is_closed;
3243+ UpClient *up_client;
3244++ gchar *previous_summary;
3245++ GIcon *previous_icon;
3246+ GPtrArray *devices_array;
3247+ UpDevice *device_composite;
3248+ GnomeRRScreen *rr_screen;
3249+ NotifyNotification *notification_ups_discharging;
3250+ NotifyNotification *notification_low;
3251+ NotifyNotification *notification_sleep_warning;
3252++ NotifyNotification *notification_logout_warning;
3253+ GsdPowerActionType sleep_action_type;
3254+ gboolean battery_is_low; /* laptop battery low, or UPS discharging */
3255+
3256+@@ -191,7 +217,11 @@ enum {
3257+ static void gsd_power_manager_class_init (GsdPowerManagerClass *klass);
3258+ static void gsd_power_manager_init (GsdPowerManager *power_manager);
3259+
3260+-static void engine_device_warning_changed_cb (UpDevice *device, GParamSpec *pspec, GsdPowerManager *manager);
3261++static void engine_device_changed_cb (UpClient *client, UpDevice *device, GsdPowerManager *manager);
3262++static void engine_update_composite_device (GsdPowerManager *manager);
3263++static GIcon *engine_get_icon (GsdPowerManager *manager);
3264++static gchar *engine_get_summary (GsdPowerManager *manager);
3265++static gdouble engine_get_percentage (GsdPowerManager *manager);
3266+ static void do_power_action_type (GsdPowerManager *manager, GsdPowerActionType action_type);
3267+ static void uninhibit_lid_switch (GsdPowerManager *manager);
3268+ static void stop_inhibit_lid_switch_timer (GsdPowerManager *manager);
3269+@@ -222,24 +252,738 @@ notify_close_if_showing (NotifyNotificat
3270+ g_clear_object (notification);
3271+ }
3272+
3273++typedef enum {
3274++ WARNING_NONE = 0,
3275++ WARNING_DISCHARGING = 1,
3276++ WARNING_LOW = 2,
3277++ WARNING_CRITICAL = 3,
3278++ WARNING_ACTION = 4
3279++} GsdPowerManagerWarning;
3280++
3281++static GVariant *
3282++engine_get_icon_property_variant (GsdPowerManager *manager)
3283++{
3284++ GIcon *icon;
3285++ GVariant *retval;
3286++
3287++ icon = engine_get_icon (manager);
3288++ if (icon != NULL) {
3289++ char *str;
3290++ str = g_icon_to_string (icon);
3291++ g_object_unref (icon);
3292++ retval = g_variant_new_string (str);
3293++ g_free (str);
3294++ } else {
3295++ retval = g_variant_new_string ("");
3296++ }
3297++ return retval;
3298++}
3299++
3300++static GVariant *
3301++engine_get_tooltip_property_variant (GsdPowerManager *manager)
3302++{
3303++ char *tooltip;
3304++ GVariant *retval;
3305++
3306++ tooltip = engine_get_summary (manager);
3307++ retval = g_variant_new_string (tooltip != NULL ? tooltip : "");
3308++ g_free (tooltip);
3309++
3310++ return retval;
3311++}
3312++
3313+ static void
3314+-engine_device_add (GsdPowerManager *manager, UpDevice *device)
3315++engine_emit_changed (GsdPowerManager *manager,
3316++ gboolean icon_changed,
3317++ gboolean state_changed)
3318++{
3319++ GVariantBuilder props_builder;
3320++ GVariant *props_changed = NULL;
3321++ GError *error = NULL;
3322++
3323++ /* not yet connected to the bus */
3324++ if (manager->priv->connection == NULL)
3325++ return;
3326++
3327++ g_variant_builder_init (&props_builder, G_VARIANT_TYPE ("a{sv}"));
3328++
3329++ if (icon_changed)
3330++ g_variant_builder_add (&props_builder, "{sv}", "Icon",
3331++ engine_get_icon_property_variant (manager));
3332++ if (state_changed)
3333++ g_variant_builder_add (&props_builder, "{sv}", "Tooltip",
3334++ engine_get_tooltip_property_variant (manager));
3335++ g_variant_builder_add (&props_builder, "{sv}", "Percentage",
3336++ g_variant_new_double (engine_get_percentage (manager)));
3337++
3338++ props_changed = g_variant_new ("(s@a{sv}@as)", GSD_POWER_DBUS_INTERFACE,
3339++ g_variant_builder_end (&props_builder),
3340++ g_variant_new_strv (NULL, 0));
3341++ g_variant_ref_sink (props_changed);
3342++
3343++ if (!g_dbus_connection_emit_signal (manager->priv->connection,
3344++ NULL,
3345++ GSD_POWER_DBUS_PATH,
3346++ "org.freedesktop.DBus.Properties",
3347++ "PropertiesChanged",
3348++ props_changed,
3349++ &error))
3350++ goto out;
3351++
3352++ out:
3353++ if (error) {
3354++ g_warning ("%s", error->message);
3355++ g_clear_error (&error);
3356++ }
3357++ if (props_changed)
3358++ g_variant_unref (props_changed);
3359++}
3360++
3361++static GsdPowerManagerWarning
3362++engine_get_warning_csr (GsdPowerManager *manager, UpDevice *device)
3363++{
3364++ gdouble percentage;
3365++
3366++ /* get device properties */
3367++ g_object_get (device, "percentage", &percentage, NULL);
3368++
3369++ if (percentage < 26.0f)
3370++ return WARNING_LOW;
3371++ else if (percentage < 13.0f)
3372++ return WARNING_CRITICAL;
3373++ return WARNING_NONE;
3374++}
3375++
3376++static GsdPowerManagerWarning
3377++engine_get_warning_percentage (GsdPowerManager *manager, UpDevice *device)
3378++{
3379++ gdouble percentage;
3380++
3381++ /* get device properties */
3382++ g_object_get (device, "percentage", &percentage, NULL);
3383++
3384++ if (percentage <= manager->priv->action_percentage)
3385++ return WARNING_ACTION;
3386++ if (percentage <= manager->priv->critical_percentage)
3387++ return WARNING_CRITICAL;
3388++ if (percentage <= manager->priv->low_percentage)
3389++ return WARNING_LOW;
3390++ return WARNING_NONE;
3391++}
3392++
3393++static GsdPowerManagerWarning
3394++engine_get_warning_time (GsdPowerManager *manager, UpDevice *device)
3395++{
3396++ UpDeviceKind kind;
3397++ gint64 time_to_empty;
3398++
3399++ /* get device properties */
3400++ g_object_get (device,
3401++ "kind", &kind,
3402++ "time-to-empty", &time_to_empty,
3403++ NULL);
3404++
3405++ /* this is probably an error condition */
3406++ if (time_to_empty == 0) {
3407++ g_debug ("time zero, falling back to percentage for %s",
3408++ up_device_kind_to_string (kind));
3409++ return engine_get_warning_percentage (manager, device);
3410++ }
3411++
3412++ if (time_to_empty <= manager->priv->action_time)
3413++ return WARNING_ACTION;
3414++ if (time_to_empty <= manager->priv->critical_time)
3415++ return WARNING_CRITICAL;
3416++ if (time_to_empty <= manager->priv->low_time)
3417++ return WARNING_LOW;
3418++ return WARNING_NONE;
3419++}
3420++
3421++/**
3422++ * This gets the possible engine state for the device according to the
3423++ * policy, which could be per-percent, or per-time.
3424++ **/
3425++static GsdPowerManagerWarning
3426++engine_get_warning (GsdPowerManager *manager, UpDevice *device)
3427++{
3428++ UpDeviceKind kind;
3429++ UpDeviceState state;
3430++ GsdPowerManagerWarning warning_type;
3431++
3432++ /* get device properties */
3433++ g_object_get (device,
3434++ "kind", &kind,
3435++ "state", &state,
3436++ NULL);
3437++
3438++ /* default to no engine */
3439++ warning_type = WARNING_NONE;
3440++
3441++ /* if the device in question is on ac, don't give a warning */
3442++ if (state == UP_DEVICE_STATE_CHARGING)
3443++ goto out;
3444++
3445++ if (kind == UP_DEVICE_KIND_MOUSE ||
3446++ kind == UP_DEVICE_KIND_KEYBOARD) {
3447++
3448++ warning_type = engine_get_warning_csr (manager, device);
3449++
3450++ } else if (kind == UP_DEVICE_KIND_UPS ||
3451++ kind == UP_DEVICE_KIND_MEDIA_PLAYER ||
3452++ kind == UP_DEVICE_KIND_TABLET ||
3453++ kind == UP_DEVICE_KIND_COMPUTER ||
3454++ kind == UP_DEVICE_KIND_PDA) {
3455++
3456++ warning_type = engine_get_warning_percentage (manager, device);
3457++
3458++ } else if (kind == UP_DEVICE_KIND_PHONE) {
3459++
3460++ warning_type = engine_get_warning_percentage (manager, device);
3461++
3462++ } else if (kind == UP_DEVICE_KIND_BATTERY) {
3463++ /* only use the time when it is accurate, and settings is not disabled */
3464++ if (manager->priv->use_time_primary)
3465++ warning_type = engine_get_warning_time (manager, device);
3466++ else
3467++ warning_type = engine_get_warning_percentage (manager, device);
3468++ }
3469++
3470++ /* If we have no important engines, we should test for discharging */
3471++ if (warning_type == WARNING_NONE) {
3472++ if (state == UP_DEVICE_STATE_DISCHARGING)
3473++ warning_type = WARNING_DISCHARGING;
3474++ }
3475++
3476++ out:
3477++ return warning_type;
3478++}
3479++
3480++static gchar *
3481++engine_get_summary (GsdPowerManager *manager)
3482++{
3483++ guint i;
3484++ GPtrArray *array;
3485++ UpDevice *device;
3486++ UpDeviceState state;
3487++ GString *tooltip = NULL;
3488++ gchar *part;
3489++ gboolean is_present;
3490++
3491++
3492++ /* need to get AC state */
3493++ tooltip = g_string_new ("");
3494++
3495++ /* do we have specific device types? */
3496++ array = manager->priv->devices_array;
3497++ for (i=0;i<array->len;i++) {
3498++ device = g_ptr_array_index (array, i);
3499++ g_object_get (device,
3500++ "is-present", &is_present,
3501++ "state", &state,
3502++ NULL);
3503++ if (!is_present)
3504++ continue;
3505++ if (state == UP_DEVICE_STATE_EMPTY)
3506++ continue;
3507++ part = gpm_upower_get_device_summary (device);
3508++ if (part != NULL)
3509++ g_string_append_printf (tooltip, "%s\n", part);
3510++ g_free (part);
3511++ }
3512++
3513++ /* remove the last \n */
3514++ g_string_truncate (tooltip, tooltip->len-1);
3515++
3516++ g_debug ("tooltip: %s", tooltip->str);
3517++
3518++ return g_string_free (tooltip, FALSE);
3519++}
3520++
3521++static gdouble
3522++engine_get_percentage (GsdPowerManager *manager)
3523++{
3524++ gboolean is_present;
3525++ gdouble percentage;
3526++
3527++ g_object_get (manager->priv->device_composite,
3528++ "percentage", &percentage,
3529++ "is-present", &is_present,
3530++ NULL);
3531++
3532++ if (is_present)
3533++ return percentage;
3534++ else
3535++ return -1;
3536++}
3537++
3538++static GIcon *
3539++engine_get_icon_priv (GsdPowerManager *manager,
3540++ UpDeviceKind device_kind,
3541++ GsdPowerManagerWarning warning,
3542++ gboolean use_state)
3543+ {
3544++ guint i;
3545++ GPtrArray *array;
3546++ UpDevice *device;
3547++ GsdPowerManagerWarning warning_temp;
3548+ UpDeviceKind kind;
3549++ UpDeviceState state;
3550++ gboolean is_present;
3551+
3552+- /* Batteries and UPSes are already handled through
3553+- * the composite battery */
3554+- g_object_get (device, "kind", &kind, NULL);
3555+- if (kind == UP_DEVICE_KIND_BATTERY ||
3556+- kind == UP_DEVICE_KIND_UPS ||
3557+- kind == UP_DEVICE_KIND_LINE_POWER)
3558++ /* do we have specific device types? */
3559++ array = manager->priv->devices_array;
3560++ for (i=0;i<array->len;i++) {
3561++ device = g_ptr_array_index (array, i);
3562++
3563++ /* get device properties */
3564++ g_object_get (device,
3565++ "kind", &kind,
3566++ "state", &state,
3567++ "is-present", &is_present,
3568++ NULL);
3569++
3570++ /* if battery then use composite device to cope with multiple batteries */
3571++ if (kind == UP_DEVICE_KIND_BATTERY)
3572++ device = manager->priv->device_composite;
3573++
3574++ warning_temp = GPOINTER_TO_INT(g_object_get_data (G_OBJECT(device),
3575++ "engine-warning-old"));
3576++ if (kind == device_kind && is_present) {
3577++ if (warning != WARNING_NONE) {
3578++ if (warning_temp == warning)
3579++ return gpm_upower_get_device_icon (device, TRUE);
3580++ continue;
3581++ }
3582++ if (use_state) {
3583++ if (state == UP_DEVICE_STATE_CHARGING ||
3584++ state == UP_DEVICE_STATE_DISCHARGING)
3585++ return gpm_upower_get_device_icon (device, TRUE);
3586++ continue;
3587++ }
3588++ return gpm_upower_get_device_icon (device, TRUE);
3589++ }
3590++ }
3591++ return NULL;
3592++}
3593++
3594++static GIcon *
3595++engine_get_icon (GsdPowerManager *manager)
3596++{
3597++ GIcon *icon = NULL;
3598++
3599++
3600++ /* we try CRITICAL: BATTERY, UPS */
3601++ icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_BATTERY, WARNING_CRITICAL, FALSE);
3602++ if (icon != NULL)
3603++ return icon;
3604++ icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_UPS, WARNING_CRITICAL, FALSE);
3605++ if (icon != NULL)
3606++ return icon;
3607++
3608++ /* we try CRITICAL: BATTERY, UPS */
3609++ icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_BATTERY, WARNING_LOW, FALSE);
3610++ if (icon != NULL)
3611++ return icon;
3612++ icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_UPS, WARNING_LOW, FALSE);
3613++ if (icon != NULL)
3614++ return icon;
3615++
3616++ /* we try (DIS)CHARGING: BATTERY, UPS */
3617++ icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_BATTERY, WARNING_NONE, TRUE);
3618++ if (icon != NULL)
3619++ return icon;
3620++ icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_UPS, WARNING_NONE, TRUE);
3621++ if (icon != NULL)
3622++ return icon;
3623++
3624++ /* we try PRESENT: BATTERY, UPS */
3625++ icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_BATTERY, WARNING_NONE, FALSE);
3626++ if (icon != NULL)
3627++ return icon;
3628++ icon = engine_get_icon_priv (manager, UP_DEVICE_KIND_UPS, WARNING_NONE, FALSE);
3629++ if (icon != NULL)
3630++ return icon;
3631++
3632++ /* do not show an icon */
3633++ return NULL;
3634++}
3635++
3636++static gboolean
3637++engine_recalculate_state_icon (GsdPowerManager *manager)
3638++{
3639++ GIcon *icon;
3640++
3641++ /* show a different icon if we are disconnected */
3642++ icon = engine_get_icon (manager);
3643++
3644++ if (g_icon_equal (icon, manager->priv->previous_icon)) {
3645++ g_clear_object (&icon);
3646++ return FALSE;
3647++ }
3648++
3649++ g_clear_object (&manager->priv->previous_icon);
3650++ manager->priv->previous_icon = icon;
3651++
3652++ g_debug ("Icon changed");
3653++
3654++ return TRUE;
3655++}
3656++
3657++static gboolean
3658++engine_recalculate_state_summary (GsdPowerManager *manager)
3659++{
3660++ char *summary;
3661++
3662++ summary = engine_get_summary (manager);
3663++
3664++ if (g_strcmp0 (manager->priv->previous_summary, summary) == 0) {
3665++ g_free (summary);
3666++ return FALSE;
3667++ }
3668++
3669++ g_free (manager->priv->previous_summary);
3670++ manager->priv->previous_summary = summary;
3671++
3672++ g_debug ("Summary changed");
3673++
3674++ return TRUE;
3675++}
3676++
3677++static void
3678++engine_recalculate_state (GsdPowerManager *manager)
3679++{
3680++ gboolean icon_changed = FALSE;
3681++ gboolean state_changed = FALSE;
3682++
3683++ icon_changed = engine_recalculate_state_icon (manager);
3684++ state_changed = engine_recalculate_state_summary (manager);
3685++
3686++ /* only emit if the icon or summary has changed */
3687++ if (icon_changed || state_changed)
3688++ engine_emit_changed (manager, icon_changed, state_changed);
3689++}
3690++
3691++static void
3692++engine_update_composite_device (GsdPowerManager *manager)
3693++{
3694++ guint i;
3695++ gdouble percentage = 0.0;
3696++ gdouble energy_total = 0.0;
3697++ gdouble energy_full_total = 0.0;
3698++ gdouble energy_rate_total = 0.0;
3699++ gint64 time_to_empty_total = 0;
3700++ gint64 time_to_full_total = 0;
3701++ guint battery_devices = 0;
3702++ gboolean is_charging = FALSE;
3703++ gboolean is_discharging = FALSE;
3704++ gboolean is_fully_charged = TRUE;
3705++ GPtrArray *array;
3706++ UpDevice *device;
3707++ UpDeviceState state;
3708++
3709++ /* update the composite device */
3710++ array = manager->priv->devices_array;
3711++ for (i=0;i<array->len;i++) {
3712++ UpDeviceKind kind;
3713++ gdouble energy = 0.0;
3714++ gdouble energy_full = 0.0;
3715++ gdouble energy_rate = 0.0;
3716++ gint64 time_to_empty = 0;
3717++ gint64 time_to_full = 0;
3718++
3719++ device = g_ptr_array_index (array, i);
3720++ g_object_get (device,
3721++ "kind", &kind,
3722++ "state", &state,
3723++ "energy", &energy,
3724++ "energy-full", &energy_full,
3725++ "energy-rate", &energy_rate,
3726++ "time-to-empty", &time_to_empty,
3727++ "time-to-full", &time_to_full,
3728++ NULL);
3729++ if (kind != UP_DEVICE_KIND_BATTERY)
3730++ continue;
3731++
3732++ /* one of these will be charging or discharging */
3733++ if (state == UP_DEVICE_STATE_CHARGING)
3734++ is_charging = TRUE;
3735++ else if (state == UP_DEVICE_STATE_DISCHARGING)
3736++ is_discharging = TRUE;
3737++ else if (state != UP_DEVICE_STATE_FULLY_CHARGED)
3738++ is_fully_charged = FALSE;
3739++
3740++ /* sum up composite */
3741++ energy_total += energy;
3742++ energy_full_total += energy_full;
3743++ energy_rate_total += energy_rate;
3744++ time_to_empty_total += time_to_empty;
3745++ time_to_full_total += time_to_full;
3746++ battery_devices++;
3747++ }
3748++
3749++ if (battery_devices == 0) {
3750++ state = UP_DEVICE_STATE_UNKNOWN;
3751++ goto out;
3752++ }
3753++
3754++ /* use percentage weighted for each battery capacity */
3755++ if (energy_full_total > 0.0)
3756++ percentage = 100.0 * energy_total / energy_full_total;
3757++
3758++ /* set composite state */
3759++ if (is_discharging)
3760++ state = UP_DEVICE_STATE_DISCHARGING;
3761++ else if (is_charging)
3762++ state = UP_DEVICE_STATE_CHARGING;
3763++ else if (is_fully_charged)
3764++ state = UP_DEVICE_STATE_FULLY_CHARGED;
3765++ else
3766++ state = UP_DEVICE_STATE_UNKNOWN;
3767++
3768++ if (battery_devices == 1)
3769++ goto out;
3770++
3771++ /* calculate a quick and dirty time remaining value */
3772++ if (energy_rate_total > 0) {
3773++ if (state == UP_DEVICE_STATE_DISCHARGING)
3774++ time_to_empty_total = 3600 * (energy_total / energy_rate_total);
3775++ else if (state == UP_DEVICE_STATE_CHARGING)
3776++ time_to_full_total = 3600 * ((energy_full_total - energy_total) / energy_rate_total);
3777++ }
3778++
3779++ out:
3780++ g_debug ("printing composite device");
3781++ g_object_set (manager->priv->device_composite,
3782++ "energy", energy_total,
3783++ "energy-full", energy_full_total,
3784++ "energy-rate", energy_rate_total,
3785++ "time-to-empty", time_to_empty_total,
3786++ "time-to-full", time_to_full_total,
3787++ "percentage", percentage,
3788++ "state", state,
3789++ "is-present", (battery_devices > 0),
3790++ NULL);
3791++
3792++ /* force update of icon */
3793++ if (engine_recalculate_state_icon (manager))
3794++ engine_emit_changed (manager, TRUE, FALSE);
3795++}
3796++
3797++typedef struct {
3798++ GsdPowerManager *manager;
3799++ UpDevice *device;
3800++} GsdPowerManagerRecallData;
3801++
3802++static void
3803++device_perhaps_recall_response_cb (GtkDialog *dialog,
3804++ gint response_id,
3805++ GsdPowerManagerRecallData *recall_data)
3806++{
3807++ GdkScreen *screen;
3808++ GtkWidget *dialog_error;
3809++ GError *error = NULL;
3810++ gboolean ret;
3811++ gchar *website = NULL;
3812++
3813++ /* don't show this again */
3814++ if (response_id == GTK_RESPONSE_CANCEL) {
3815++ g_settings_set_boolean (recall_data->manager->priv->settings,
3816++ "notify-perhaps-recall",
3817++ FALSE);
3818++ goto out;
3819++ }
3820++
3821++ /* visit recall website */
3822++ if (response_id == GTK_RESPONSE_OK) {
3823++
3824++ g_object_get (recall_data->device,
3825++ "recall-url", &website,
3826++ NULL);
3827++
3828++ screen = gdk_screen_get_default();
3829++ ret = gtk_show_uri (screen,
3830++ website,
3831++ gtk_get_current_event_time (),
3832++ &error);
3833++ if (!ret) {
3834++ dialog_error = gtk_message_dialog_new (NULL,
3835++ GTK_DIALOG_MODAL,
3836++ GTK_MESSAGE_INFO,
3837++ GTK_BUTTONS_OK,
3838++ "Failed to show url %s",
3839++ error->message);
3840++ gtk_dialog_run (GTK_DIALOG (dialog_error));
3841++ g_error_free (error);
3842++ }
3843++ }
3844++out:
3845++ gtk_widget_destroy (GTK_WIDGET (dialog));
3846++ g_object_unref (recall_data->device);
3847++ g_object_unref (recall_data->manager);
3848++ g_free (recall_data);
3849++ g_free (website);
3850++ return;
3851++}
3852++
3853++static gboolean
3854++device_perhaps_recall_delay_cb (gpointer user_data)
3855++{
3856++ gchar *vendor;
3857++ const gchar *title = NULL;
3858++ GString *message = NULL;
3859++ GtkWidget *dialog;
3860++ GsdPowerManagerRecallData *recall_data = (GsdPowerManagerRecallData *) user_data;
3861++
3862++ g_object_get (recall_data->device,
3863++ "recall-vendor", &vendor,
3864++ NULL);
3865++
3866++ /* TRANSLATORS: the battery may be recalled by its vendor */
3867++ title = _("Battery may be recalled");
3868++ message = g_string_new ("");
3869++ g_string_append_printf (message,
3870++ _("A battery in your computer may have been "
3871++ "recalled by %s and you may be at risk."), vendor);
3872++ g_string_append (message, "\n\n");
3873++ g_string_append (message, _("For more information visit the battery recall website."));
3874++ dialog = gtk_message_dialog_new_with_markup (NULL,
3875++ GTK_DIALOG_DESTROY_WITH_PARENT,
3876++ GTK_MESSAGE_INFO,
3877++ GTK_BUTTONS_CLOSE,
3878++ "<span size='larger'><b>%s</b></span>",
3879++ title);
3880++ gtk_message_dialog_format_secondary_markup (GTK_MESSAGE_DIALOG (dialog),
3881++ "%s", message->str);
3882++
3883++ /* TRANSLATORS: button text, visit the manufacturers recall website */
3884++ gtk_dialog_add_button (GTK_DIALOG (dialog), _("Visit recall website"),
3885++ GTK_RESPONSE_OK);
3886++
3887++ /* TRANSLATORS: button text, do not show this bubble again */
3888++ gtk_dialog_add_button (GTK_DIALOG (dialog), _("Do not show me this again"),
3889++ GTK_RESPONSE_CANCEL);
3890++
3891++ gtk_widget_show (dialog);
3892++ g_signal_connect (dialog, "response",
3893++ G_CALLBACK (device_perhaps_recall_response_cb),
3894++ recall_data);
3895++
3896++ g_string_free (message, TRUE);
3897++ g_free (vendor);
3898++ return FALSE;
3899++}
3900++
3901++static void
3902++device_perhaps_recall (GsdPowerManager *manager, UpDevice *device)
3903++{
3904++ gboolean ret;
3905++ guint timer_id;
3906++ GsdPowerManagerRecallData *recall_data;
3907++
3908++ /* don't show when running under GDM */
3909++ if (g_getenv ("RUNNING_UNDER_GDM") != NULL) {
3910++ g_debug ("running under gdm, so no notification");
3911+ return;
3912+- g_ptr_array_add (manager->priv->devices_array, g_object_ref (device));
3913++ }
3914+
3915+- g_signal_connect (device, "notify::warning-level",
3916+- G_CALLBACK (engine_device_warning_changed_cb), manager);
3917++ /* already shown, and dismissed */
3918++ ret = g_settings_get_boolean (manager->priv->settings,
3919++ "notify-perhaps-recall");
3920++ if (!ret) {
3921++ g_debug ("settings prevents recall notification");
3922++ return;
3923++ }
3924+
3925+- engine_device_warning_changed_cb (device, NULL, manager);
3926++ recall_data = g_new0 (GsdPowerManagerRecallData, 1);
3927++ recall_data->manager = g_object_ref (manager);
3928++ recall_data->device = g_object_ref (device);
3929++
3930++ /* delay by a few seconds so the session can load */
3931++ timer_id = g_timeout_add_seconds (GSD_POWER_MANAGER_RECALL_DELAY,
3932++ device_perhaps_recall_delay_cb,
3933++ recall_data);
3934++ g_source_set_name_by_id (timer_id, "[GsdPowerManager] perhaps-recall");
3935++}
3936++
3937++static void
3938++engine_device_add (GsdPowerManager *manager, UpDevice *device)
3939++{
3940++ gboolean recall_notice;
3941++ GsdPowerManagerWarning warning;
3942++ UpDeviceState state;
3943++ UpDeviceKind kind;
3944++
3945++ /* assign warning */
3946++ warning = engine_get_warning (manager, device);
3947++ g_object_set_data (G_OBJECT(device),
3948++ "engine-warning-old",
3949++ GUINT_TO_POINTER(warning));
3950++
3951++ /* get device properties */
3952++ g_object_get (device,
3953++ "kind", &kind,
3954++ "state", &state,
3955++ "recall-notice", &recall_notice,
3956++ NULL);
3957++
3958++ /* add old state for transitions */
3959++ g_debug ("adding %s with state %s",
3960++ up_device_get_object_path (device), up_device_state_to_string (state));
3961++ g_object_set_data (G_OBJECT(device),
3962++ "engine-state-old",
3963++ GUINT_TO_POINTER(state));
3964++
3965++ if (kind == UP_DEVICE_KIND_BATTERY) {
3966++ g_debug ("updating because we added a device");
3967++ engine_update_composite_device (manager);
3968++
3969++ /* reset those values for the composite device */
3970++ g_object_set_data (G_OBJECT(manager->priv->device_composite),
3971++ "engine-warning-old",
3972++ GUINT_TO_POINTER(WARNING_NONE));
3973++ g_object_set_data (G_OBJECT(manager->priv->device_composite),
3974++ "engine-state-old",
3975++ GUINT_TO_POINTER(UP_DEVICE_STATE_UNKNOWN));
3976++
3977++ engine_device_changed_cb (NULL, manager->priv->device_composite, manager);
3978++ }
3979++
3980++ /* the device is recalled */
3981++ if (recall_notice)
3982++ device_perhaps_recall (manager, device);
3983++}
3984++
3985++static gboolean
3986++engine_check_recall (GsdPowerManager *manager, UpDevice *device)
3987++{
3988++ UpDeviceKind kind;
3989++ gboolean recall_notice = FALSE;
3990++ gchar *recall_vendor = NULL;
3991++ gchar *recall_url = NULL;
3992++
3993++ /* get device properties */
3994++ g_object_get (device,
3995++ "kind", &kind,
3996++ "recall-notice", &recall_notice,
3997++ "recall-vendor", &recall_vendor,
3998++ "recall-url", &recall_url,
3999++ NULL);
4000++
4001++ /* not battery */
4002++ if (kind != UP_DEVICE_KIND_BATTERY)
4003++ goto out;
4004++
4005++ /* no recall data */
4006++ if (!recall_notice)
4007++ goto out;
4008++
4009++ /* emit signal for manager */
4010++ g_debug ("** EMIT: perhaps-recall");
4011++ g_debug ("%s-%s", recall_vendor, recall_url);
4012++out:
4013++ g_free (recall_vendor);
4014++ g_free (recall_url);
4015++ return recall_notice;
4016+ }
4017+
4018+ static gboolean
4019+@@ -248,6 +992,18 @@ engine_coldplug (GsdPowerManager *manage
4020+ guint i;
4021+ GPtrArray *array = NULL;
4022+ UpDevice *device;
4023++ gboolean ret;
4024++ GError *error = NULL;
4025++
4026++ /* get devices from UPower */
4027++ ret = up_client_enumerate_devices_sync (manager->priv->up_client, NULL, &error);
4028++ if (!ret) {
4029++ g_warning ("failed to get device list: %s", error->message);
4030++ g_error_free (error);
4031++ return FALSE;
4032++ }
4033++
4034++ engine_recalculate_state (manager);
4035+
4036+ /* add to database */
4037+ array = up_client_get_devices (manager->priv->up_client);
4038+@@ -255,6 +1011,7 @@ engine_coldplug (GsdPowerManager *manage
4039+ for (i = 0 ; array != NULL && i < array->len ; i++) {
4040+ device = g_ptr_array_index (array, i);
4041+ engine_device_add (manager, device);
4042++ engine_check_recall (manager, device);
4043+ }
4044+
4045+ g_clear_pointer (&array, g_ptr_array_unref);
4046+@@ -266,22 +1023,22 @@ engine_coldplug (GsdPowerManager *manage
4047+ static void
4048+ engine_device_added_cb (UpClient *client, UpDevice *device, GsdPowerManager *manager)
4049+ {
4050++ /* add to list */
4051++ g_ptr_array_add (manager->priv->devices_array, g_object_ref (device));
4052+ engine_device_add (manager, device);
4053++ engine_check_recall (manager, device);
4054++
4055++ engine_recalculate_state (manager);
4056+ }
4057+
4058+ static void
4059+-engine_device_removed_cb (UpClient *client, const char *object_path, GsdPowerManager *manager)
4060++engine_device_removed_cb (UpClient *client, UpDevice *device, GsdPowerManager *manager)
4061+ {
4062+- guint i;
4063+-
4064+- for (i = 0; i < manager->priv->devices_array->len; i++) {
4065+- UpDevice *device = g_ptr_array_index (manager->priv->devices_array, i);
4066+-
4067+- if (g_strcmp0 (object_path, up_device_get_object_path (device)) == 0) {
4068+- g_ptr_array_remove_index (manager->priv->devices_array, i);
4069+- break;
4070+- }
4071+- }
4072++ gboolean ret;
4073++ ret = g_ptr_array_remove (manager->priv->devices_array, device);
4074++ if (!ret)
4075++ return;
4076++ engine_recalculate_state (manager);
4077+ }
4078+
4079+ static void
4080+@@ -290,15 +1047,35 @@ on_notification_closed (NotifyNotificati
4081+ g_object_unref (notification);
4082+ }
4083+
4084++static const gchar *
4085++get_first_themed_icon_name (GIcon *icon)
4086++{
4087++ const gchar* const *icon_names;
4088++ const gchar *icon_name = NULL;
4089++
4090++ /* no icon */
4091++ if (icon == NULL)
4092++ goto out;
4093++
4094++ /* just use the first icon */
4095++ icon_names = g_themed_icon_get_names (G_THEMED_ICON (icon));
4096++ if (icon_names != NULL)
4097++ icon_name = icon_names[0];
4098++out:
4099++ return icon_name;
4100++}
4101++
4102+ static void
4103+ create_notification (const char *summary,
4104+ const char *body,
4105+- const char *icon_name,
4106++ GIcon *icon,
4107+ NotifyNotification **weak_pointer_location)
4108+ {
4109+ NotifyNotification *notification;
4110+
4111+- notification = notify_notification_new (summary, body, icon_name);
4112++ notification = notify_notification_new (summary,
4113++ body,
4114++ icon ? get_first_themed_icon_name (icon) : NULL);
4115+ *weak_pointer_location = notification;
4116+ g_object_add_weak_pointer (G_OBJECT (notification),
4117+ (gpointer *) weak_pointer_location);
4118+@@ -312,17 +1089,23 @@ engine_ups_discharging (GsdPowerManager
4119+ const gchar *title;
4120+ gchar *remaining_text = NULL;
4121+ gdouble percentage;
4122+- char *icon_name;
4123++ GIcon *icon = NULL;
4124+ gint64 time_to_empty;
4125+ GString *message;
4126++ UpDeviceKind kind;
4127+
4128+ /* get device properties */
4129+ g_object_get (device,
4130++ "kind", &kind,
4131+ "percentage", &percentage,
4132+ "time-to-empty", &time_to_empty,
4133+- "icon-name", &icon_name,
4134+ NULL);
4135+
4136++ if (kind != UP_DEVICE_KIND_UPS)
4137++ return;
4138++
4139++ main_battery_or_ups_low_changed (manager, TRUE);
4140++
4141+ /* only show text if there is a valid time */
4142+ if (time_to_empty > 0)
4143+ remaining_text = gpm_get_timestring (time_to_empty);
4144+@@ -336,16 +1119,18 @@ engine_ups_discharging (GsdPowerManager
4145+ g_string_append_printf (message, _("%s of UPS backup power remaining"),
4146+ remaining_text);
4147+ } else {
4148+- g_string_append (message, _("Unknown amount of UPS backup power remaining"));
4149++ g_string_append (message, gpm_device_to_localised_string (device));
4150+ }
4151+ g_string_append_printf (message, " (%.0f%%)", percentage);
4152+
4153++ icon = gpm_upower_get_device_icon (device, TRUE);
4154++
4155+ /* close any existing notification of this class */
4156+ notify_close_if_showing (&manager->priv->notification_ups_discharging);
4157+
4158+ /* create a new notification */
4159+ create_notification (title, message->str,
4160+- icon_name,
4161++ icon,
4162+ &manager->priv->notification_ups_discharging);
4163+ notify_notification_set_timeout (manager->priv->notification_ups_discharging,
4164+ GSD_POWER_MANAGER_NOTIFY_TIMEOUT_LONG);
4165+@@ -359,35 +1144,105 @@ engine_ups_discharging (GsdPowerManager
4166+ notify_notification_show (manager->priv->notification_ups_discharging, NULL);
4167+
4168+ g_string_free (message, TRUE);
4169+- g_free (icon_name);
4170++ if (icon != NULL)
4171++ g_object_unref (icon);
4172+ g_free (remaining_text);
4173+ }
4174+
4175+ static GsdPowerActionType
4176+-manager_critical_action_get (GsdPowerManager *manager)
4177++manager_critical_action_get (GsdPowerManager *manager,
4178++ gboolean is_ups)
4179+ {
4180+ GsdPowerActionType policy;
4181+- char *action;
4182++ GVariant *result = NULL;
4183++
4184++ policy = g_settings_get_enum (manager->priv->settings, "critical-battery-action");
4185++
4186++ if (policy == GSD_POWER_ACTION_SUSPEND) {
4187++ if (is_ups == FALSE) {
4188++ result = g_dbus_proxy_call_sync (manager->priv->logind_proxy,
4189++ "CanSuspend",
4190++ NULL,
4191++ G_DBUS_CALL_FLAGS_NONE,
4192++ -1, NULL, NULL);
4193++ }
4194++ } else if (policy == GSD_POWER_ACTION_HIBERNATE) {
4195++ result = g_dbus_proxy_call_sync (manager->priv->logind_proxy,
4196++ "CanHibernate",
4197++ NULL,
4198++ G_DBUS_CALL_FLAGS_NONE,
4199++ -1, NULL, NULL);
4200++ } else {
4201++ /* Other actions need no check */
4202++ return policy;
4203++ }
4204++
4205++ if (result) {
4206++ const char *s;
4207+
4208+- action = up_client_get_critical_action (manager->priv->up_client);
4209+- /* We don't make the difference between HybridSleep and Hibernate */
4210+- if (g_strcmp0 (action, "PowerOff") == 0)
4211++ g_variant_get (result, "(s)", &s);
4212++ if (g_strcmp0 (s, "yes") != 0)
4213++ policy = GSD_POWER_ACTION_SHUTDOWN;
4214++ g_variant_unref (result);
4215++ } else {
4216+ policy = GSD_POWER_ACTION_SHUTDOWN;
4217+- else
4218+- policy = GSD_POWER_ACTION_HIBERNATE;
4219+- g_free (action);
4220++ }
4221++
4222+ return policy;
4223+ }
4224+
4225+ static gboolean
4226+-manager_critical_action_stop_sound_cb (GsdPowerManager *manager)
4227++manager_critical_action_do (GsdPowerManager *manager,
4228++ gboolean is_ups)
4229+ {
4230++ GsdPowerActionType action_type;
4231++
4232+ /* stop playing the alert as it's too late to do anything now */
4233+ play_loop_stop (&manager->priv->critical_alert_timeout_id);
4234+
4235++ action_type = manager_critical_action_get (manager, is_ups);
4236++ do_power_action_type (manager, action_type);
4237++
4238++ return FALSE;
4239++}
4240++
4241++static gboolean
4242++manager_critical_action_do_cb (GsdPowerManager *manager)
4243++{
4244++ manager_critical_action_do (manager, FALSE);
4245++ return FALSE;
4246++}
4247++
4248++static gboolean
4249++manager_critical_ups_action_do_cb (GsdPowerManager *manager)
4250++{
4251++ manager_critical_action_do (manager, TRUE);
4252+ return FALSE;
4253+ }
4254+
4255++static gboolean
4256++engine_just_laptop_battery (GsdPowerManager *manager)
4257++{
4258++ UpDevice *device;
4259++ UpDeviceKind kind;
4260++ GPtrArray *array;
4261++ gboolean ret = TRUE;
4262++ guint i;
4263++
4264++ /* find if there are any other device types that mean we have to
4265++ * be more specific in our wording */
4266++ array = manager->priv->devices_array;
4267++ for (i=0; i<array->len; i++) {
4268++ device = g_ptr_array_index (array, i);
4269++ g_object_get (device, "kind", &kind, NULL);
4270++ if (kind != UP_DEVICE_KIND_BATTERY) {
4271++ ret = FALSE;
4272++ break;
4273++ }
4274++ }
4275++ return ret;
4276++}
4277++
4278+ static void
4279+ engine_charge_low (GsdPowerManager *manager, UpDevice *device)
4280+ {
4281+@@ -397,7 +1252,7 @@ engine_charge_low (GsdPowerManager *mana
4282+ gchar *tmp;
4283+ gchar *remaining_text;
4284+ gdouble percentage;
4285+- char *icon_name;
4286++ GIcon *icon = NULL;
4287+ gint64 time_to_empty;
4288+ UpDeviceKind kind;
4289+
4290+@@ -406,13 +1261,20 @@ engine_charge_low (GsdPowerManager *mana
4291+ "kind", &kind,
4292+ "percentage", &percentage,
4293+ "time-to-empty", &time_to_empty,
4294+- "icon-name", &icon_name,
4295+ NULL);
4296+
4297++ /* check to see if the batteries have not noticed we are on AC */
4298++ if (kind == UP_DEVICE_KIND_BATTERY) {
4299++ if (!up_client_get_on_battery (manager->priv->up_client)) {
4300++ g_warning ("ignoring low message as we are not on battery power");
4301++ goto out;
4302++ }
4303++ }
4304++
4305+ if (kind == UP_DEVICE_KIND_BATTERY) {
4306+
4307+ /* if the user has no other batteries, drop the "Laptop" wording */
4308+- ret = (manager->priv->devices_array->len > 0);
4309++ ret = engine_just_laptop_battery (manager);
4310+ if (ret) {
4311+ /* TRANSLATORS: laptop battery low, and we only have one battery */
4312+ title = _("Battery low");
4313+@@ -428,6 +1290,8 @@ engine_charge_low (GsdPowerManager *mana
4314+ message = g_strdup_printf (_("Approximately %s remaining (%.0f%%)"), remaining_text, percentage);
4315+ g_free (remaining_text);
4316+
4317++ main_battery_or_ups_low_changed (manager, TRUE);
4318++
4319+ } else if (kind == UP_DEVICE_KIND_UPS) {
4320+ /* TRANSLATORS: UPS is starting to get a little low */
4321+ title = _("UPS low");
4322+@@ -489,12 +1353,15 @@ engine_charge_low (GsdPowerManager *mana
4323+ message = g_strdup_printf (_("Attached computer is low in power (%.0f%%)"), percentage);
4324+ }
4325+
4326++ /* get correct icon */
4327++ icon = gpm_upower_get_device_icon (device, TRUE);
4328++
4329+ /* close any existing notification of this class */
4330+ notify_close_if_showing (&manager->priv->notification_low);
4331+
4332+ /* create a new notification */
4333+ create_notification (title, message,
4334+- icon_name,
4335++ icon,
4336+ &manager->priv->notification_low);
4337+ notify_notification_set_timeout (manager->priv->notification_low,
4338+ GSD_POWER_MANAGER_NOTIFY_TIMEOUT_LONG);
4339+@@ -512,7 +1379,9 @@ engine_charge_low (GsdPowerManager *mana
4340+ /* TRANSLATORS: this is the sound description */
4341+ CA_PROP_EVENT_DESCRIPTION, _("Battery is low"), NULL);
4342+
4343+- g_free (icon_name);
4344++out:
4345++ if (icon != NULL)
4346++ g_object_unref (icon);
4347+ g_free (message);
4348+ }
4349+
4350+@@ -523,7 +1392,7 @@ engine_charge_critical (GsdPowerManager
4351+ gboolean ret;
4352+ gchar *message = NULL;
4353+ gdouble percentage;
4354+- char *icon_name;
4355++ GIcon *icon = NULL;
4356+ gint64 time_to_empty;
4357+ GsdPowerActionType policy;
4358+ UpDeviceKind kind;
4359+@@ -533,13 +1402,20 @@ engine_charge_critical (GsdPowerManager
4360+ "kind", &kind,
4361+ "percentage", &percentage,
4362+ "time-to-empty", &time_to_empty,
4363+- "icon-name", &icon_name,
4364+ NULL);
4365+
4366++ /* check to see if the batteries have not noticed we are on AC */
4367++ if (kind == UP_DEVICE_KIND_BATTERY) {
4368++ if (!up_client_get_on_battery (manager->priv->up_client)) {
4369++ g_warning ("ignoring critically low message as we are not on battery power");
4370++ goto out;
4371++ }
4372++ }
4373++
4374+ if (kind == UP_DEVICE_KIND_BATTERY) {
4375+
4376+ /* if the user has no other batteries, drop the "Laptop" wording */
4377+- ret = (manager->priv->devices_array->len > 0);
4378++ ret = engine_just_laptop_battery (manager);
4379+ if (ret) {
4380+ /* TRANSLATORS: laptop battery critically low, and only have one kind of battery */
4381+ title = _("Battery critically low");
4382+@@ -549,10 +1425,18 @@ engine_charge_critical (GsdPowerManager
4383+ }
4384+
4385+ /* we have to do different warnings depending on the policy */
4386+- policy = manager_critical_action_get (manager);
4387++ policy = manager_critical_action_get (manager, FALSE);
4388+
4389+ /* use different text for different actions */
4390+- if (policy == GSD_POWER_ACTION_HIBERNATE) {
4391++ if (policy == GSD_POWER_ACTION_NOTHING) {
4392++ /* TRANSLATORS: tell the use to insert the plug, as we're not going to do anything */
4393++ message = g_strdup (_("Plug in your AC adapter to avoid losing data."));
4394++
4395++ } else if (policy == GSD_POWER_ACTION_SUSPEND) {
4396++ /* TRANSLATORS: give the user a ultimatum */
4397++ message = g_strdup_printf (_("Computer will suspend very soon unless it is plugged in."));
4398++
4399++ } else if (policy == GSD_POWER_ACTION_HIBERNATE) {
4400+ /* TRANSLATORS: give the user a ultimatum */
4401+ message = g_strdup_printf (_("Computer will hibernate very soon unless it is plugged in."));
4402+
4403+@@ -561,6 +1445,8 @@ engine_charge_critical (GsdPowerManager
4404+ message = g_strdup_printf (_("Computer will shutdown very soon unless it is plugged in."));
4405+ }
4406+
4407++ main_battery_or_ups_low_changed (manager, TRUE);
4408++
4409+ } else if (kind == UP_DEVICE_KIND_UPS) {
4410+ gchar *remaining_text;
4411+ gchar *tmp;
4412+@@ -640,12 +1526,15 @@ engine_charge_critical (GsdPowerManager
4413+ percentage);
4414+ }
4415+
4416++ /* get correct icon */
4417++ icon = gpm_upower_get_device_icon (device, TRUE);
4418++
4419+ /* close any existing notification of this class */
4420+ notify_close_if_showing (&manager->priv->notification_low);
4421+
4422+ /* create a new notification */
4423+ create_notification (title, message,
4424+- icon_name,
4425++ icon,
4426+ &manager->priv->notification_low);
4427+ notify_notification_set_timeout (manager->priv->notification_low,
4428+ NOTIFY_EXPIRES_NEVER);
4429+@@ -671,8 +1560,9 @@ engine_charge_critical (GsdPowerManager
4430+ CA_PROP_EVENT_DESCRIPTION, _("Battery is critically low"), NULL);
4431+ break;
4432+ }
4433+-
4434+- g_free (icon_name);
4435++out:
4436++ if (icon != NULL)
4437++ g_object_unref (icon);
4438+ g_free (message);
4439+ }
4440+
4441+@@ -681,7 +1571,7 @@ engine_charge_action (GsdPowerManager *m
4442+ {
4443+ const gchar *title = NULL;
4444+ gchar *message = NULL;
4445+- char *icon_name;
4446++ GIcon *icon = NULL;
4447+ GsdPowerActionType policy;
4448+ guint timer_id;
4449+ UpDeviceKind kind;
4450+@@ -689,19 +1579,39 @@ engine_charge_action (GsdPowerManager *m
4451+ /* get device properties */
4452+ g_object_get (device,
4453+ "kind", &kind,
4454+- "icon-name", &icon_name,
4455+ NULL);
4456+
4457++ /* check to see if the batteries have not noticed we are on AC */
4458++ if (kind == UP_DEVICE_KIND_BATTERY) {
4459++ if (!up_client_get_on_battery (manager->priv->up_client)) {
4460++ g_warning ("ignoring critically low message as we are not on battery power");
4461++ goto out;
4462++ }
4463++ }
4464++
4465+ if (kind == UP_DEVICE_KIND_BATTERY) {
4466+
4467+ /* TRANSLATORS: laptop battery is really, really, low */
4468+ title = _("Laptop battery critically low");
4469+
4470+ /* we have to do different warnings depending on the policy */
4471+- policy = manager_critical_action_get (manager);
4472++ policy = manager_critical_action_get (manager, FALSE);
4473+
4474+ /* use different text for different actions */
4475+- if (policy == GSD_POWER_ACTION_HIBERNATE) {
4476++ if (policy == GSD_POWER_ACTION_NOTHING) {
4477++ /* TRANSLATORS: computer will shutdown without saving data */
4478++ message = g_strdup (_("The battery is below the critical level and "
4479++ "this computer will <b>power-off</b> when the "
4480++ "battery becomes completely empty."));
4481++
4482++ } else if (policy == GSD_POWER_ACTION_SUSPEND) {
4483++ /* TRANSLATORS: computer will suspend */
4484++ message = g_strdup (_("The battery is below the critical level and "
4485++ "this computer is about to suspend.\n"
4486++ "<b>NOTE:</b> A small amount of power is required "
4487++ "to keep your computer in a suspended state."));
4488++
4489++ } else if (policy == GSD_POWER_ACTION_HIBERNATE) {
4490+ /* TRANSLATORS: computer will hibernate */
4491+ message = g_strdup (_("The battery is below the critical level and "
4492+ "this computer is about to hibernate."));
4493+@@ -713,8 +1623,8 @@ engine_charge_action (GsdPowerManager *m
4494+ }
4495+
4496+ /* wait 20 seconds for user-panic */
4497+- timer_id = g_timeout_add_seconds (GSD_STOP_SOUND_DELAY,
4498+- (GSourceFunc) manager_critical_action_stop_sound_cb,
4499++ timer_id = g_timeout_add_seconds (GSD_ACTION_DELAY,
4500++ (GSourceFunc) manager_critical_action_do_cb,
4501+ manager);
4502+ g_source_set_name_by_id (timer_id, "[GsdPowerManager] battery critical-action");
4503+
4504+@@ -723,10 +1633,16 @@ engine_charge_action (GsdPowerManager *m
4505+ title = _("UPS critically low");
4506+
4507+ /* we have to do different warnings depending on the policy */
4508+- policy = manager_critical_action_get (manager);
4509++ policy = manager_critical_action_get (manager, TRUE);
4510+
4511+ /* use different text for different actions */
4512+- if (policy == GSD_POWER_ACTION_HIBERNATE) {
4513++ if (policy == GSD_POWER_ACTION_NOTHING) {
4514++ /* TRANSLATORS: computer will shutdown without saving data */
4515++ message = g_strdup (_("UPS is below the critical level and "
4516++ "this computer will <b>power-off</b> when the "
4517++ "UPS becomes completely empty."));
4518++
4519++ } else if (policy == GSD_POWER_ACTION_HIBERNATE) {
4520+ /* TRANSLATORS: computer will hibernate */
4521+ message = g_strdup (_("UPS is below the critical level and "
4522+ "this computer is about to hibernate."));
4523+@@ -738,8 +1654,8 @@ engine_charge_action (GsdPowerManager *m
4524+ }
4525+
4526+ /* wait 20 seconds for user-panic */
4527+- timer_id = g_timeout_add_seconds (GSD_STOP_SOUND_DELAY,
4528+- (GSourceFunc) manager_critical_action_stop_sound_cb,
4529++ timer_id = g_timeout_add_seconds (GSD_ACTION_DELAY,
4530++ (GSourceFunc) manager_critical_ups_action_do_cb,
4531+ manager);
4532+ g_source_set_name_by_id (timer_id, "[GsdPowerManager] ups critical-action");
4533+ }
4534+@@ -748,12 +1664,15 @@ engine_charge_action (GsdPowerManager *m
4535+ if (title == NULL)
4536+ return;
4537+
4538++ /* get correct icon */
4539++ icon = gpm_upower_get_device_icon (device, TRUE);
4540++
4541+ /* close any existing notification of this class */
4542+ notify_close_if_showing (&manager->priv->notification_low);
4543+
4544+ /* create a new notification */
4545+ create_notification (title, message,
4546+- icon_name,
4547++ icon,
4548+ &manager->priv->notification_low);
4549+ notify_notification_set_timeout (manager->priv->notification_low,
4550+ NOTIFY_EXPIRES_NEVER);
4551+@@ -769,40 +1688,77 @@ engine_charge_action (GsdPowerManager *m
4552+ CA_PROP_EVENT_ID, "battery-caution",
4553+ /* TRANSLATORS: this is the sound description */
4554+ CA_PROP_EVENT_DESCRIPTION, _("Battery is critically low"), NULL);
4555+-
4556+- g_free (icon_name);
4557++out:
4558++ if (icon != NULL)
4559++ g_object_unref (icon);
4560+ g_free (message);
4561+ }
4562+
4563+ static void
4564+-engine_device_warning_changed_cb (UpDevice *device, GParamSpec *pspec, GsdPowerManager *manager)
4565++engine_device_changed_cb (UpClient *client, UpDevice *device, GsdPowerManager *manager)
4566+ {
4567+- UpDeviceLevel warning;
4568++ UpDeviceKind kind;
4569++ UpDeviceState state;
4570++ UpDeviceState state_old;
4571++ GsdPowerManagerWarning warning_old;
4572++ GsdPowerManagerWarning warning;
4573++
4574++ /* get device properties */
4575++ g_object_get (device,
4576++ "kind", &kind,
4577++ NULL);
4578++
4579++ /* if battery then use composite device to cope with multiple batteries */
4580++ if (kind == UP_DEVICE_KIND_BATTERY) {
4581++ g_debug ("updating because %s changed", up_device_get_object_path (device));
4582++ engine_update_composite_device (manager);
4583++ device = manager->priv->device_composite;
4584++ }
4585++
4586++ /* get device properties (may be composite) */
4587++ g_object_get (device,
4588++ "state", &state,
4589++ NULL);
4590+
4591+- g_object_get (device, "warning-level", &warning, NULL);
4592++ g_debug ("%s state is now %s", up_device_get_object_path (device), up_device_state_to_string (state));
4593+
4594+- if (warning == UP_DEVICE_LEVEL_DISCHARGING) {
4595+- g_debug ("** EMIT: discharging");
4596+- engine_ups_discharging (manager, device);
4597+- } else if (warning == UP_DEVICE_LEVEL_LOW) {
4598+- g_debug ("** EMIT: charge-low");
4599+- engine_charge_low (manager, device);
4600+- } else if (warning == UP_DEVICE_LEVEL_CRITICAL) {
4601+- g_debug ("** EMIT: charge-critical");
4602+- engine_charge_critical (manager, device);
4603+- } else if (warning == UP_DEVICE_LEVEL_ACTION) {
4604+- g_debug ("** EMIT: charge-action");
4605+- engine_charge_action (manager, device);
4606+- } else if (warning == UP_DEVICE_LEVEL_NONE) {
4607+- /* FIXME: this only handles one notification
4608+- * for the whole system, instead of one per device */
4609+- g_debug ("fully charged or charging, hiding notifications if any");
4610+- play_loop_stop (&manager->priv->critical_alert_timeout_id);
4611+- notify_close_if_showing (&manager->priv->notification_low);
4612+- notify_close_if_showing (&manager->priv->notification_ups_discharging);
4613++ /* see if any interesting state changes have happened */
4614++ state_old = GPOINTER_TO_INT(g_object_get_data (G_OBJECT(device), "engine-state-old"));
4615++ if (state_old != state) {
4616++ if (state == UP_DEVICE_STATE_DISCHARGING) {
4617++ g_debug ("discharging");
4618++ engine_ups_discharging (manager, device);
4619++ } else if (state == UP_DEVICE_STATE_FULLY_CHARGED ||
4620++ state == UP_DEVICE_STATE_CHARGING) {
4621++ g_debug ("fully charged or charging, hiding notifications if any");
4622++ notify_close_if_showing (&manager->priv->notification_low);
4623++ notify_close_if_showing (&manager->priv->notification_ups_discharging);
4624++ main_battery_or_ups_low_changed (manager, FALSE);
4625++ }
4626++
4627++ /* save new state */
4628++ g_object_set_data (G_OBJECT(device), "engine-state-old", GUINT_TO_POINTER(state));
4629++ }
4630++
4631++ /* check the warning state has not changed */
4632++ warning_old = GPOINTER_TO_INT(g_object_get_data (G_OBJECT(device), "engine-warning-old"));
4633++ warning = engine_get_warning (manager, device);
4634++ if (warning != warning_old) {
4635++ if (warning == WARNING_LOW) {
4636++ g_debug ("** EMIT: charge-low");
4637++ engine_charge_low (manager, device);
4638++ } else if (warning == WARNING_CRITICAL) {
4639++ g_debug ("** EMIT: charge-critical");
4640++ engine_charge_critical (manager, device);
4641++ } else if (warning == WARNING_ACTION) {
4642++ g_debug ("charge-action");
4643++ engine_charge_action (manager, device);
4644++ }
4645++ /* save new state */
4646++ g_object_set_data (G_OBJECT(device), "engine-warning-old", GUINT_TO_POINTER(warning));
4647+ }
4648+
4649+- main_battery_or_ups_low_changed (manager, (warning != UP_DEVICE_LEVEL_NONE));
4650++ engine_recalculate_state (manager);
4651+ }
4652+
4653+ static void
4654+@@ -1210,10 +2166,17 @@ do_lid_closed_action (GsdPowerManager *m
4655+ }
4656+
4657+ static void
4658+-lid_state_changed_cb (UpClient *client, GParamSpec *pspec, GsdPowerManager *manager)
4659++up_client_changed_cb (UpClient *client, GsdPowerManager *manager)
4660+ {
4661+ gboolean tmp;
4662+
4663++ if (!up_client_get_on_battery (client)) {
4664++ /* if we are playing a critical charge sound loop on AC, stop it */
4665++ play_loop_stop (&manager->priv->critical_alert_timeout_id);
4666++ notify_close_if_showing (&manager->priv->notification_low);
4667++ main_battery_or_ups_low_changed (manager, FALSE);
4668++ }
4669++
4670+ if (!manager->priv->lid_is_present)
4671+ return;
4672+
4673+@@ -1264,13 +2227,17 @@ backlight_iface_emit_changed (GsdPowerMa
4674+ gint32 value)
4675+ {
4676+ GVariant *params;
4677++ gchar *string;
4678+
4679+ /* not yet connected to the bus */
4680+ if (manager->priv->connection == NULL)
4681+ return;
4682+
4683+- params = g_variant_new_parsed ("(%s, [{'Brightness', <%i>}], @as [])", interface_name,
4684+- value);
4685++ string = g_strdup_printf ("('%s', [{'Brightness', %%v}], @as [])", interface_name);
4686++ params = g_variant_new_parsed (string,
4687++ g_variant_new_int32 (value));
4688++ g_free (string);
4689++
4690+ g_dbus_connection_emit_signal (manager->priv->connection,
4691+ NULL,
4692+ GSD_POWER_DBUS_PATH,
4693+@@ -1628,12 +2595,9 @@ idle_configure (GsdPowerManager *manager
4694+ if (timeout_sleep != 0) {
4695+ g_debug ("setting up sleep callback %is", timeout_sleep);
4696+
4697+- if (action_type != GSD_POWER_ACTION_NOTHING) {
4698+- manager->priv->idle_sleep_id = gnome_idle_monitor_add_idle_watch (manager->priv->idle_monitor,
4699+- timeout_sleep * 1000,
4700+- idle_triggered_idle_cb, manager, NULL);
4701+- }
4702+-
4703++ manager->priv->idle_sleep_id = gnome_idle_monitor_add_idle_watch (manager->priv->idle_monitor,
4704++ timeout_sleep * 1000,
4705++ idle_triggered_idle_cb, manager, NULL);
4706+ if (action_type == GSD_POWER_ACTION_LOGOUT ||
4707+ action_type == GSD_POWER_ACTION_SUSPEND ||
4708+ action_type == GSD_POWER_ACTION_HIBERNATE) {
4709+@@ -1696,7 +2660,7 @@ idle_configure (GsdPowerManager *manager
4710+
4711+ static void
4712+ main_battery_or_ups_low_changed (GsdPowerManager *manager,
4713+- gboolean is_low)
4714++ gboolean is_low)
4715+ {
4716+ if (is_low == manager->priv->battery_is_low)
4717+ return;
4718+@@ -1824,12 +2788,6 @@ handle_screensaver_active (GsdPowerManag
4719+ }
4720+
4721+ static void
4722+-handle_wake_up_screen (GsdPowerManager *manager)
4723+-{
4724+- set_temporary_unidle_on_ac (manager, TRUE);
4725+-}
4726+-
4727+-static void
4728+ screensaver_signal_cb (GDBusProxy *proxy,
4729+ const gchar *sender_name,
4730+ const gchar *signal_name,
4731+@@ -1838,8 +2796,6 @@ screensaver_signal_cb (GDBusProxy *proxy
4732+ {
4733+ if (g_strcmp0 (signal_name, "ActiveChanged") == 0)
4734+ handle_screensaver_active (GSD_POWER_MANAGER (user_data), parameters);
4735+- else if (g_strcmp0 (signal_name, "WakeUpScreen") == 0)
4736+- handle_wake_up_screen (GSD_POWER_MANAGER (user_data));
4737+ }
4738+
4739+ static void
4740+@@ -1898,7 +2854,7 @@ power_keyboard_proxy_ready_cb (GObject
4741+
4742+ /* set brightness to max if not currently set so is something
4743+ * sensible */
4744+- if (manager->priv->kbd_brightness_now <= 0) {
4745++ if (manager->priv->kbd_brightness_now < 0) {
4746+ gboolean ret;
4747+ ret = upower_kbd_set_brightness (manager,
4748+ manager->priv->kbd_brightness_max,
4749+@@ -1956,17 +2912,9 @@ show_sleep_warning (GsdPowerManager *man
4750+ notify_notification_set_app_name (manager->priv->notification_sleep_warning, _("Power"));
4751+
4752+ notify_notification_show (manager->priv->notification_sleep_warning, NULL);
4753+-}
4754+-
4755+-static void
4756+-idle_set_mode_no_temp (GsdPowerManager *manager,
4757+- GsdPowerIdleMode mode)
4758+-{
4759+- if (manager->priv->temporary_unidle_on_ac_id != 0 &&
4760+- manager->priv->previous_idle_mode == mode)
4761+- return;
4762+
4763+- idle_set_mode (manager, mode);
4764++ if (manager->priv->sleep_action_type == GSD_POWER_ACTION_LOGOUT)
4765++ set_temporary_unidle_on_ac (manager, TRUE);
4766+ }
4767+
4768+ static void
4769+@@ -1984,11 +2932,11 @@ idle_triggered_idle_cb (GnomeIdleMonitor
4770+ g_debug ("idletime watch: %s (%i)", id_name, watch_id);
4771+
4772+ if (watch_id == manager->priv->idle_dim_id) {
4773+- idle_set_mode_no_temp (manager, GSD_POWER_IDLE_MODE_DIM);
4774++ idle_set_mode (manager, GSD_POWER_IDLE_MODE_DIM);
4775+ } else if (watch_id == manager->priv->idle_blank_id) {
4776+- idle_set_mode_no_temp (manager, GSD_POWER_IDLE_MODE_BLANK);
4777++ idle_set_mode (manager, GSD_POWER_IDLE_MODE_BLANK);
4778+ } else if (watch_id == manager->priv->idle_sleep_id) {
4779+- idle_set_mode_no_temp (manager, GSD_POWER_IDLE_MODE_SLEEP);
4780++ idle_set_mode (manager, GSD_POWER_IDLE_MODE_SLEEP);
4781+ } else if (watch_id == manager->priv->idle_sleep_warning_id) {
4782+ show_sleep_warning (manager);
4783+ }
4784+@@ -2016,6 +2964,10 @@ engine_settings_key_changed_cb (GSetting
4785+ const gchar *key,
4786+ GsdPowerManager *manager)
4787+ {
4788++ if (g_strcmp0 (key, "use-time-for-policy") == 0) {
4789++ manager->priv->use_time_primary = g_settings_get_boolean (settings, key);
4790++ return;
4791++ }
4792+ if (g_str_has_prefix (key, "sleep-inactive") ||
4793+ g_str_equal (key, "idle-delay") ||
4794+ g_str_equal (key, "idle-dim")) {
4795+@@ -2219,6 +3171,12 @@ handle_suspend_actions (GsdPowerManager
4796+ static void
4797+ handle_resume_actions (GsdPowerManager *manager)
4798+ {
4799++ /* close existing notifications on resume, the system power
4800++ * state is probably different now */
4801++ notify_close_if_showing (&manager->priv->notification_low);
4802++ notify_close_if_showing (&manager->priv->notification_ups_discharging);
4803++ main_battery_or_ups_low_changed (manager, FALSE);
4804++
4805+ /* ensure we turn the panel back on after resume */
4806+ backlight_enable (manager);
4807+
4808+@@ -2256,19 +3214,10 @@ on_rr_screen_acquired (GObject *obj
4809+ gpointer user_data)
4810+ {
4811+ GsdPowerManager *manager = user_data;
4812+- GError *error = NULL;
4813+
4814+ gnome_settings_profile_start (NULL);
4815+
4816+- manager->priv->rr_screen = gnome_rr_screen_new_finish (result, &error);
4817+-
4818+- if (error) {
4819+- g_warning ("Could not create GnomeRRScreen: %s\n", error->message);
4820+- g_error_free (error);
4821+- gnome_settings_profile_end (NULL);
4822+-
4823+- return;
4824+- }
4825++ manager->priv->rr_screen = gnome_rr_screen_new_finish (result, NULL);
4826+
4827+ /* set up the screens */
4828+ if (manager->priv->lid_is_present) {
4829+@@ -2311,8 +3260,10 @@ on_rr_screen_acquired (GObject *obj
4830+ G_CALLBACK (engine_device_added_cb), manager);
4831+ g_signal_connect (manager->priv->up_client, "device-removed",
4832+ G_CALLBACK (engine_device_removed_cb), manager);
4833+- g_signal_connect_after (manager->priv->up_client, "notify::lid-is-closed",
4834+- G_CALLBACK (lid_state_changed_cb), manager);
4835++ g_signal_connect (manager->priv->up_client, "device-changed",
4836++ G_CALLBACK (engine_device_changed_cb), manager);
4837++ g_signal_connect_after (manager->priv->up_client, "changed",
4838++ G_CALLBACK (up_client_changed_cb), manager);
4839+ g_signal_connect (manager->priv->up_client, "notify::on-battery",
4840+ G_CALLBACK (up_client_on_battery_cb), manager);
4841+
4842+@@ -2342,9 +3293,34 @@ on_rr_screen_acquired (GObject *obj
4843+ manager->priv->devices_array = g_ptr_array_new_with_free_func (g_object_unref);
4844+
4845+ /* create a fake virtual composite battery */
4846+- manager->priv->device_composite = up_client_get_display_device (manager->priv->up_client);
4847+- g_signal_connect (manager->priv->device_composite, "notify::warning-level",
4848+- G_CALLBACK (engine_device_warning_changed_cb), manager);
4849++ manager->priv->device_composite = up_device_new ();
4850++ g_object_set (manager->priv->device_composite,
4851++ "kind", UP_DEVICE_KIND_BATTERY,
4852++ "is-rechargeable", TRUE,
4853++ "native-path", "dummy:composite_battery",
4854++ "power-supply", TRUE,
4855++ NULL);
4856++ engine_update_composite_device (manager);
4857++
4858++ /* get percentage policy */
4859++ manager->priv->low_percentage = g_settings_get_int (manager->priv->settings,
4860++ "percentage-low");
4861++ manager->priv->critical_percentage = g_settings_get_int (manager->priv->settings,
4862++ "percentage-critical");
4863++ manager->priv->action_percentage = g_settings_get_int (manager->priv->settings,
4864++ "percentage-action");
4865++
4866++ /* get time policy */
4867++ manager->priv->low_time = g_settings_get_int (manager->priv->settings,
4868++ "time-low");
4869++ manager->priv->critical_time = g_settings_get_int (manager->priv->settings,
4870++ "time-critical");
4871++ manager->priv->action_time = g_settings_get_int (manager->priv->settings,
4872++ "time-action");
4873++
4874++ /* we can disable this if the time remaining is inaccurate or just plain wrong */
4875++ manager->priv->use_time_primary = g_settings_get_boolean (manager->priv->settings,
4876++ "use-time-for-policy");
4877+
4878+ /* create IDLETIME watcher */
4879+ manager->priv->idle_monitor = gnome_idle_monitor_new ();
4880+@@ -2358,15 +3334,6 @@ on_rr_screen_acquired (GObject *obj
4881+ /* don't blank inside a VM */
4882+ manager->priv->is_virtual_machine = gsd_power_is_hardware_a_vm ();
4883+
4884+- /* queue a signal in case the proxy from gnome-shell was created before we got here
4885+- (likely, considering that to get here we need a reply from gnome-shell)
4886+- */
4887+- if (manager->priv->backlight_available)
4888+- backlight_iface_emit_changed (manager, GSD_POWER_DBUS_INTERFACE_SCREEN,
4889+- backlight_get_percentage (manager->priv->rr_screen, NULL));
4890+- else
4891+- backlight_iface_emit_changed (manager, GSD_POWER_DBUS_INTERFACE_SCREEN, -1);
4892+-
4893+ gnome_settings_profile_end (NULL);
4894+ }
4895+
4896+@@ -2463,6 +3430,9 @@ gsd_power_manager_stop (GsdPowerManager
4897+ g_ptr_array_unref (manager->priv->devices_array);
4898+ manager->priv->devices_array = NULL;
4899+ g_clear_object (&manager->priv->device_composite);
4900++ g_clear_object (&manager->priv->previous_icon);
4901++
4902++ g_clear_pointer (&manager->priv->previous_summary, g_free);
4903+
4904+ g_clear_object (&manager->priv->session_presence_proxy);
4905+ g_clear_object (&manager->priv->screensaver_proxy);
4906+@@ -2577,6 +3547,114 @@ out:
4907+ }
4908+ }
4909+
4910++static GVariant *
4911++device_to_variant_blob (UpDevice *device)
4912++{
4913++ const gchar *object_path;
4914++ gchar *device_icon;
4915++ gdouble percentage;
4916++ GIcon *icon;
4917++ guint64 time_empty, time_full;
4918++ guint64 time_state = 0;
4919++ GVariant *value;
4920++ UpDeviceKind kind;
4921++ UpDeviceState state;
4922++ gboolean is_present;
4923++
4924++ g_object_get (device,
4925++ "is-present", &is_present,
4926++ "kind", &kind,
4927++ "percentage", &percentage,
4928++ "state", &state,
4929++ "time-to-empty", &time_empty,
4930++ "time-to-full", &time_full,
4931++ NULL);
4932++
4933++ if (!is_present)
4934++ return NULL;
4935++
4936++ icon = gpm_upower_get_device_icon (device, TRUE);
4937++ device_icon = g_icon_to_string (icon);
4938++
4939++ /* only return time for these simple states */
4940++ if (state == UP_DEVICE_STATE_DISCHARGING)
4941++ time_state = time_empty;
4942++ else if (state == UP_DEVICE_STATE_CHARGING)
4943++ time_state = time_full;
4944++
4945++ /* get an object path, even for the composite device */
4946++ object_path = up_device_get_object_path (device);
4947++ if (object_path == NULL)
4948++ object_path = GSD_DBUS_PATH;
4949++
4950++ /* format complex object */
4951++ value = g_variant_new ("(susdut)",
4952++ object_path,
4953++ kind,
4954++ device_icon,
4955++ percentage,
4956++ state,
4957++ time_state);
4958++ g_free (device_icon);
4959++ g_object_unref (icon);
4960++ return value;
4961++}
4962++
4963++static void
4964++handle_method_call_main (GsdPowerManager *manager,
4965++ const gchar *method_name,
4966++ GVariant *parameters,
4967++ GDBusMethodInvocation *invocation)
4968++{
4969++ GPtrArray *array;
4970++ guint i;
4971++ GVariantBuilder *builder;
4972++ GVariant *tuple = NULL;
4973++ GVariant *value = NULL;
4974++
4975++ /* return object */
4976++ if (g_strcmp0 (method_name, "GetPrimaryDevice") == 0) {
4977++ value = device_to_variant_blob (manager->priv->device_composite);
4978++ if (value) {
4979++ tuple = g_variant_new_tuple (&value, 1);
4980++ g_dbus_method_invocation_return_value (invocation, tuple);
4981++ } else {
4982++ g_dbus_method_invocation_return_error_literal (invocation,
4983++ GSD_POWER_MANAGER_ERROR,
4984++ GSD_POWER_MANAGER_ERROR_FAILED,
4985++ "Main battery device not available");
4986++ }
4987++ return;
4988++ }
4989++
4990++ /* return array */
4991++ if (g_strcmp0 (method_name, "GetDevices") == 0) {
4992++ UpDevice *device;
4993++
4994++ /* create builder */
4995++ builder = g_variant_builder_new (G_VARIANT_TYPE("a(susdut)"));
4996++
4997++ /* add each tuple to the array */
4998++ array = manager->priv->devices_array;
4999++ for (i=0; i<array->len; i++) {
5000++ device = g_ptr_array_index (array, i);
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches

to all changes: