debian/0000775000000000000000000000000012344327141007171 5ustar debian/xfce4-power-manager.manpages0000664000000000000000000000010612320537603014456 0ustar debian/xfce4-power-information.1 debian/xfpm-power-backlight-helper.1 debian/control0000664000000000000000000000531512320537603010600 0ustar Source: xfce4-power-manager Section: xfce Priority: optional Maintainer: Xubuntu Developers XSBC-Original-Maintainer: Debian Xfce Maintainers Uploaders: Yves-Alexis Perez , Lionel Le Folgoc Build-Depends: debhelper (>= 9), intltool, pkg-config, libgtk2.0-dev, libdbus-1-dev, libdbus-glib-1-dev, libxfconf-0-dev (>= 4.10.0), libxfce4ui-1-dev (>= 4.10.0), libnotify-dev, xfce4-panel-dev (>= 4.10.0), libpolkit-gobject-1-dev, libxext-dev, libx11-dev, dpkg-dev (>= 1.16.1), xfce4-dev-tools, libtool, dh-autoreconf, libsystemd-login-dev Standards-Version: 3.9.4 Vcs-Svn: svn://anonscm.debian.org/pkg-xfce/goodies/trunk/xfce4-power-manager/ Vcs-Browser: http://anonscm.debian.org/viewvc/pkg-xfce/goodies/trunk/xfce4-power-manager/ Homepage: http://goodies.xfce.org/projects/applications/xfce4-power-manager Package: xfce4-power-manager Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends}, upower, xfce4-power-manager-data (=${source:Version}), systemd-services Suggests: xfce4-power-manager-plugins, udisks Description: power manager for Xfce desktop This power manager for the Xfce desktop enables laptop users to set up a power profile for two different modes "on battery power" and "on ac power" while still allowing desktop users to at least change the DPMS settings and CPU frequency using the settings dialogue.. . It features: * battery monitoring * cpu frequency settings * monitor DPMS settings * suspend/Hibernate * LCD brightness control * Lid, sleep and power switches control Package: xfce4-power-manager-data Section: xfce Architecture: all Depends: ${shlibs:Depends}, ${misc:Depends} Recommends: xfce4-power-manager, librsvg2-common Replaces: xfce4-power-manager (<< 0.8.0~beta2-1) Description: power manager for Xfce desktop, arch-indep files This power manager for the Xfce desktop enables laptop users to set up a power profile for two different modes "on battery power" and "on ac power" while still allowing desktop users to at least change the DPMS settings and CPU frequency using the settings dialogue.. . This package contains architecture-independant files. Package: xfce4-power-manager-plugins Section: xfce Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends}, xfce4-power-manager (>= 0.8.0~) Description: power manager plugins for Xfce panel This power manager for the Xfce desktop enables laptop users to set up a power profile for two different modes "on battery power" and "on ac power" while still allowing desktop users to at least change the DPMS settings and CPU frequency using the settings dialogue.. . This package contains the brightness plugin. debian/xfce4-power-manager.install0000664000000000000000000000021212320537603014327 0ustar etc/ usr/bin usr/sbin usr/share/applications usr/share/polkit-1 debian/xfce4-power-manager.xml /etc/xdg/xfce4/xfconf/xfce-perchannel-xml/ debian/xfce4-power-manager.xml0000664000000000000000000000035212320537603013466 0ustar debian/changelog0000664000000000000000000003602512344326676011065 0ustar xfce4-power-manager (1.2.0-3ubuntu4.1) trusty; urgency=medium * Add 10_inhibit_logind.patch (LP: #1326740) -- Sean Davis Thu, 05 Jun 2014 23:30:27 -0400 xfce4-power-manager (1.2.0-3ubuntu4) trusty; urgency=medium * Add 09_sync_session_xfpm_lock_setting.patch (LP: #1101982) -- Sean Davis Mon, 07 Apr 2014 10:09:14 -0500 xfce4-power-manager (1.2.0-3ubuntu3) trusty; urgency=medium * Add 07_fix-screen-dimming.patch. LP: #1067749 * Add DEP3 Header to 06_add-shutdown-reboot-functionality-for-systemd.patch -- Jackson Doak Wed, 22 Jan 2014 16:02:45 +1100 xfce4-power-manager (1.2.0-3ubuntu2) trusty; urgency=medium * Add patches from debian svn branch to fix systemd. LP: #1222021 * Force run of xdt-autogen to continue to allow ppc64el to build -- Jackson Doak Mon, 20 Jan 2014 07:04:09 +1100 xfce4-power-manager (1.2.0-3ubuntu1) trusty; urgency=low [ Jackson Doak ] * Merged from debian unstable. Remaining changes: - 06_fix-suspend-auth-check.patch: added, correctly check for suspend permissions before disabling the corresponding drop-down menu item. lp #929537 - 08_show_preferences_lxde.patch: Hide settings menu only on desktop environment which have another power manager. - Switch to using logind for session tracking. Depend on systemd-services instead of consolekit recommends, and add libsystemd-login-dev build dependency. * Drop xubuntu_fix-status-icon-other-devices.patch, fixed in debian [ Logan Rosen ] * Get rid of 09_fix_insert_battery.patch, an Ubuntu patch that was applied in Debian. -- Jackson Doak Wed, 11 Dec 2013 18:22:21 +1100 xfce4-power-manager (1.2.0-3) unstable; urgency=medium [ Evgeni Golov ] * Correct Vcs-* URLs to point to anonscm.debian.org [ Jackson Doak ] * debian/control: - Bump standards-version to 3.9.4 - Build-depend on dh-autoreconf - Drop redandant "Section" category * debian/rules: --with autoreconf * Created debian/source/options * Create manpages for xfce4-power-information and xfpm-power-backlight-helper [ Yves-Alexis Perez ] * debian/patches: - 04_fix-missing-icons-for-non-system-batteries added, fix icon missing in the system tray for non system batteries. closes: #728257 -- Yves-Alexis Perez Mon, 09 Dec 2013 07:50:25 +0100 xfce4-power-manager (1.2.0-2ubuntu1) saucy; urgency=low * Merged from debian unstable. Remaining changes: - 06_fix-suspend-auth-check.patch: added, correctly check for suspend permissions before disabling the corresponding drop-down menu item. lp #929537 - 08_show_preferences_lxde.patch: Hide settings menu only on desktop environment which have another power manager. - xubuntu_fix-status-icon-other-devices.patch: fix broken status icons for other devices (phone, wireless kbd, mouse, etc.). - Switch to using logind for session tracking. Depend on systemd-services instead of consolekit recommends, and add libsystemd-login-dev build dependency. -- Jackson Doak Tue, 13 Aug 2013 06:56:35 +1000 xfce4-power-manager (1.2.0-2) unstable; urgency=low [ Lionel Le Folgoc ] * debian/patches: - 02_translations-fix-invalid-format-strings.patch: updated to fix crashes because of en_GB.po and tr.po. [ Yves-Alexis Perez ] * Upload to unstable. * debian/patches: - 01_Remove_custom_OSD_brightness_popup,_use_libnotify_instead added, use libnotify for brightness notifications. - 03_fix-insert-battery added, fix spurious space appearing when removing/adding battery. closes: #626224 * debian/rules: - enable all hardening options. -- Lionel Le Folgoc Wed, 22 May 2013 00:46:08 +0200 xfce4-power-manager (1.2.0-1ubuntu3) saucy; urgency=low * Switch to using logind for session tracking. Depend on systemd-services instead of consolekit recommends, and add libsystemd-login-dev build dependency. -- Benjamin Kerensa Mon, 11 Mar 2013 01:46:13 -0700 xfce4-power-manager (1.2.0-1ubuntu2) raring; urgency=low * debian/patches: - 02_translations-fix-invalid-format-strings.patch: updated to fix crashes because of en_GB.po and tr.po. lp: #1054907 -- Lionel Le Folgoc Mon, 29 Oct 2012 11:49:03 +0100 xfce4-power-manager (1.2.0-1ubuntu1) quantal; urgency=low * Merge from Debian experimental, remaining Ubuntu changes: - 06_fix-suspend-auth-check.patch: added, correctly check for suspend permissions before disabling the corresponding drop-down menu item. lp #929537 - 08_show_preferences_lxde.patch: Hide settings menu only on desktop environment which have another power manager. - 09_fix_insert_battery.patch: Another patch to fix empty icon when removing a battery. Thanks Henry Gebhardt for the patch. - xubuntu_fix-status-icon-other-devices.patch: fix broken status icons for other devices (phone, wireless kbd, mouse, etc.). -- Lionel Le Folgoc Fri, 18 May 2012 21:50:54 +0200 xfce4-power-manager (1.2.0-1) experimental; urgency=low * New upstream stable release. * debian/control: - bump b-deps for Xfce 4.10. * debian/patches: - 02_translations-fix-invalid-format-strings.patch: refreshed, some translations have been fixed. -- Lionel Le Folgoc Sat, 05 May 2012 14:24:30 +0200 xfce4-power-manager (1.1.0-1) experimental; urgency=low [ Yves-Alexis Perez ] * New upstream development release. * debian/patches: - 03_trap-x-errors, 04_clear-idles-for-removed-batteries, 05_fix-brightness-key-modifiers: dropped, included upstream. [ Lionel Le Folgoc ] * debian/patches: - 02_translations-fix-invalid-format-strings: refreshed to apply cleanly. -- Yves-Alexis Perez Sun, 15 Apr 2012 20:23:42 +0200 xfce4-power-manager (1.0.11-2) unstable; urgency=low [ Lionel Le Folgoc ] * debian/patches: - 02_translations-fix-invalid-format-strings.patch: drop translated strings when format strings don't match the original ones. This leads to hard to reproduce random crashes depending on the locale used… [ Yves-Alexis Perez ] * debian/rules: - build with --parallel. -- Lionel Le Folgoc Sun, 08 Apr 2012 22:25:40 +0200 xfce4-power-manager (1.0.11-1) unstable; urgency=low [ Lionel Le Folgoc ] * debian/patches: add missing DEP3 headers. [ Yves-Alexis Perez ] * New upstream release. * debian/patches: - 0001-Solaris-specific-code-for-determining-the-start-time dropped, included upstream. - 02_fix-notify-detect as well. * debian/control: - update standards version to 3.9.3. -- Yves-Alexis Perez Thu, 29 Mar 2012 10:49:47 +0200 xfce4-power-manager (1.0.10-5) unstable; urgency=low [ Lionel Le Folgoc ] * debian/patches: - 03_trap-x-errors.patch: added, fix crash when all outputs don't support the backlight property. Closes: #658916 - 04_clear-idles-for-removed-batteries.patch: added, fix crash when xfpm tries to refresh the status icon of a removed battery. - 05_fix-brightness-key-modifiers.patch: added, let the brightness keys work even when numlock is on. * debian/rules: - use debhelper 9 hardening support. * debian/compat bumped to 9. * debian/control: - drop hardening-includes build-dep. - update debhelper build-dep to 9 for hardening support. - add dpkg-dev 1.16.1 build-dep for hardening support. [ Yves-Alexis Perez ] * debian/watch updated, xfpm has moved to xfce section. -- Lionel Le Folgoc Mon, 06 Feb 2012 21:38:26 +0100 xfce4-power-manager (1.0.10-4) unstable; urgency=low * debian/patches: - 02_fix-notify-detect added, fix libnotify detection. closes: #630309 -- Yves-Alexis Perez Tue, 14 Jun 2011 21:44:04 +0200 xfce4-power-manager (1.0.10-3) unstable; urgency=low * debian/patches: - 0001-Solaris-specific-code-for-determining-the-start-time cherry-picked from master. We don't have solaris but it should fix the build-failure on GNU/Hurd anyway. -- Yves-Alexis Perez Fri, 22 Apr 2011 23:32:17 +0200 xfce4-power-manager (1.0.10-2) unstable; urgency=low [ Lionel Le Folgoc ] * Upload to unstable. closes: #623392 * debian/control: - remove Simon and Emanuele from uploaders, thanks to them. - bump b-deps for Xfce 4.8. * debian/rules: switch to --fail-missing. * debian/xfce4-power-manager.install: add missing sysfs backlight helper and its pk policy. [ Yves-Alexis Perez ] * debian/control: - update standards version to 3.9.2. -- Lionel Le Folgoc Tue, 19 Apr 2011 23:19:53 +0200 xfce4-power-manager (1.0.10-1) experimental; urgency=low [ Yves-Alexis Perez ] * New upstream release. * debian/control: - switch libxfcegui4 build-dep to libxfce4ui. - add build-dep on libpolkit-gobject-1-dev, libxext-dev and libx11-dev. - replace dep on hal by upower. - add suggest on udisks for disk spinning. - add build-dep on hardening-includes. * debian/rules: - add -O1, -z,defs and --as-needed to LDFLAGS. - add hardening flags to {C,LD}FLAGS. [ Lionel Le Folgoc ] * debian/control: - add myself to Uploaders - bump Standards-Version to 3.9.1, no changes required. * Switch to 3.0 (quilt). * debian/rules: - use dpkg-buildflags for cflags/ldflags handling. -- Yves-Alexis Perez Sun, 20 Feb 2011 14:56:52 +0100 xfce4-power-manager (0.8.5-3) unstable; urgency=low [ Lionel Le Folgoc ] * Switch to 3.0 (quilt) source format. * debian/patches: - 01_assume-hal-is-available.patch: do not check for hal presence on the bus, it'll be spawned automatically on demand. Closes: #612611 - 02_fix-indirect-dso-linking.patch: fix FTBFS with --no-add-needed. - series: add them. * debian/rules: call xdt-autogen before configure, and clean up autogenerated files on clean. * debian/control: - build-depends on automake, autoconf, libtool and xfce4-dev-tools. - bump hal dep to (>= 0.5.14-4~) for the dbus activation. - add myself to Uploaders. [ Yves-Alexis Perez ] * debian/control: - update standards version to 3.9.1. -- Lionel Le Folgoc Sat, 19 Feb 2011 22:39:26 +0100 xfce4-power-manager (0.8.5-2) unstable; urgency=low * debian/control: - add recommends on consolekit so user gets the authorization to suspend/hibernate. closes: #603325 -- Yves-Alexis Perez Sat, 13 Nov 2010 13:48:37 +0100 xfce4-power-manager (0.8.5-1) unstable; urgency=low * New upstream release. * debian/control: - update standards version to 3.8.4. - update obsolete relation form < to <<. -- Yves-Alexis Perez Tue, 02 Mar 2010 23:19:53 +0100 xfce4-power-manager (0.8.4.2-1) unstable; urgency=low * New upstream release. -- Yves-Alexis Perez Sat, 21 Nov 2009 14:37:32 +0100 xfce4-power-manager (0.8.4.1-1) unstable; urgency=low * New upstream release. - fix xfpm crashing when closing LID. closes: #552692 - allow setting lower value in battery warnings. closes: #549207 - fix FTBFS when building twice in a row. closes: #549650 * debian/xfce4-power-manager.xml: ship a default config to ask user when pressing the power button. closes: #544858 -- Yves-Alexis Perez Mon, 02 Nov 2009 22:20:58 +0100 xfce4-power-manager (0.8.4-1) unstable; urgency=low * New upstream release. * debian/control: - add Recommends on librsvg2-common, all icons are svg. - update standards version to 3.8.3. -- Yves-Alexis Perez Tue, 29 Sep 2009 11:33:13 +0200 xfce4-power-manager (0.8.3.1-1) unstable; urgency=low * New upstream bugfix release. * debian/watch edited to track Xfce archive reorganisation. -- Yves-Alexis Perez Mon, 10 Aug 2009 08:25:55 +0200 xfce4-power-manager (0.8.3-1) unstable; urgency=low * New upstream release. -- Yves-Alexis Perez Mon, 03 Aug 2009 15:20:09 +0200 xfce4-power-manager (0.8.2-1) unstable; urgency=low * New upstream release. -- Yves-Alexis Perez Thu, 09 Jul 2009 23:41:28 +0200 xfce4-power-manager (0.8.1.1-1) unstable; urgency=low [ Evgeni Golov ] * Fix Vcs-* fields, they were missing 'trunk' in the path. [ Yves-Alexis Perez ] * New upstream release. * debian/control: - drop build-dep on libglade. - update standards version to 3.8.2. -- Yves-Alexis Perez Tue, 07 Jul 2009 00:29:41 +0200 xfce4-power-manager (0.8.0-1) unstable; urgency=low * New upstream release. * debian/control: - update long description, thanks to Gerfried Fuchs. closes: #531812 -- Yves-Alexis Perez Tue, 09 Jun 2009 23:25:26 +0200 xfce4-power-manager (0.8.0~rc2-4) unstable; urgency=low * debian/rules: - don't use --fail-missing in dh_install since we have an arch:all package. Fixes FTBFS on all arches. closes: #530399 -- Yves-Alexis Perez Sun, 24 May 2009 18:37:32 +0200 xfce4-power-manager (0.8.0~rc2-3) unstable; urgency=low * *really* upload to unstable this time. -- Yves-Alexis Perez Thu, 21 May 2009 12:10:21 +0200 xfce4-power-manager (0.8.0~rc2-2) experimental; urgency=low * Upload to unstable. * debian/control: - update -plugins description now that inhibit was moved to the main program. -- Yves-Alexis Perez Thu, 21 May 2009 01:22:31 +0200 xfce4-power-manager (0.8.0~rc2-1) experimental; urgency=low [ Yves-Alexis Perez ] * New upstream beta release. * debian/control: - update standards version to 3.8.1. - add build-dep on libglade2-dev. - add build-dep on xfce4-panel-dev for panel plugins. - add a new package for the panel plugins. - add a new package for arch-indep files. - move to xfce section. - drop libhal-dev build-dep, now useless. - add dep on hal. * debian/rules: - run dh_install with --fail-missing. - add -Wl,-z,defs -Wl,--as-needed to LDFLAGS. * debian/copyright: update dates and copyright holders. * debian/xfce4-power-manager.install: - install manpages in xfpm package. * debian/xfce4-power-manager.1 dropped, included upstream. * debian/xfce4-power-manager.manpages dropped, useless. [ Evgeni Golov ] * debian/control: - fix depends of -plugins -- Yves-Alexis Perez Tue, 19 May 2009 23:49:06 +0200 xfce4-power-manager (0.6.2-1) experimental; urgency=low * Initial release. closes: #503636 -- Yves-Alexis Perez Sat, 28 Feb 2009 23:59:10 +0100 debian/xfce4-power-information.10000664000000000000000000000221412320537603013740 0ustar .TH XFCE4-POWER-INFORMATION "1" "August 2013" "xfce4-power-information " "User Commands" .SH NAME xfce4-power-information \- Find information about your computer's power usage .SH DESCRIPTION .SS "Usage:" .IP xfce4\-power\-information [OPTION...] .SS "Help Options:" .TP \fB\-h\fR, \fB\-\-help\fR Show help options .TP \fB\-\-help\-all\fR Show all help options .TP \fB\-\-help\-gtk\fR Show GTK+ Options .PP GTK+ Options .TP \fB\-\-class\fR=\fICLASS\fR Program class as used by the window manager .TP \fB\-\-name\fR=\fINAME\fR Program name as used by the window manager .TP \fB\-\-screen\fR=\fISCREEN\fR X screen to use .TP \fB\-\-sync\fR Make X calls synchronous .TP \fB\-\-gtk\-module\fR=\fIMODULES\fR Load additional GTK+ modules .TP \fB\-\-g\-fatal\-warnings\fR Make all warnings fatal .SS "Application Options:" .TP \fB\-V\fR, \fB\-\-version\fR Version information .TP \fB\-\-display\fR=\fIDISPLAY\fR X display to use .PP Xfce Power Manager 1.2.0 .PP Part of the Xfce Goodies Project http://goodies.xfce.org .PP Licensed under the GNU GPL. .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fIxfce4-power-manager\fR\|(7) .PP This program is a part of xfce4-power-manager.debian/source/0000775000000000000000000000000012320537603010471 5ustar debian/source/format0000664000000000000000000000001412320537603011677 0ustar 3.0 (quilt) debian/source/options0000664000000000000000000000010112320537603012077 0ustar extend-diff-ignore = "(^|/)(config\.sub|config\.guess|Makefile)$"debian/compat0000664000000000000000000000000212320537603010367 0ustar 9 debian/xfpm-power-backlight-helper.10000664000000000000000000000130312320537603014557 0ustar .TH XFPM-POWER-BACKLIGHT-HELPER "1" "August 2013" "xfpm-power-backlight-helper" "User Commands" .SH NAME xfpm-power-backlight-helper \- control the brightness from the command line .SH DESCRIPTION .SS "Usage:" .IP xfpm\-power\-backlight\-helper [OPTION...] .PP XFCE Power Manager Backlight Helper .SS "Help Options:" .TP \fB\-h\fR, \fB\-\-help\fR Show help options .SS "Application Options:" .TP \fB\-\-set\-brightness\fR Set the current brightness .TP \fB\-\-get\-brightness\fR Get the current brightness .TP \fB\-\-get\-max\-brightness\fR Get the number of brightness levels supported .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fIxfce4-power-manager\fR\|(7) .PP This program is a part of xfce4-power-manager.debian/patches/0000775000000000000000000000000012344326614010624 5ustar debian/patches/06_fix-suspend-auth-check.patch0000664000000000000000000000152712320537603016432 0ustar Description: Fix incorrect check for suspend permissions The suspend button is wrongly made sensitive when the user has the permission to hibernate… It should check the suspend permissions instead. Origin: other, https://bugzilla.xfce.org/attachment.cgi?id=4178 Bug: https://bugzilla.xfce.org/show_bug.cgi?id=8438 Bug-Ubuntu: https://bugs.launchpad.net/xfce4-power-manager/+bug/929537 --- src/xfpm-power.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/src/xfpm-power.c +++ b/src/xfpm-power.c @@ -509,7 +509,7 @@ xfpm_power_show_tray_menu (XfpmPower *po gtk_widget_set_sensitive (mi, FALSE); - if ( power->priv->can_suspend && power->priv->auth_hibernate) + if ( power->priv->can_suspend && power->priv->auth_suspend) { gtk_widget_set_sensitive (mi, TRUE); g_signal_connect_swapped (mi, "activate", debian/patches/04_fix-missing-icons-for-non-system-batteries.patch0000664000000000000000000000157112320537603022374 0ustar index 763b014..6b1bd76 100644 --- a/src/xfpm-battery.c +++ b/src/xfpm-battery.c @@ -320,15 +320,15 @@ xfpm_battery_refresh_icon (XfpmBattery * { if ( !battery->priv->present || battery->priv->state == XFPM_DEVICE_STATE_EMPTY ) { - g_snprintf (icon_name, 128, "%s-000", battery->priv->icon_prefix); + g_snprintf (icon_name, 128, "%s000", battery->priv->icon_prefix); } else if ( battery->priv->state == XFPM_DEVICE_STATE_FULLY_CHARGED ) { - g_snprintf (icon_name, 128, "%s-100", battery->priv->icon_prefix); + g_snprintf (icon_name, 128, "%s100", battery->priv->icon_prefix); } else if ( battery->priv->state == XFPM_DEVICE_STATE_DISCHARGING ) { - g_snprintf (icon_name, 128, "%s-%s", + g_snprintf (icon_name, 128, "%s%s", battery->priv->icon_prefix, xfpm_battery_get_icon_index (battery->priv->type, battery->priv->percentage)); } debian/patches/09_sync_session_xfpm_lock_setting.patch0000664000000000000000000001026312320537626020476 0ustar Description: Sync the lock settings from xfce4-session and xfce4-power-manager xfce4-session and xfce4-power-manager both have options to lock the screen on suspend. However, these options are not synced and can lead to some confusion for the user. This patch syncs these settings from the power manager. Origin: other, https://github.com/EricKoegel/xfce4-power-manager/tree/be-friendly Bug: https://bugzilla.xfce.org/show_bug.cgi?id=9030 Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/xfce4-power-manager/+bug/1101982 --- --- a/settings/xfpm-settings.c +++ b/settings/xfpm-settings.c @@ -728,8 +728,14 @@ void lock_screen_toggled_cb (GtkWidget *w, XfconfChannel *channel) { + XfconfChannel *session_channel = xfconf_channel_get ("xfce4-session"); gboolean val = (gint) gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(w)); - + + if ( !xfconf_channel_set_bool (session_channel, "/shutdown/LockScreen", val) ) + { + g_critical ("Unable to set value for property %s\n", LOCK_SCREEN_ON_SLEEP); + } + if ( !xfconf_channel_set_bool (channel, PROPERTIES_PREFIX LOCK_SCREEN_ON_SLEEP, val) ) { g_critical ("Unable to set value for property %s\n", LOCK_SCREEN_ON_SLEEP); --- a/src/xfpm-xfconf.c +++ b/src/xfpm-xfconf.c @@ -44,6 +44,7 @@ struct XfpmXfconfPrivate { XfconfChannel *channel; + XfconfChannel *session_channel; GValue *values; }; @@ -180,12 +181,37 @@ if ( !g_str_has_prefix (property, PROPERTIES_PREFIX) || strlen (property) <= strlen (PROPERTIES_PREFIX) ) return; - XFPM_DEBUG("Property modified: %s\n", property); + XFPM_DEBUG ("Property modified: %s\n", property); g_object_set_property (G_OBJECT (conf), property + strlen (PROPERTIES_PREFIX), value); } static void +xfpm_xfsession_property_changed_cb (XfconfChannel *channel, gchar *property, + GValue *value, XfpmXfconf *conf) +{ + /*FIXME: Set default for this key*/ + if ( G_VALUE_TYPE(value) == G_TYPE_INVALID ) + return; + + XFPM_DEBUG ("property %s\n", property); + + if ( g_strcmp0 (property, "/shutdown/LockScreen") != 0) + return; + + /* sanity check */ + if ( !G_VALUE_HOLDS (value, G_TYPE_BOOLEAN) ) + return; + + XFPM_DEBUG ("Property modified: %s\n", property); + + /* update xfconf which will update xfpm and keep things in sync */ + xfconf_channel_set_bool (conf->priv->channel, + PROPERTIES_PREFIX LOCK_SCREEN_ON_SLEEP, + g_value_get_boolean(value)); +} + +static void xfpm_xfconf_class_init (XfpmXfconfClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS(klass); @@ -543,6 +569,7 @@ { GError *error = NULL; gboolean channel_valid; + gboolean lock_screen; conf->priv = XFPM_XFCONF_GET_PRIVATE (conf); @@ -557,9 +584,27 @@ else { conf->priv->channel = xfconf_channel_new ("xfce4-power-manager"); + conf->priv->session_channel = xfconf_channel_new ("xfce4-session"); + + /* if xfce4-session is around, sync to it on startup */ + if ( xfconf_channel_has_property (conf->priv->session_channel, "/shutdown/LockScreen") ) + { + lock_screen = xfconf_channel_get_bool (conf->priv->session_channel, + "/shutdown/LockScreen", + TRUE); + + XFPM_DEBUG("lock screen %s", lock_screen ? "TRUE" : "FALSE"); + + g_object_set (G_OBJECT (conf), LOCK_SCREEN_ON_SLEEP, lock_screen, NULL); + } g_signal_connect (conf->priv->channel, "property-changed", G_CALLBACK (xfpm_xfconf_property_changed_cb), conf); + + /* watch for session's property change so we can stay in sync */ + g_signal_connect (conf->priv->session_channel, "property-changed", + G_CALLBACK (xfpm_xfsession_property_changed_cb), conf); + channel_valid = TRUE; } xfpm_xfconf_load (conf, channel_valid); @@ -583,7 +628,10 @@ if (conf->priv->channel ) g_object_unref (conf->priv->channel); - + + if (conf->priv->session_channel ) + g_object_unref (conf->priv->session_channel); + G_OBJECT_CLASS(xfpm_xfconf_parent_class)->finalize(object); } debian/patches/series0000664000000000000000000000072512344326614012045 0ustar 01_Remove_custom_OSD_brightness_popup,_use_libnotify_instead.patch 02_translations-fix-invalid-format-strings.patch 03_fix-insert-battery.patch 04_fix-missing-icons-for-non-system-batteries.patch 05_dont-allow-systemd-to-handle-suspend-hibernate-events.patch 06_add-shutdown-reboot-functionality-for-systemd.patch 06_fix-suspend-auth-check.patch 07_fix-screen-dimming.patch 08_show_preferences_lxde.patch 09_sync_session_xfpm_lock_setting.patch 10_inhibit_logind.patch debian/patches/01_Remove_custom_OSD_brightness_popup,_use_libnotify_instead.patch0000664000000000000000000013634512320537603025702 0ustar From: Jannis Pohlmann To: xfce4-dev@xfce.org Subject: [PATCH] Remove custom OSD brightness popup, use libnotify instead The custom rendered OSD popup to indicate the current brightness state whenever it changed looked nice but it is better handled in the notification daemon. E.g. we could include an extension hint in the notification to have xfce4-notifyd render certain notifications (e.g. brightness, volume changes) in a different style than regular notifications. This commit simplifies the whole brightness notification logic quite a bit. Signed-off-by: Jannis Pohlmann --- src/Makefile.am | 4 +- src/gsd-media-keys-window.c | 1078 ------------------------------------------- src/gsd-media-keys-window.h | 71 --- src/xfpm-backlight.c | 128 +---- src/xfpm-notify.c | 2 +- 5 files changed, 19 insertions(+), 1264 deletions(-) delete mode 100644 src/gsd-media-keys-window.c delete mode 100644 src/gsd-media-keys-window.h Index: xfce4-power-manager/src/Makefile.am =================================================================== --- xfce4-power-manager.orig/src/Makefile.am 2013-08-13 06:54:51.885791748 +1000 +++ xfce4-power-manager/src/Makefile.am 2013-08-13 06:54:51.881791728 +1000 @@ -37,9 +37,7 @@ xfpm-polkit.c \ xfpm-polkit.h \ xfpm-errors.c \ - xfpm-errors.h \ - gsd-media-keys-window.c \ - gsd-media-keys-window.h + xfpm-errors.h xfce4_power_manager_CFLAGS = \ -I$(top_srcdir) \ Index: xfce4-power-manager/src/gsd-media-keys-window.c =================================================================== --- xfce4-power-manager.orig/src/gsd-media-keys-window.c 2013-08-13 06:54:51.885791748 +1000 +++ /dev/null 1970-01-01 00:00:00.000000000 +0000 @@ -1,1078 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- - * - * Copyright (C) 2006-2007 William Jon McCann - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - */ - -#include "config.h" - -#include -#include -#include -#include -#include -#include - -#include "gsd-media-keys-window.h" - -#include "data/interfaces/acme_ui.h" - -#define DIALOG_TIMEOUT 2000 /* dialog timeout in ms */ -#define DIALOG_FADE_TIMEOUT 1500 /* timeout before fade starts */ -#define FADE_TIMEOUT 10 /* timeout in ms between each frame of the fade */ - -#define BG_ALPHA 0.75 -#define FG_ALPHA 1.00 - -#define GSD_MEDIA_KEYS_WINDOW_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_MEDIA_KEYS_WINDOW, GsdMediaKeysWindowPrivate)) - -struct GsdMediaKeysWindowPrivate -{ - guint is_composited : 1; - guint hide_timeout_id; - guint fade_timeout_id; - double fade_out_alpha; - GsdMediaKeysWindowAction action; - char *icon_name; - gboolean show_level; - - guint volume_muted : 1; - int volume_level; - - GtkImage *image; - GtkWidget *progress; -}; - -G_DEFINE_TYPE (GsdMediaKeysWindow, gsd_media_keys_window, GTK_TYPE_WINDOW) - -static gboolean -fade_timeout (GsdMediaKeysWindow *window) -{ - if (window->priv->fade_out_alpha <= 0.0) { - gtk_widget_hide (GTK_WIDGET (window)); - - /* Reset it for the next time */ - window->priv->fade_out_alpha = 1.0; - window->priv->fade_timeout_id = 0; - - return FALSE; - } else { - GdkRectangle rect; - GtkWidget *win = GTK_WIDGET (window); - GtkAllocation allocation; - - window->priv->fade_out_alpha -= 0.10; - - rect.x = 0; - rect.y = 0; - gtk_widget_get_allocation (win, &allocation); - rect.width = allocation.width; - rect.height = allocation.height; - - gtk_widget_realize (win); - gdk_window_invalidate_rect (gtk_widget_get_window (win), &rect, FALSE); - } - - return TRUE; -} - -static gboolean -hide_timeout (GsdMediaKeysWindow *window) -{ - if (window->priv->is_composited) { - window->priv->hide_timeout_id = 0; - window->priv->fade_timeout_id = g_timeout_add (FADE_TIMEOUT, - (GSourceFunc) fade_timeout, - window); - } else { - gtk_widget_hide (GTK_WIDGET (window)); - } - - return FALSE; -} - -static void -remove_hide_timeout (GsdMediaKeysWindow *window) -{ - if (window->priv->hide_timeout_id != 0) { - g_source_remove (window->priv->hide_timeout_id); - window->priv->hide_timeout_id = 0; - } - - if (window->priv->fade_timeout_id != 0) { - g_source_remove (window->priv->fade_timeout_id); - window->priv->fade_timeout_id = 0; - window->priv->fade_out_alpha = 1.0; - } -} - -static void -add_hide_timeout (GsdMediaKeysWindow *window) -{ - int timeout; - - if (window->priv->is_composited) { - timeout = DIALOG_FADE_TIMEOUT; - } else { - timeout = DIALOG_TIMEOUT; - } - window->priv->hide_timeout_id = g_timeout_add (timeout, - (GSourceFunc) hide_timeout, - window); -} - -static void -update_window (GsdMediaKeysWindow *window) -{ - remove_hide_timeout (window); - add_hide_timeout (window); - - if (window->priv->is_composited) { - gtk_widget_queue_draw (GTK_WIDGET (window)); - } -} - -static void -volume_controls_set_visible (GsdMediaKeysWindow *window, - gboolean visible) -{ - if (window->priv->progress == NULL) - return; - - if (visible) { - gtk_widget_show (window->priv->progress); - } else { - gtk_widget_hide (window->priv->progress); - } -} - -static void -window_set_icon_name (GsdMediaKeysWindow *window, - const char *name) -{ - if (window->priv->image == NULL) - return; - - gtk_image_set_from_icon_name (window->priv->image, - name, GTK_ICON_SIZE_DIALOG); -} - -static void -action_changed (GsdMediaKeysWindow *window) -{ - if (! window->priv->is_composited) { - switch (window->priv->action) { - case GSD_MEDIA_KEYS_WINDOW_ACTION_VOLUME: - volume_controls_set_visible (window, TRUE); - - if (window->priv->volume_muted) { - window_set_icon_name (window, "audio-volume-muted"); - } else { - window_set_icon_name (window, "audio-volume-high"); - } - - break; - case GSD_MEDIA_KEYS_WINDOW_ACTION_CUSTOM: - volume_controls_set_visible (window, window->priv->show_level); - window_set_icon_name (window, window->priv->icon_name); - break; - default: - g_assert_not_reached (); - break; - } - } - - update_window (window); -} - -static void -volume_level_changed (GsdMediaKeysWindow *window) -{ - update_window (window); - - if (!window->priv->is_composited && window->priv->progress != NULL) { - double fraction; - - fraction = (double) window->priv->volume_level / 100.0; - - gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (window->priv->progress), - fraction); - } -} - -static void -volume_muted_changed (GsdMediaKeysWindow *window) -{ - update_window (window); - - if (! window->priv->is_composited) { - if (window->priv->volume_muted) { - window_set_icon_name (window, "audio-volume-muted"); - } else { - window_set_icon_name (window, "audio-volume-high"); - } - } -} - -void -gsd_media_keys_window_set_action (GsdMediaKeysWindow *window, - GsdMediaKeysWindowAction action) -{ - g_return_if_fail (GSD_IS_MEDIA_KEYS_WINDOW (window)); - g_return_if_fail (action == GSD_MEDIA_KEYS_WINDOW_ACTION_VOLUME); - - if (window->priv->action != action) { - window->priv->action = action; - action_changed (window); - } else { - update_window (window); - } -} - -void -gsd_media_keys_window_set_action_custom (GsdMediaKeysWindow *window, - const char *icon_name, - gboolean show_level) -{ - g_return_if_fail (GSD_IS_MEDIA_KEYS_WINDOW (window)); - g_return_if_fail (icon_name != NULL); - - if (window->priv->action != GSD_MEDIA_KEYS_WINDOW_ACTION_CUSTOM || - g_strcmp0 (window->priv->icon_name, icon_name) != 0 || - window->priv->show_level != show_level) { - window->priv->action = GSD_MEDIA_KEYS_WINDOW_ACTION_CUSTOM; - g_free (window->priv->icon_name); - window->priv->icon_name = g_strdup (icon_name); - window->priv->show_level = show_level; - action_changed (window); - } else { - update_window (window); - } -} - -void -gsd_media_keys_window_set_volume_muted (GsdMediaKeysWindow *window, - gboolean muted) -{ - g_return_if_fail (GSD_IS_MEDIA_KEYS_WINDOW (window)); - - if (window->priv->volume_muted != muted) { - window->priv->volume_muted = muted; - volume_muted_changed (window); - } -} - -void -gsd_media_keys_window_set_volume_level (GsdMediaKeysWindow *window, - int level) -{ - g_return_if_fail (GSD_IS_MEDIA_KEYS_WINDOW (window)); - - if (window->priv->volume_level != level) { - window->priv->volume_level = level; - volume_level_changed (window); - } -} - -static void -rounded_rectangle (cairo_t* cr, - gdouble aspect, - gdouble x, - gdouble y, - gdouble corner_radius, - gdouble width, - gdouble height) -{ - gdouble radius = corner_radius / aspect; - - cairo_move_to (cr, x + radius, y); - - cairo_line_to (cr, - x + width - radius, - y); - cairo_arc (cr, - x + width - radius, - y + radius, - radius, - -90.0f * G_PI / 180.0f, - 0.0f * G_PI / 180.0f); - cairo_line_to (cr, - x + width, - y + height - radius); - cairo_arc (cr, - x + width - radius, - y + height - radius, - radius, - 0.0f * G_PI / 180.0f, - 90.0f * G_PI / 180.0f); - cairo_line_to (cr, - x + radius, - y + height); - cairo_arc (cr, - x + radius, - y + height - radius, - radius, - 90.0f * G_PI / 180.0f, - 180.0f * G_PI / 180.0f); - cairo_line_to (cr, - x, - y + radius); - cairo_arc (cr, - x + radius, - y + radius, - radius, - 180.0f * G_PI / 180.0f, - 270.0f * G_PI / 180.0f); - cairo_close_path (cr); -} - -static GdkPixbuf * -load_pixbuf (GsdMediaKeysWindow *window, - const char *name, - int icon_size) -{ - GtkIconTheme *theme; - GdkPixbuf *pixbuf; - - if (window != NULL && gtk_widget_has_screen (GTK_WIDGET (window))) { - theme = gtk_icon_theme_get_for_screen (gtk_widget_get_screen (GTK_WIDGET (window))); - } else { - theme = gtk_icon_theme_get_default (); - } - - pixbuf = gtk_icon_theme_load_icon (theme, - name, - icon_size, - GTK_ICON_LOOKUP_FORCE_SVG, - NULL); - - /* make sure the pixbuf is close to the requested size - * this is necessary because GTK_ICON_LOOKUP_FORCE_SVG - * seems to be broken */ - if (pixbuf != NULL) { - int width; - - width = gdk_pixbuf_get_width (pixbuf); - if (width < (float)icon_size * 0.75) { - g_object_unref (pixbuf); - pixbuf = NULL; - } - } - - return pixbuf; -} - -static void -draw_eject (cairo_t *cr, - double _x0, - double _y0, - double width, - double height) -{ - int box_height; - int tri_height; - int separation; - - box_height = height * 0.2; - separation = box_height / 3; - tri_height = height - box_height - separation; - - cairo_rectangle (cr, _x0, _y0 + height - box_height, width, box_height); - - cairo_move_to (cr, _x0, _y0 + tri_height); - cairo_rel_line_to (cr, width, 0); - cairo_rel_line_to (cr, -width / 2, -tri_height); - cairo_rel_line_to (cr, -width / 2, tri_height); - cairo_close_path (cr); - cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, FG_ALPHA); - cairo_fill_preserve (cr); - - cairo_set_source_rgba (cr, 0.6, 0.6, 0.6, FG_ALPHA / 2); - cairo_set_line_width (cr, 2); - cairo_stroke (cr); -} - -static void -draw_waves (cairo_t *cr, - double cx, - double cy, - double max_radius, - int volume_level) -{ - const int n_waves = 3; - int last_wave; - int i; - - last_wave = n_waves * volume_level / 100; - - for (i = 0; i < n_waves; i++) { - double angle1; - double angle2; - double radius; - double alpha; - - angle1 = -M_PI / 4; - angle2 = M_PI / 4; - - if (i < last_wave) - alpha = 1.0; - else if (i > last_wave) - alpha = 0.1; - else alpha = 0.1 + 0.9 * (n_waves * volume_level % 100) / 100.0; - - radius = (i + 1) * (max_radius / n_waves); - cairo_arc (cr, cx, cy, radius, angle1, angle2); - cairo_set_source_rgba (cr, 0.6, 0.6, 0.6, alpha / 2); - cairo_set_line_width (cr, 14); - cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND); - cairo_stroke_preserve (cr); - - cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, alpha); - cairo_set_line_width (cr, 10); - cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND); - cairo_stroke (cr); - } -} - -static void -draw_cross (cairo_t *cr, - double cx, - double cy, - double size) -{ - cairo_move_to (cr, cx, cy - size/2.0); - cairo_rel_line_to (cr, size, size); - - cairo_move_to (cr, cx, cy + size/2.0); - cairo_rel_line_to (cr, size, -size); - - cairo_set_source_rgba (cr, 0.6, 0.6, 0.6, FG_ALPHA / 2); - cairo_set_line_width (cr, 14); - cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND); - cairo_stroke_preserve (cr); - - cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, FG_ALPHA); - cairo_set_line_width (cr, 10); - cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND); - cairo_stroke (cr); -} - -static void -draw_speaker (cairo_t *cr, - double cx, - double cy, - double width, - double height) -{ - double box_width; - double box_height; - double _x0; - double _y0; - - box_width = width / 3; - box_height = height / 3; - - _x0 = cx - (width / 2) + box_width; - _y0 = cy - box_height / 2; - - cairo_move_to (cr, _x0, _y0); - cairo_rel_line_to (cr, - box_width, 0); - cairo_rel_line_to (cr, 0, box_height); - cairo_rel_line_to (cr, box_width, 0); - - cairo_line_to (cr, cx + box_width, cy + height / 2); - cairo_rel_line_to (cr, 0, -height); - cairo_line_to (cr, _x0, _y0); - cairo_close_path (cr); - - cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, FG_ALPHA); - cairo_fill_preserve (cr); - - cairo_set_source_rgba (cr, 0.6, 0.6, 0.6, FG_ALPHA / 2); - cairo_set_line_width (cr, 2); - cairo_stroke (cr); -} - -static gboolean -render_speaker (GsdMediaKeysWindow *window, - cairo_t *cr, - double _x0, - double _y0, - double width, - double height) -{ - GdkPixbuf *pixbuf; - int icon_size; - int n; - static const char *icon_names[] = { - "audio-volume-muted", - "audio-volume-low", - "audio-volume-medium", - "audio-volume-high", - NULL - }; - - if (window->priv->volume_muted) { - n = 0; - } else { - /* select image */ - n = 3 * window->priv->volume_level / 100 + 1; - if (n < 1) { - n = 1; - } else if (n > 3) { - n = 3; - } - } - - icon_size = (int)width; - - pixbuf = load_pixbuf (window, icon_names[n], icon_size); - - if (pixbuf == NULL) { - return FALSE; - } - - gdk_cairo_set_source_pixbuf (cr, pixbuf, _x0, _y0); - cairo_paint_with_alpha (cr, FG_ALPHA); - - g_object_unref (pixbuf); - - return TRUE; -} - -static void -color_reverse (const GdkColor *a, - GdkColor *b) -{ - gdouble red; - gdouble green; - gdouble blue; - gdouble h; - gdouble s; - gdouble v; - - red = (gdouble) a->red / 65535.0; - green = (gdouble) a->green / 65535.0; - blue = (gdouble) a->blue / 65535.0; - - gtk_rgb_to_hsv (red, green, blue, &h, &s, &v); - - v = 0.5 + (0.5 - v); - if (v > 1.0) - v = 1.0; - else if (v < 0.0) - v = 0.0; - - gtk_hsv_to_rgb (h, s, v, &red, &green, &blue); - - b->red = red * 65535.0; - b->green = green * 65535.0; - b->blue = blue * 65535.0; -} - -static void -draw_volume_boxes (GsdMediaKeysWindow *window, - cairo_t *cr, - double percentage, - double _x0, - double _y0, - double width, - double height) -{ - gdouble x1; - GdkColor color; - double r, g, b; - GtkStyle *style; - - _x0 += 0.5; - _y0 += 0.5; - height = round (height) - 1; - width = round (width) - 1; - x1 = round ((width - 1) * percentage); - style = gtk_widget_get_style (GTK_WIDGET (window)); - - /* bar background */ - color_reverse (&style->dark[GTK_STATE_NORMAL], &color); - r = (float)color.red / 65535.0; - g = (float)color.green / 65535.0; - b = (float)color.blue / 65535.0; - rounded_rectangle (cr, 1.0, _x0, _y0, height / 6, width, height); - cairo_set_source_rgba (cr, r, g, b, FG_ALPHA / 2); - cairo_fill_preserve (cr); - - /* bar border */ - color_reverse (&style->light[GTK_STATE_NORMAL], &color); - r = (float)color.red / 65535.0; - g = (float)color.green / 65535.0; - b = (float)color.blue / 65535.0; - cairo_set_source_rgba (cr, r, g, b, FG_ALPHA / 2); - cairo_set_line_width (cr, 1); - cairo_stroke (cr); - - /* bar progress */ - if (percentage < 0.01) - return; - color = style->bg[GTK_STATE_NORMAL]; - r = (float)color.red / 65535.0; - g = (float)color.green / 65535.0; - b = (float)color.blue / 65535.0; - rounded_rectangle (cr, 1.0, _x0 + 0.5, _y0 + 0.5, height / 6 - 0.5, x1, height - 1); - cairo_set_source_rgba (cr, r, g, b, FG_ALPHA); - cairo_fill (cr); -} - -static void -draw_action_volume (GsdMediaKeysWindow *window, - cairo_t *cr) -{ - int window_width; - int window_height; - double icon_box_width; - double icon_box_height; - double icon_box_x0; - double icon_box_y0; - double volume_box_x0; - double volume_box_y0; - double volume_box_width; - double volume_box_height; - gboolean res; - - gtk_window_get_size (GTK_WINDOW (window), &window_width, &window_height); - - icon_box_width = round (window_width * 0.65); - icon_box_height = round (window_height * 0.65); - volume_box_width = icon_box_width; - volume_box_height = round (window_height * 0.05); - - icon_box_x0 = (window_width - icon_box_width) / 2; - icon_box_y0 = (window_height - icon_box_height - volume_box_height) / 2; - volume_box_x0 = round (icon_box_x0); - volume_box_y0 = round (icon_box_height + icon_box_y0); - -#if 0 - g_message ("icon box: w=%f h=%f _x0=%f _y0=%f", - icon_box_width, - icon_box_height, - icon_box_x0, - icon_box_y0); - g_message ("volume box: w=%f h=%f _x0=%f _y0=%f", - volume_box_width, - volume_box_height, - volume_box_x0, - volume_box_y0); -#endif - - res = render_speaker (window, - cr, - icon_box_x0, icon_box_y0, - icon_box_width, icon_box_height); - if (! res) { - double speaker_width; - double speaker_height; - double speaker_cx; - double speaker_cy; - - speaker_width = icon_box_width * 0.5; - speaker_height = icon_box_height * 0.75; - speaker_cx = icon_box_x0 + speaker_width / 2; - speaker_cy = icon_box_y0 + speaker_height / 2; - -#if 0 - g_message ("speaker box: w=%f h=%f cx=%f cy=%f", - speaker_width, - speaker_height, - speaker_cx, - speaker_cy); -#endif - - /* draw speaker symbol */ - draw_speaker (cr, speaker_cx, speaker_cy, speaker_width, speaker_height); - - if (! window->priv->volume_muted) { - /* draw sound waves */ - double wave_x0; - double wave_y0; - double wave_radius; - - wave_x0 = window_width / 2; - wave_y0 = speaker_cy; - wave_radius = icon_box_width / 2; - - draw_waves (cr, wave_x0, wave_y0, wave_radius, window->priv->volume_level); - } else { - /* draw 'mute' cross */ - double cross_x0; - double cross_y0; - double cross_size; - - cross_size = speaker_width * 3 / 4; - cross_x0 = icon_box_x0 + icon_box_width - cross_size; - cross_y0 = speaker_cy; - - draw_cross (cr, cross_x0, cross_y0, cross_size); - } - } - - /* draw volume meter */ - draw_volume_boxes (window, - cr, - (double)window->priv->volume_level / 100.0, - volume_box_x0, - volume_box_y0, - volume_box_width, - volume_box_height); -} - -static gboolean -render_custom (GsdMediaKeysWindow *window, - cairo_t *cr, - double _x0, - double _y0, - double width, - double height) -{ - GdkPixbuf *pixbuf; - int icon_size; - - icon_size = (int)width; - - pixbuf = load_pixbuf (window, window->priv->icon_name, icon_size); - - if (pixbuf == NULL) { - char *name; - if (gtk_widget_get_direction (GTK_WIDGET (window)) == GTK_TEXT_DIR_RTL) - name = g_strdup_printf ("%s-rtl", window->priv->icon_name); - else - name = g_strdup_printf ("%s-ltr", window->priv->icon_name); - pixbuf = load_pixbuf (window, name, icon_size); - g_free (name); - if (pixbuf == NULL) - return FALSE; - } - - gdk_cairo_set_source_pixbuf (cr, pixbuf, _x0, _y0); - cairo_paint_with_alpha (cr, FG_ALPHA); - - g_object_unref (pixbuf); - - return TRUE; -} - -static void -draw_action_custom (GsdMediaKeysWindow *window, - cairo_t *cr) -{ - int window_width; - int window_height; - double icon_box_width; - double icon_box_height; - double icon_box_x0; - double icon_box_y0; - double bright_box_x0; - double bright_box_y0; - double bright_box_width; - double bright_box_height; - gboolean res; - - gtk_window_get_size (GTK_WINDOW (window), &window_width, &window_height); - - icon_box_width = round (window_width * 0.65); - icon_box_height = round (window_height * 0.65); - bright_box_width = round (icon_box_width); - bright_box_height = round (window_height * 0.05); - - icon_box_x0 = (window_width - icon_box_width) / 2; - icon_box_y0 = (window_height - icon_box_height - bright_box_height) / 2; - bright_box_x0 = round (icon_box_x0); - bright_box_y0 = round (icon_box_height + icon_box_y0); - -#if 0 - g_message ("icon box: w=%f h=%f _x0=%f _y0=%f", - icon_box_width, - icon_box_height, - icon_box_x0, - icon_box_y0); - g_message ("brightness box: w=%f h=%f _x0=%f _y0=%f", - bright_box_width, - bright_box_height, - bright_box_x0, - bright_box_y0); -#endif - - res = render_custom (window, - cr, - icon_box_x0, icon_box_y0, - icon_box_width, icon_box_height); - if (! res && g_strcmp0 (window->priv->icon_name, "media-eject") == 0) { - /* draw eject symbol */ - draw_eject (cr, - icon_box_x0, icon_box_y0, - icon_box_width, icon_box_height); - } - - if (window->priv->show_level != FALSE) { - /* draw volume meter */ - draw_volume_boxes (window, - cr, - (double)window->priv->volume_level / 100.0, - bright_box_x0, - bright_box_y0, - bright_box_width, - bright_box_height); - } -} - -static void -draw_action (GsdMediaKeysWindow *window, - cairo_t *cr) -{ - switch (window->priv->action) { - case GSD_MEDIA_KEYS_WINDOW_ACTION_VOLUME: - draw_action_volume (window, cr); - break; - case GSD_MEDIA_KEYS_WINDOW_ACTION_CUSTOM: - draw_action_custom (window, cr); - break; - default: - break; - } -} - -static gboolean -on_expose_event (GtkWidget *widget, - GdkEventExpose *event, - GsdMediaKeysWindow *window) -{ - cairo_t *context; - cairo_t *cr; - cairo_surface_t *surface; - int width; - int height; - GtkStyle *style; - GdkColor color; - double r, g, b; - - context = gdk_cairo_create (gtk_widget_get_window (widget)); - - style = gtk_widget_get_style (widget); - cairo_set_operator (context, CAIRO_OPERATOR_SOURCE); - gtk_window_get_size (GTK_WINDOW (widget), &width, &height); - - surface = cairo_surface_create_similar (cairo_get_target (context), - CAIRO_CONTENT_COLOR_ALPHA, - width, - height); - - if (cairo_surface_status (surface) != CAIRO_STATUS_SUCCESS) { - goto done; - } - - cr = cairo_create (surface); - if (cairo_status (cr) != CAIRO_STATUS_SUCCESS) { - goto done; - } - cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, 0.0); - cairo_set_operator (cr, CAIRO_OPERATOR_OVER); - cairo_paint (cr); - - /* draw a box */ - rounded_rectangle (cr, 1.0, 0.5, 0.5, height / 10, width-1, height-1); - color_reverse (&style->bg[GTK_STATE_NORMAL], &color); - r = (float)color.red / 65535.0; - g = (float)color.green / 65535.0; - b = (float)color.blue / 65535.0; - cairo_set_source_rgba (cr, r, g, b, BG_ALPHA); - cairo_fill_preserve (cr); - - color_reverse (&style->text_aa[GTK_STATE_NORMAL], &color); - r = (float)color.red / 65535.0; - g = (float)color.green / 65535.0; - b = (float)color.blue / 65535.0; - cairo_set_source_rgba (cr, r, g, b, BG_ALPHA / 2); - cairo_set_line_width (cr, 1); - cairo_stroke (cr); - - /* draw action */ - draw_action (window, cr); - - cairo_destroy (cr); - - /* Make sure we have a transparent background */ - cairo_rectangle (context, 0, 0, width, height); - cairo_set_source_rgba (context, 0.0, 0.0, 0.0, 0.0); - cairo_fill (context); - - cairo_set_source_surface (context, surface, 0, 0); - cairo_paint_with_alpha (context, window->priv->fade_out_alpha); - - done: - if (surface != NULL) { - cairo_surface_destroy (surface); - } - cairo_destroy (context); - - return FALSE; -} - -static void -gsd_media_keys_window_real_show (GtkWidget *widget) -{ - GsdMediaKeysWindow *window; - - if (GTK_WIDGET_CLASS (gsd_media_keys_window_parent_class)->show) { - GTK_WIDGET_CLASS (gsd_media_keys_window_parent_class)->show (widget); - } - - window = GSD_MEDIA_KEYS_WINDOW (widget); - remove_hide_timeout (window); - add_hide_timeout (window); -} - -static void -gsd_media_keys_window_real_hide (GtkWidget *widget) -{ - GsdMediaKeysWindow *window; - - if (GTK_WIDGET_CLASS (gsd_media_keys_window_parent_class)->hide) { - GTK_WIDGET_CLASS (gsd_media_keys_window_parent_class)->hide (widget); - } - - window = GSD_MEDIA_KEYS_WINDOW (widget); - remove_hide_timeout (window); -} - -static void -gsd_media_keys_window_real_realize (GtkWidget *widget) -{ - GdkColormap *colormap; - GtkAllocation allocation; - GdkBitmap *mask; - cairo_t *cr; - - colormap = gdk_screen_get_rgba_colormap (gtk_widget_get_screen (widget)); - - if (colormap != NULL) { - gtk_widget_set_colormap (widget, colormap); - } - - if (GTK_WIDGET_CLASS (gsd_media_keys_window_parent_class)->realize) { - GTK_WIDGET_CLASS (gsd_media_keys_window_parent_class)->realize (widget); - } - - gtk_widget_get_allocation (widget, &allocation); - mask = gdk_pixmap_new (gtk_widget_get_window (widget), - allocation.width, - allocation.height, - 1); - cr = gdk_cairo_create (mask); - - cairo_set_source_rgba (cr, 1., 1., 1., 0.); - cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE); - cairo_paint (cr); - - /* make the whole window ignore events */ - gdk_window_input_shape_combine_mask (gtk_widget_get_window (widget), mask, 0, 0); - g_object_unref (mask); - cairo_destroy (cr); -} - -static void -gsd_media_keys_window_class_init (GsdMediaKeysWindowClass *klass) -{ - GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); - - widget_class->show = gsd_media_keys_window_real_show; - widget_class->hide = gsd_media_keys_window_real_hide; - widget_class->realize = gsd_media_keys_window_real_realize; - - g_type_class_add_private (klass, sizeof (GsdMediaKeysWindowPrivate)); -} - -gboolean -gsd_media_keys_window_is_valid (GsdMediaKeysWindow *window) -{ - GdkScreen *screen = gtk_widget_get_screen (GTK_WIDGET (window)); - return gdk_screen_is_composited (screen) == window->priv->is_composited; -} - -static void -gsd_media_keys_window_init (GsdMediaKeysWindow *window) -{ - GdkScreen *screen; - - window->priv = GSD_MEDIA_KEYS_WINDOW_GET_PRIVATE (window); - - screen = gtk_widget_get_screen (GTK_WIDGET (window)); - - window->priv->is_composited = gdk_screen_is_composited (screen); - - if (window->priv->is_composited) { - gdouble scalew, scaleh, scale; - gint size; - - gtk_window_set_decorated (GTK_WINDOW (window), FALSE); - gtk_widget_set_app_paintable (GTK_WIDGET (window), TRUE); - - /* assume 130x130 on a 640x480 display and scale from there */ - scalew = gdk_screen_get_width (screen) / 640.0; - scaleh = gdk_screen_get_height (screen) / 480.0; - scale = MIN (scalew, scaleh); - size = 130 * MAX (1, scale); - - gtk_window_set_default_size (GTK_WINDOW (window), size, size); - g_signal_connect (window, "expose-event", G_CALLBACK (on_expose_event), window); - - window->priv->fade_out_alpha = 1.0; - } else { - GtkBuilder *builder; - const gchar *objects[] = {"acme_frame", NULL}; - GtkWidget *frame; - - builder = gtk_builder_new (); - gtk_builder_add_objects_from_string (builder, acme_ui, acme_ui_length, (char **)objects, NULL); - - window->priv->image = GTK_IMAGE (gtk_builder_get_object (builder, "acme_image")); - window->priv->progress = GTK_WIDGET (gtk_builder_get_object (builder, "acme_volume_progressbar")); - frame = GTK_WIDGET (gtk_builder_get_object (builder, - "acme_frame")); - - if (frame != NULL) { - gtk_container_add (GTK_CONTAINER (window), frame); - gtk_widget_show_all (frame); - } - - /* The builder needs to stay alive until the window - takes ownership of the frame (and its children) */ - g_object_unref (builder); - } -} - -GtkWidget * -gsd_media_keys_window_new (void) -{ - GObject *object; - - object = g_object_new (GSD_TYPE_MEDIA_KEYS_WINDOW, - "type", GTK_WINDOW_POPUP, - "type-hint", GDK_WINDOW_TYPE_HINT_NOTIFICATION, - "skip-taskbar-hint", TRUE, - "skip-pager-hint", TRUE, - "focus-on-map", FALSE, - NULL); - - return GTK_WIDGET (object); -} Index: xfce4-power-manager/src/gsd-media-keys-window.h =================================================================== --- xfce4-power-manager.orig/src/gsd-media-keys-window.h 2013-08-13 06:54:51.885791748 +1000 +++ /dev/null 1970-01-01 00:00:00.000000000 +0000 @@ -1,71 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8; tab-width: 8 -*- - * - * Copyright (C) 2006 William Jon McCann - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - */ - -#ifndef GSD_MEDIA_KEYS_WINDOW_H -#define GSD_MEDIA_KEYS_WINDOW_H - -#include -#include - -G_BEGIN_DECLS - -#define GSD_TYPE_MEDIA_KEYS_WINDOW (gsd_media_keys_window_get_type ()) -#define GSD_MEDIA_KEYS_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GSD_TYPE_MEDIA_KEYS_WINDOW, GsdMediaKeysWindow)) -#define GSD_MEDIA_KEYS_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GSD_TYPE_MEDIA_KEYS_WINDOW, GsdMediaKeysWindowClass)) -#define GSD_IS_MEDIA_KEYS_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GSD_TYPE_MEDIA_KEYS_WINDOW)) -#define GSD_IS_MEDIA_KEYS_WINDOW_CLASS(klass) (G_TYPE_INSTANCE_GET_CLASS ((klass), GSD_TYPE_MEDIA_KEYS_WINDOW)) - -typedef struct GsdMediaKeysWindow GsdMediaKeysWindow; -typedef struct GsdMediaKeysWindowClass GsdMediaKeysWindowClass; -typedef struct GsdMediaKeysWindowPrivate GsdMediaKeysWindowPrivate; - -struct GsdMediaKeysWindow { - GtkWindow parent; - - GsdMediaKeysWindowPrivate *priv; -}; - -struct GsdMediaKeysWindowClass { - GtkWindowClass parent_class; -}; - -typedef enum { - GSD_MEDIA_KEYS_WINDOW_ACTION_VOLUME, - GSD_MEDIA_KEYS_WINDOW_ACTION_CUSTOM -} GsdMediaKeysWindowAction; - -GType gsd_media_keys_window_get_type (void); - -GtkWidget * gsd_media_keys_window_new (void); -void gsd_media_keys_window_set_action (GsdMediaKeysWindow *window, - GsdMediaKeysWindowAction action); -void gsd_media_keys_window_set_action_custom (GsdMediaKeysWindow *window, - const char *icon_name, - gboolean show_level); -void gsd_media_keys_window_set_volume_muted (GsdMediaKeysWindow *window, - gboolean muted); -void gsd_media_keys_window_set_volume_level (GsdMediaKeysWindow *window, - int level); -gboolean gsd_media_keys_window_is_valid (GsdMediaKeysWindow *window); - -G_END_DECLS - -#endif Index: xfce4-power-manager/src/xfpm-backlight.c =================================================================== --- xfce4-power-manager.orig/src/xfpm-backlight.c 2013-08-13 06:54:51.885791748 +1000 +++ xfce4-power-manager/src/xfpm-backlight.c 2013-08-13 06:54:51.881791728 +1000 @@ -42,14 +42,9 @@ #include "xfpm-debug.h" #include "xfpm-icons.h" -#include "gsd-media-keys-window.h" - static void xfpm_backlight_finalize (GObject *object); -static void xfpm_backlight_create_popup (XfpmBacklight *backlight); - #define ALARM_DISABLED 9 -#define BRIGHTNESS_POPUP_SIZE 180 #define XFPM_BACKLIGHT_GET_PRIVATE(o) \ (G_TYPE_INSTANCE_GET_PRIVATE ((o), XFPM_TYPE_BACKLIGHT, XfpmBacklightPrivate)) @@ -63,12 +58,8 @@ XfpmButton *button; XfpmNotify *notify; - GtkWidget *osd; NotifyNotification *n; - - gulong destroy_id; - gboolean has_hw; gboolean on_battery; @@ -123,12 +114,6 @@ backlight = XFPM_BACKLIGHT (data); - if ( backlight->priv->osd ) - { - gtk_widget_destroy (backlight->priv->osd); - backlight->priv->osd = NULL; - } - if ( backlight->priv->n ) { g_object_unref (backlight->priv->n); @@ -139,120 +124,43 @@ } static void -xfpm_backlight_composited_changed_cb (XfpmBacklight *backlight) -{ - xfpm_backlight_destroy_popup (backlight); - xfpm_backlight_create_popup (backlight); -} - -static void xfpm_backlight_show_notification (XfpmBacklight *backlight, gfloat value) { - gint i; - - static const char *display_icon_name[] = - { - "notification-display-brightness-off", - "notification-display-brightness-low", - "notification-display-brightness-medium", - "notification-display-brightness-high", - "notification-display-brightness-full", - NULL - }; - + gchar *summary; + + /* create the notification on demand */ if ( backlight->priv->n == NULL ) { - backlight->priv->n = xfpm_notify_new_notification (backlight->priv->notify, - " ", - "", - NULL, - 0, + backlight->priv->n = xfpm_notify_new_notification (backlight->priv->notify, + "", + "", + "xfpm-brightness-lcd", + 0, XFPM_NOTIFY_NORMAL, NULL); } + + /* generate a human-readable summary for the notification */ + summary = g_strdup_printf (_("Brightness: %.0f percent"), value); + notify_notification_update (backlight->priv->n, summary, NULL, NULL); + g_free (summary); - i = (gint)value / 25; - - if ( i > 4 || i < 0 ) - return; + /* add the brightness value to the notification */ + notify_notification_set_hint_int32 (backlight->priv->n, "value", value); - notify_notification_set_hint_int32 (backlight->priv->n, - "value", - value); - - notify_notification_set_hint_string (backlight->priv->n, - "x-canonical-private-synchronous", - "brightness"); - - notify_notification_update (backlight->priv->n, - " ", - "", - display_icon_name[i]); - + /* show the notification */ notify_notification_show (backlight->priv->n, NULL); } static void -xfpm_backlight_create_popup (XfpmBacklight *backlight) -{ - if ( backlight->priv->osd != NULL ) - return; - - backlight->priv->osd = gsd_media_keys_window_new (); - gsd_media_keys_window_set_action_custom (GSD_MEDIA_KEYS_WINDOW (backlight->priv->osd), - XFPM_DISPLAY_BRIGHTNESS_ICON, - TRUE); - gtk_window_set_position (GTK_WINDOW (backlight->priv->osd), GTK_WIN_POS_CENTER); - - g_signal_connect_swapped (backlight->priv->osd, "composited-changed", - G_CALLBACK (xfpm_backlight_composited_changed_cb), backlight); - -} - -static void xfpm_backlight_show (XfpmBacklight *backlight, gint level) { gfloat value; - gboolean sync_notify; - gboolean show_popup; XFPM_DEBUG ("Level %u", level); - g_object_get (G_OBJECT (backlight->priv->conf), - SHOW_BRIGHTNESS_POPUP, &show_popup, - NULL); - - if ( !show_popup ) - goto out; - - g_object_get (G_OBJECT (backlight->priv->notify), - "sync", &sync_notify, - NULL); - value = (gfloat) 100 * level / backlight->priv->max_level; - - if ( !sync_notify ) /*Notification server doesn't support sync notifications*/ - { - xfpm_backlight_create_popup (backlight); - gsd_media_keys_window_set_volume_level (GSD_MEDIA_KEYS_WINDOW (backlight->priv->osd), - round (value)); - if ( !GTK_WIDGET_VISIBLE (backlight->priv->osd)) - gtk_window_present (GTK_WINDOW (backlight->priv->osd)); - } - else - { - xfpm_backlight_show_notification (backlight, value); - } - - if ( backlight->priv->destroy_id != 0 ) - { - g_source_remove (backlight->priv->destroy_id); - backlight->priv->destroy_id = 0; - } - -out: - /* Release the memory after 60 seconds */ - backlight->priv->destroy_id = g_timeout_add_seconds (60, (GSourceFunc) xfpm_backlight_destroy_popup, backlight); + xfpm_backlight_show_notification (backlight, value); } @@ -386,7 +294,6 @@ backlight->priv->brightness = xfpm_brightness_new (); backlight->priv->has_hw = xfpm_brightness_setup (backlight->priv->brightness); - backlight->priv->osd = NULL; backlight->priv->notify = NULL; backlight->priv->idle = NULL; backlight->priv->conf = NULL; @@ -394,7 +301,6 @@ backlight->priv->power = NULL; backlight->priv->dimmed = FALSE; backlight->priv->block = FALSE; - backlight->priv->destroy_id = 0; if ( !backlight->priv->has_hw ) { Index: xfce4-power-manager/src/xfpm-notify.c =================================================================== --- xfce4-power-manager.orig/src/xfpm-notify.c 2013-08-13 06:54:51.885791748 +1000 +++ xfce4-power-manager/src/xfpm-notify.c 2013-08-13 06:54:51.881791728 +1000 @@ -69,7 +69,7 @@ gulong notify_id; gboolean supports_actions; - gboolean supports_sync; /*For x-canonical-private-synchronous */ + gboolean supports_sync; /* For x-canonical-private-synchronous */ }; enum Index: xfce4-power-manager/po/POTFILES.in =================================================================== --- xfce4-power-manager.orig/po/POTFILES.in 2013-08-13 06:54:51.885791748 +1000 +++ xfce4-power-manager/po/POTFILES.in 2013-08-13 06:54:51.881791728 +1000 @@ -6,6 +6,7 @@ common/xfpm-common.c src/xfpm-power.c src/xfpm-power-common.c +src/xfpm-backlight.c src/xfpm-battery.c src/xfpm-battery.c src/xfpm-main.c debian/patches/03_fix-insert-battery.patch0000664000000000000000000000330412320537603015703 0ustar From 6f87cc775b4c72f5708d6582173077b856ba01f5 Mon Sep 17 00:00:00 2001 From: Henry Gebhardt Date: Wed, 29 Feb 2012 14:14:33 +0100 Subject: [PATCH] Fix empty systray icon in some panels on battery removal and addition Unreferencing a GtkStatusIcon is not enough to get rid of it entirely. This fixes these bugs: https://bugzilla.xfce.org/show_bug.cgi?id=7603 http://bugzilla.xfce.org/show_bug.cgi?id=8424 https://bugs.launchpad.net/ubuntu/+source/lxpanel/+bug/846878 https://bugzilla.redhat.com/show_bug.cgi?id=765726 --- src/xfpm-battery.c | 2 ++ src/xfpm-power.c | 1 + 2 files changed, 3 insertions(+), 0 deletions(-) Index: xfce4-power-manager/src/xfpm-battery.c =================================================================== --- xfce4-power-manager.orig/src/xfpm-battery.c 2013-08-13 06:55:01.525839550 +1000 +++ xfce4-power-manager/src/xfpm-battery.c 2013-08-13 06:55:01.525839550 +1000 @@ -788,6 +788,8 @@ g_object_unref (battery->priv->notify); g_object_unref (battery->priv->button); + gtk_status_icon_set_visible(GTK_STATUS_ICON(battery), FALSE); + G_OBJECT_CLASS (xfpm_battery_parent_class)->finalize (object); } Index: xfce4-power-manager/src/xfpm-power.c =================================================================== --- xfce4-power-manager.orig/src/xfpm-power.c 2013-08-13 06:55:01.525839550 +1000 +++ xfce4-power-manager/src/xfpm-power.c 2013-08-13 06:55:01.525839550 +1000 @@ -1114,6 +1114,7 @@ if ( power->priv->adapter_icon ) { + gtk_status_icon_set_visible (power->priv->adapter_icon, FALSE); g_object_unref (power->priv->adapter_icon); power->priv->adapter_icon = NULL; } debian/patches/06_add-shutdown-reboot-functionality-for-systemd.patch0000664000000000000000000004572112320537603023210 0ustar Origin: OpenSUSE Description: fix the shutdown and reboot functions with systemd Bug-Debian: https://bugs.debian.org/727605 Bug-Ubuntu: https://bugs.launchpad.net/bugs/1222021 --- configure.ac | 2 src/Makefile.am | 8 + src/xfpm-manager.c | 35 +++++++ src/xfpm-power.c | 84 ++++++++++++++++-- src/xfpm-systemd.c | 245 +++++++++++++++++++++++++++++++++++++++++++++++++++++ src/xfpm-systemd.h | 62 +++++++++++++ 6 files changed, 428 insertions(+), 8 deletions(-) --- a/configure.ac +++ b/configure.ac @@ -100,6 +100,8 @@ if test "x$ac_cv_enable_polkit" = "xno"; polkit="no" else AC_MSG_RESULT([yes]) + XDT_CHECK_OPTIONAL_PACKAGE([SYSTEMD], [polkit-gobject-1], [0.100], + [systemd], [Systemd support (through polkit)]) AC_DEFINE(ENABLE_POLKIT, 1 , [PolicyKit support]) polkit="yes" fi --- a/src/Makefile.am +++ b/src/Makefile.am @@ -39,6 +39,12 @@ xfce4_power_manager_SOURCES = xfpm-errors.c \ xfpm-errors.h +if HAVE_SYSTEMD +xfce4_power_manager_SOURCES += \ + xfpm-systemd.c \ + xfpm-systemd.h +endif + xfce4_power_manager_CFLAGS = \ -I$(top_srcdir) \ -I$(top_srcdir)/common \ @@ -52,6 +58,7 @@ xfce4_power_manager_CFLAGS = $(LIBXFCE4UI_CFLAGS) \ $(XFCONF_CFLAGS) \ $(LIBNOTIFY_CFLAGS) \ + $(SYSTEMD_CFLAGS) \ $(XRANDR_CFLAGS) \ $(DPMS_CFLAGS) \ $(PLATFORM_CPPFLAGS) \ @@ -70,6 +77,7 @@ xfce4_power_manager_LDADD = $(LIBXFCE4UI_LIBS) \ $(XFCONF_LIBS) \ $(LIBNOTIFY_LIBS) \ + $(SYSTEMD_LIBS) \ $(XRANDR_LIBS) \ $(DPMS_LIBS) --- a/src/xfpm-manager.c +++ b/src/xfpm-manager.c @@ -58,6 +58,10 @@ #include "xfpm-enum-types.h" #include "xfpm-dbus-monitor.h" +#ifdef HAVE_SYSTEMD +#include "xfpm-systemd.h" +#endif + static void xfpm_manager_finalize (GObject *object); static void xfpm_manager_dbus_class_init (XfpmManagerClass *klass); @@ -80,6 +84,9 @@ struct XfpmManagerPrivate XfpmButton *button; XfpmXfconf *conf; XfpmBacklight *backlight; +#ifdef HAVE_SYSTEMD + XfpmSystemd *systemd; +#endif XfpmConsoleKit *console; XfpmDBusMonitor *monitor; XfpmDisks *disks; @@ -131,7 +138,12 @@ xfpm_manager_finalize (GObject *object) g_object_unref (manager->priv->button); g_object_unref (manager->priv->conf); g_object_unref (manager->priv->client); - g_object_unref (manager->priv->console); +#ifdef HAVE_SYSTEMD + if ( manager->priv->systemd != NULL ) + g_object_unref (manager->priv->systemd); +#endif + if ( manager->priv->console != NULL ) + g_object_unref (manager->priv->console); g_object_unref (manager->priv->monitor); g_object_unref (manager->priv->disks); g_object_unref (manager->priv->inhibit); @@ -201,6 +213,11 @@ static void xfpm_manager_shutdown (XfpmManager *manager) { GError *error = NULL; +#ifdef HAVE_SYSTEMD + if ( LOGIND_RUNNING () ) + xfpm_systemd_shutdown (manager->priv->systemd, &error ); + else +#endif xfpm_console_kit_shutdown (manager->priv->console, &error ); if ( error ) @@ -517,10 +534,17 @@ void xfpm_manager_start (XfpmManager *ma dbus_g_error_domain_register (XFPM_ERROR, NULL, XFPM_TYPE_ERROR); - + manager->priv->power = xfpm_power_get (); manager->priv->button = xfpm_button_new (); manager->priv->conf = xfpm_xfconf_new (); +#ifdef HAVE_SYSTEMD + manager->priv->console = NULL; + manager->priv->systemd = NULL; + if ( LOGIND_RUNNING () ) + manager->priv->systemd = xfpm_systemd_new (); + else +#endif manager->priv->console = xfpm_console_kit_new (); manager->priv->monitor = xfpm_dbus_monitor_new (); manager->priv->disks = xfpm_disks_new (); @@ -603,6 +627,13 @@ GHashTable *xfpm_manager_get_config (Xfp hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); +#ifdef HAVE_SYSTEMD + if ( LOGIND_RUNNING () ) + g_object_get (G_OBJECT (manager->priv->systemd), + "can-shutdown", &can_shutdown, + NULL); + else +#endif g_object_get (G_OBJECT (manager->priv->console), "can-shutdown", &can_shutdown, NULL); --- a/src/xfpm-power.c +++ b/src/xfpm-power.c @@ -51,6 +51,10 @@ #include "xfpm-enum-types.h" #include "egg-idletime.h" +#ifdef HAVE_SYSTEMD +#include "xfpm-systemd.h" +#endif + static void xfpm_power_finalize (GObject *object); static void xfpm_power_get_property (GObject *object, @@ -75,6 +79,9 @@ struct XfpmPowerPrivate GHashTable *hash; +#ifdef HAVE_SYSTEMD + XfpmSystemd *systemd; +#endif XfpmConsoleKit *console; XfpmInhibit *inhibit; XfpmXfconf *conf; @@ -680,10 +687,17 @@ xfpm_power_add_actions_to_notification ( { gboolean can_shutdown; +#ifdef HAVE_SYSTEMD + if ( LOGIND_RUNNING () ) + g_object_get (G_OBJECT (power->priv->systemd), + "can-shutdown", &can_shutdown, + NULL); + else +#endif g_object_get (G_OBJECT (power->priv->console), "can-shutdown", &can_shutdown, NULL); - + if ( power->priv->can_hibernate && power->priv->auth_hibernate ) { xfpm_notify_add_action_to_notification( @@ -756,10 +770,17 @@ xfpm_power_show_critical_action_gtk (Xfp const gchar *message; gboolean can_shutdown; +#ifdef HAVE_SYSTEMD + if ( LOGIND_RUNNING () ) + g_object_get (G_OBJECT (power->priv->systemd), + "can-shutdown", &can_shutdown, + NULL); + else +#endif g_object_get (G_OBJECT (power->priv->console), "can-shutdown", &can_shutdown, NULL); - + message = _("System is running on low power. "\ "Save your work to avoid losing data"); @@ -1328,6 +1349,13 @@ xfpm_power_init (XfpmPower *power) power->priv->inhibit = xfpm_inhibit_new (); power->priv->notify = xfpm_notify_new (); power->priv->conf = xfpm_xfconf_new (); +#ifdef HAVE_SYSTEMD + power->priv->systemd = NULL; + power->priv->console = NULL; + if ( LOGIND_RUNNING () ) + power->priv->systemd = xfpm_systemd_new (); + else +#endif power->priv->console = xfpm_console_kit_new (); g_signal_connect_swapped (power->priv->conf, "notify::" SHOW_TRAY_ICON_CFG, @@ -1446,7 +1474,12 @@ xfpm_power_finalize (GObject *object) g_object_unref (power->priv->inhibit); g_object_unref (power->priv->notify); g_object_unref (power->priv->conf); - g_object_unref (power->priv->console); +#ifdef HAVE_SYSTEMD + if ( power->priv->systemd != NULL ) + g_object_unref (power->priv->systemd); +#endif + if ( power->priv->console != NULL ) + g_object_unref (power->priv->console); xfpm_power_hide_adapter_icon (power); @@ -1608,10 +1641,17 @@ static gboolean xfpm_power_dbus_shutdown { gboolean can_reboot; +#ifdef HAVE_SYSTEMD + if ( LOGIND_RUNNING () ) + g_object_get (G_OBJECT (power->priv->systemd), + "can-shutdown", &can_reboot, + NULL); + else +#endif g_object_get (G_OBJECT (power->priv->console), "can-shutdown", &can_reboot, NULL); - + if ( !can_reboot) { g_set_error (error, XFPM_ERROR, XFPM_ERROR_PERMISSION_DENIED, @@ -1619,6 +1659,11 @@ static gboolean xfpm_power_dbus_shutdown return FALSE; } +#ifdef HAVE_SYSTEMD + if ( LOGIND_RUNNING () ) + xfpm_systemd_shutdown (power->priv->systemd, error); + else +#endif xfpm_console_kit_shutdown (power->priv->console, error); return TRUE; @@ -1629,10 +1674,17 @@ static gboolean xfpm_power_dbus_reboot { gboolean can_reboot; +#ifdef HAVE_SYSTEMD + if ( LOGIND_RUNNING () ) + g_object_get (G_OBJECT (power->priv->systemd), + "can-restart", &can_reboot, + NULL); + else +#endif g_object_get (G_OBJECT (power->priv->console), "can-restart", &can_reboot, NULL); - + if ( !can_reboot) { g_set_error (error, XFPM_ERROR, XFPM_ERROR_PERMISSION_DENIED, @@ -1640,7 +1692,12 @@ static gboolean xfpm_power_dbus_reboot return FALSE; } +#ifdef HAVE_SYSTEMD + if ( LOGIND_RUNNING () ) + xfpm_systemd_reboot (power->priv->systemd, error); +#else xfpm_console_kit_reboot (power->priv->console, error); +#endif return TRUE; } @@ -1695,10 +1752,17 @@ static gboolean xfpm_power_dbus_can_rebo gboolean * OUT_can_reboot, GError ** error) { +#ifdef HAVE_SYSTEMD + if ( LOGIND_RUNNING () ) + g_object_get (G_OBJECT (power->priv->systemd), + "can-reboot", OUT_can_reboot, + NULL); + else +#endif g_object_get (G_OBJECT (power->priv->console), "can-reboot", OUT_can_reboot, NULL); - + return TRUE; } @@ -1706,9 +1770,17 @@ static gboolean xfpm_power_dbus_can_shut gboolean * OUT_can_shutdown, GError ** error) { +#ifdef HAVE_SYSTEMD + if ( LOGIND_RUNNING () ) + g_object_get (G_OBJECT (power->priv->systemd), + "can-shutdown", OUT_can_shutdown, + NULL); + else +#endif g_object_get (G_OBJECT (power->priv->console), "can-shutdown", OUT_can_shutdown, NULL); + return TRUE; } --- /dev/null +++ b/src/xfpm-systemd.c @@ -0,0 +1,245 @@ +/* + * * Copyright (C) 2009-2011 Ali + * * Copyright (C) 2013 Andreas Müller + * + * Licensed under the GNU General Public License Version 2 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include +#include + +#include +#include + +#include "xfpm-systemd.h" + + +static void xfpm_systemd_finalize (GObject *object); + +static void xfpm_systemd_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec); + +#define XFPM_SYSTEMD_GET_PRIVATE(o) \ +(G_TYPE_INSTANCE_GET_PRIVATE ((o), XFPM_TYPE_SYSTEMD, XfpmSystemdPrivate)) + +struct XfpmSystemdPrivate +{ + gboolean can_shutdown; + gboolean can_restart; + + PolkitAuthority *authority; + PolkitSubject *subject; +}; + +enum +{ + PROP_0, + PROP_CAN_RESTART, + PROP_CAN_SHUTDOWN +}; + +G_DEFINE_TYPE (XfpmSystemd, xfpm_systemd, G_TYPE_OBJECT) + +#define SYSTEMD_DBUS_NAME "org.freedesktop.login1" +#define SYSTEMD_DBUS_PATH "/org/freedesktop/login1" +#define SYSTEMD_DBUS_INTERFACE "org.freedesktop.login1.Manager" +#define SYSTEMD_REBOOT_ACTION "Reboot" +#define SYSTEMD_POWEROFF_ACTION "PowerOff" +#define SYSTEMD_REBOOT_TEST "org.freedesktop.login1.reboot" +#define SYSTEMD_POWEROFF_TEST "org.freedesktop.login1.power-off" + +static void +xfpm_systemd_class_init (XfpmSystemdClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->finalize = xfpm_systemd_finalize; + + object_class->get_property = xfpm_systemd_get_property; + + g_object_class_install_property (object_class, + PROP_CAN_RESTART, + g_param_spec_boolean ("can-restart", + NULL, NULL, + FALSE, + G_PARAM_READABLE)); + + g_object_class_install_property (object_class, + PROP_CAN_SHUTDOWN, + g_param_spec_boolean ("can-shutdown", + NULL, NULL, + FALSE, + G_PARAM_READABLE)); + + g_type_class_add_private (klass, sizeof (XfpmSystemdPrivate)); +} + +static gboolean +xfpm_systemd_can_method (XfpmSystemd *systemd, + gboolean *can_method, + const gchar *method) +{ + PolkitAuthorizationResult *res; + GError *local_error = NULL; + + *can_method = FALSE; + res = polkit_authority_check_authorization_sync (systemd->priv->authority, + systemd->priv->subject, + method, + NULL, + POLKIT_CHECK_AUTHORIZATION_FLAGS_NONE, + NULL, + &local_error); + if ( local_error ) + { + g_critical ("Unable to get %s : %s", method, local_error->message); + g_error_free (local_error); + } + + if(res) + { + *can_method = polkit_authorization_result_get_is_authorized (res) || + polkit_authorization_result_get_is_challenge (res); + g_object_unref (G_OBJECT (res)); + } + + return TRUE; +} + +static void +xfpm_systemd_init (XfpmSystemd *systemd) +{ + systemd->priv = XFPM_SYSTEMD_GET_PRIVATE (systemd); + systemd->priv->authority = polkit_authority_get_sync (NULL, NULL); + systemd->priv->subject = polkit_unix_process_new (getpid()); + systemd->priv->can_shutdown = FALSE; + systemd->priv->can_restart = FALSE; + + if(systemd->priv->authority && systemd->priv->subject) + { + xfpm_systemd_can_method (systemd, + &systemd->priv->can_shutdown, + SYSTEMD_POWEROFF_TEST); + xfpm_systemd_can_method (systemd, + &systemd->priv->can_restart, + SYSTEMD_REBOOT_TEST); + } +} + +static void xfpm_systemd_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + XfpmSystemd *systemd; + systemd = XFPM_SYSTEMD (object); + + switch (prop_id) + { + case PROP_CAN_SHUTDOWN: + g_value_set_boolean (value, systemd->priv->can_shutdown); + break; + case PROP_CAN_RESTART: + g_value_set_boolean (value, systemd->priv->can_restart); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +xfpm_systemd_finalize (GObject *object) +{ + XfpmSystemd *systemd; + + systemd = XFPM_SYSTEMD (object); + + if(systemd->priv->authority) + g_object_unref (G_OBJECT (systemd->priv->authority)); + if(systemd->priv->subject) + g_object_unref (G_OBJECT (systemd->priv->subject)); + + G_OBJECT_CLASS (xfpm_systemd_parent_class)->finalize (object); +} + +XfpmSystemd * +xfpm_systemd_new (void) +{ + static gpointer systemd_obj = NULL; + + if ( G_LIKELY (systemd_obj != NULL ) ) + { + g_object_ref (systemd_obj); + } + else + { + systemd_obj = g_object_new (XFPM_TYPE_SYSTEMD, NULL); + g_object_add_weak_pointer (systemd_obj, &systemd_obj); + } + + return XFPM_SYSTEMD (systemd_obj); +} + +static void +xfpm_systemd_try_method (XfpmSystemd *systemd, + const gchar *method, + GError **error) +{ + GDBusConnection *bus; + GError *local_error = NULL; + + bus = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, error); + if (G_LIKELY (bus != NULL)) + { + g_dbus_connection_call_sync (bus, + SYSTEMD_DBUS_NAME, + SYSTEMD_DBUS_PATH, + SYSTEMD_DBUS_INTERFACE, + method, + g_variant_new ("(b)", TRUE), + NULL, 0, G_MAXINT, NULL, + &local_error); + g_object_unref (G_OBJECT (bus)); + + if (local_error != NULL) + { + g_propagate_error (error, local_error); + } + } +} + +void xfpm_systemd_shutdown (XfpmSystemd *systemd, GError **error) +{ + xfpm_systemd_try_method (systemd, + SYSTEMD_POWEROFF_ACTION, + error); +} + +void xfpm_systemd_reboot (XfpmSystemd *systemd, GError **error) +{ + xfpm_systemd_try_method (systemd, + SYSTEMD_REBOOT_ACTION, + error); +} --- /dev/null +++ b/src/xfpm-systemd.h @@ -0,0 +1,62 @@ +/* + * * Copyright (C) 2009-2011 Ali + * * Copyright (C) 2013 Andreas Müller + * + * Licensed under the GNU General Public License Version 2 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef __XFPM_SYSTEMD_H +#define __XFPM_SYSTEMD_H + +#include + +G_BEGIN_DECLS + +#define LOGIND_RUNNING() (access ("/run/systemd/seats/", F_OK) >= 0) + +#define XFPM_TYPE_SYSTEMD (xfpm_systemd_get_type () ) +#define XFPM_SYSTEMD(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), XFPM_TYPE_SYSTEMD, XfpmSystemd)) +#define XFPM_IS_SYSTEMD(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), XFPM_TYPE_SYSTEMD)) + +typedef struct XfpmSystemdPrivate XfpmSystemdPrivate; + +typedef struct +{ + GObject parent; + XfpmSystemdPrivate *priv; + +} XfpmSystemd; + +typedef struct +{ + GObjectClass parent_class; + +} XfpmSystemdClass; + +GType xfpm_systemd_get_type (void) G_GNUC_CONST; + +XfpmSystemd *xfpm_systemd_new (void); + +void xfpm_systemd_shutdown (XfpmSystemd *systemd, + GError **error); + +void xfpm_systemd_reboot (XfpmSystemd *systemd, + GError **error); + +G_END_DECLS + +#endif /* __XFPM_SYSTEMD_H */ debian/patches/05_dont-allow-systemd-to-handle-suspend-hibernate-events.patch0000664000000000000000000000722212320537603024507 0ustar From 3d721db740dc0016da71e323eac4d8caef6439a3 Mon Sep 17 00:00:00 2001 From: Mikhail Efremov Date: Thu, 21 Feb 2013 15:03:44 +0400 Subject: [PATCH] Don't allow systemd to handle suspend/hibernate events. --- src/xfpm-main.c | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 85 insertions(+), 2 deletions(-) diff --git a/src/xfpm-main.c b/src/xfpm-main.c index a98583b..f23f1ce 100644 --- a/src/xfpm-main.c +++ b/src/xfpm-main.c @@ -194,16 +194,96 @@ xfpm_dump_remote (DBusGConnection *bus) g_hash_table_destroy (hash); } +static gint +xfpm_inhibit_sleep_systemd (DBusGConnection *bus) +{ + DBusConnection *bus_connection; + DBusMessage *message = NULL, *reply = NULL; + DBusError error; + gint fd = -1; + const char *what = "handle-power-key:handle-suspend-key:handle-hibernate-key:handle-lid-switch"; + const char *who = "xfce4-power-manager"; + const char *why = "xfce4-power-manager handles these events"; + const char *mode = "block"; + + bus_connection = dbus_g_connection_get_connection (bus); + if (!xfpm_dbus_name_has_owner (bus_connection, "org.freedesktop.login1")) + return -1; + + dbus_error_init (&error); + + message = dbus_message_new_method_call ("org.freedesktop.login1", + "/org/freedesktop/login1", + "org.freedesktop.login1.Manager", + "Inhibit"); + + if (!message) + { + g_warning ("Unable to call Inhibit()"); + goto done; + } + + + if (!dbus_message_append_args (message, + DBUS_TYPE_STRING, &what, + DBUS_TYPE_STRING, &who, + DBUS_TYPE_STRING, &why, + DBUS_TYPE_STRING, &mode, + DBUS_TYPE_INVALID)) + { + g_warning ("Unable to call Inhibit()"); + goto done; + } + + + reply = dbus_connection_send_with_reply_and_block (bus_connection, message, -1, &error); + if (!reply) + { + g_warning ("Unable to inhibit systemd sleep: %s", error.message); + goto done; + } + + if (!dbus_message_get_args (reply, &error, + DBUS_TYPE_UNIX_FD, &fd, + DBUS_TYPE_INVALID)) + { + g_warning ("Inhibit() reply parsing failed: %s", error.message); + } + +done: + + if (message) + dbus_message_unref (message); + if (reply) + dbus_message_unref (reply); + dbus_error_free (&error); + + return fd; +} + static void G_GNUC_NORETURN xfpm_start (DBusGConnection *bus, const gchar *client_id, gboolean dump) { + DBusGConnection *system_bus; XfpmManager *manager; GError *error = NULL; + gint inhibit_fd = -1; XFPM_DEBUG ("Starting the power manager"); manager = xfpm_manager_new (bus, client_id); - + + /* Don't allow systemd to handle power/suspend/hibernate buttons + * and lid-switch */ + system_bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error); + if (system_bus) + inhibit_fd = xfpm_inhibit_sleep_systemd (system_bus); + else + { + g_warning ("Unable connect to system bus: %s", error->message); + g_clear_error (&error); + } + if ( xfce_posix_signal_handler_init (&error)) { xfce_posix_signal_handler_set_handler (SIGHUP, @@ -238,7 +318,10 @@ xfpm_start (DBusGConnection *bus, const gchar *client_id, gboolean dump) gtk_main (); g_object_unref (manager); - + + if (inhibit_fd >= 0) + close (inhibit_fd); + exit (EXIT_SUCCESS); } -- 1.8.1.3 debian/patches/10_inhibit_logind.patch0000664000000000000000000003327412344326614015140 0ustar Description: Selectively inhibit logind events Logind conflicts with lock-on-suspend with light-locker (and potentially other locking solutions). This patch makes logind events optionally inhibited via xfconf to allow easier workarounds. Author: Sean Davis, smd.seandavis@gmail.com Origin: vendor, https://github.com/bluesabre/xfce4-power-manager/commit/2f51d54f2efc7b9c87e39fb114adb06a974dcb67 Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/xfce4-power-manager/+bug/1303736 --- This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ --- a/src/xfpm-config.h +++ b/src/xfpm-config.h @@ -82,6 +82,11 @@ #define SPIN_DOWN_ON_AC_TIMEOUT "spin-down-on-ac-timeout" #define SPIN_DOWN_ON_BATTERY_TIMEOUT "spin-down-on-battery-timeout" +#define LOGIND_HANDLE_POWER_KEY "logind-handle-power-key" +#define LOGIND_HANDLE_SUSPEND_KEY "logind-handle-suspend-key" +#define LOGIND_HANDLE_HIBERNATE_KEY "logind-handle-hibernate-key" +#define LOGIND_HANDLE_LID_SWITCH "logind-handle-lid-switch" + G_END_DECLS #endif /* __XFPM_CONFIG_H */ --- a/src/xfpm-main.c +++ b/src/xfpm-main.c @@ -194,96 +194,16 @@ g_hash_table_destroy (hash); } -static gint -xfpm_inhibit_sleep_systemd (DBusGConnection *bus) -{ - DBusConnection *bus_connection; - DBusMessage *message = NULL, *reply = NULL; - DBusError error; - gint fd = -1; - const char *what = "handle-power-key:handle-suspend-key:handle-hibernate-key:handle-lid-switch"; - const char *who = "xfce4-power-manager"; - const char *why = "xfce4-power-manager handles these events"; - const char *mode = "block"; - - bus_connection = dbus_g_connection_get_connection (bus); - if (!xfpm_dbus_name_has_owner (bus_connection, "org.freedesktop.login1")) - return -1; - - dbus_error_init (&error); - - message = dbus_message_new_method_call ("org.freedesktop.login1", - "/org/freedesktop/login1", - "org.freedesktop.login1.Manager", - "Inhibit"); - - if (!message) - { - g_warning ("Unable to call Inhibit()"); - goto done; - } - - - if (!dbus_message_append_args (message, - DBUS_TYPE_STRING, &what, - DBUS_TYPE_STRING, &who, - DBUS_TYPE_STRING, &why, - DBUS_TYPE_STRING, &mode, - DBUS_TYPE_INVALID)) - { - g_warning ("Unable to call Inhibit()"); - goto done; - } - - - reply = dbus_connection_send_with_reply_and_block (bus_connection, message, -1, &error); - if (!reply) - { - g_warning ("Unable to inhibit systemd sleep: %s", error.message); - goto done; - } - - if (!dbus_message_get_args (reply, &error, - DBUS_TYPE_UNIX_FD, &fd, - DBUS_TYPE_INVALID)) - { - g_warning ("Inhibit() reply parsing failed: %s", error.message); - } - -done: - - if (message) - dbus_message_unref (message); - if (reply) - dbus_message_unref (reply); - dbus_error_free (&error); - - return fd; -} - static void G_GNUC_NORETURN xfpm_start (DBusGConnection *bus, const gchar *client_id, gboolean dump) { - DBusGConnection *system_bus; XfpmManager *manager; GError *error = NULL; - gint inhibit_fd = -1; XFPM_DEBUG ("Starting the power manager"); manager = xfpm_manager_new (bus, client_id); - /* Don't allow systemd to handle power/suspend/hibernate buttons - * and lid-switch */ - system_bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error); - if (system_bus) - inhibit_fd = xfpm_inhibit_sleep_systemd (system_bus); - else - { - g_warning ("Unable connect to system bus: %s", error->message); - g_clear_error (&error); - } - if ( xfce_posix_signal_handler_init (&error)) { xfce_posix_signal_handler_set_handler (SIGHUP, @@ -314,14 +234,10 @@ g_hash_table_destroy (hash); } - gtk_main (); g_object_unref (manager); - if (inhibit_fd >= 0) - close (inhibit_fd); - exit (EXIT_SUCCESS); } --- a/src/xfpm-manager.c +++ b/src/xfpm-manager.c @@ -77,6 +77,7 @@ struct XfpmManagerPrivate { DBusGConnection *session_bus; + DBusGConnection *system_bus; XfceSMClient *client; @@ -100,6 +101,8 @@ gboolean inhibited; gboolean session_managed; + + gint inhibit_fd; }; G_DEFINE_TYPE (XfpmManager, xfpm_manager, G_TYPE_OBJECT) @@ -133,7 +136,10 @@ if ( manager->priv->session_bus ) dbus_g_connection_unref (manager->priv->session_bus); - + + if ( manager->priv->system_bus ) + dbus_g_connection_unref (manager->priv->system_bus); + g_object_unref (manager->priv->power); g_object_unref (manager->priv->button); g_object_unref (manager->priv->conf); @@ -176,6 +182,10 @@ XFPM_DEBUG ("Exiting"); xfpm_manager_release_names (manager); + + if (manager->priv->inhibit_fd >= 0) + close (manager->priv->inhibit_fd); + gtk_main_quit (); return TRUE; } @@ -319,7 +329,17 @@ xfpm_manager_lid_changed_cb (XfpmPower *power, gboolean lid_is_closed, XfpmManager *manager) { XfpmLidTriggerAction action; - gboolean on_battery; + gboolean on_battery, logind_handle_lid_switch; + + if ( LOGIND_RUNNING() ) + { + g_object_get (G_OBJECT (manager->priv->conf), + LOGIND_HANDLE_LID_SWITCH, &logind_handle_lid_switch, + NULL); + + if (!logind_handle_lid_switch) + return; + } g_object_get (G_OBJECT (power), "on-battery", &on_battery, @@ -479,6 +499,124 @@ } +static gchar* +xfpm_manager_get_systemd_events(XfpmManager *manager) +{ + GSList *events = NULL; + gchar *what = ""; + gboolean handle_power_key, handle_suspend_key, handle_hibernate_key, handle_lid_switch; + + g_object_get (G_OBJECT (manager->priv->conf), + LOGIND_HANDLE_POWER_KEY, &handle_power_key, + LOGIND_HANDLE_SUSPEND_KEY, &handle_suspend_key, + LOGIND_HANDLE_HIBERNATE_KEY, &handle_hibernate_key, + LOGIND_HANDLE_LID_SWITCH, &handle_lid_switch, + NULL); + + if (handle_power_key) + events = g_slist_append(events, "handle-power-key"); + if (handle_suspend_key) + events = g_slist_append(events, "handle-suspend-key"); + if (handle_hibernate_key) + events = g_slist_append(events, "handle-hibernate-key"); + if (handle_lid_switch) + events = g_slist_append(events, "handle-lid-switch"); + + while (events != NULL) + { + if ( g_strcmp0(what, "") == 0 ) + what = g_strdup( (gchar *) events->data ); + else + what = g_strconcat(what, ":", (gchar *) events->data, NULL); + events = g_slist_next(events); + } + g_slist_free(events); + + return what; +} + +static gint +xfpm_manager_inhibit_sleep_systemd (XfpmManager *manager) +{ + DBusConnection *bus_connection; + DBusMessage *message = NULL, *reply = NULL; + DBusError error; + gint fd = -1; + const char *what = g_strdup(xfpm_manager_get_systemd_events(manager)); + const char *who = "xfce4-power-manager"; + const char *why = "xfce4-power-manager handles these events"; + const char *mode = "block"; + + if (g_strcmp0(what, "") == 0) + return -1; + + XFPM_DEBUG ("Inhibiting systemd sleep: %s", what); + + bus_connection = dbus_g_connection_get_connection (manager->priv->system_bus); + if (!xfpm_dbus_name_has_owner (bus_connection, "org.freedesktop.login1")) + return -1; + + dbus_error_init (&error); + + message = dbus_message_new_method_call ("org.freedesktop.login1", + "/org/freedesktop/login1", + "org.freedesktop.login1.Manager", + "Inhibit"); + + if (!message) + { + g_warning ("Unable to call Inhibit()"); + goto done; + } + + + if (!dbus_message_append_args (message, + DBUS_TYPE_STRING, &what, + DBUS_TYPE_STRING, &who, + DBUS_TYPE_STRING, &why, + DBUS_TYPE_STRING, &mode, + DBUS_TYPE_INVALID)) + { + g_warning ("Unable to call Inhibit()"); + goto done; + } + + + reply = dbus_connection_send_with_reply_and_block (bus_connection, message, -1, &error); + if (!reply) + { + g_warning ("Unable to inhibit systemd sleep: %s", error.message); + goto done; + } + + if (!dbus_message_get_args (reply, &error, + DBUS_TYPE_UNIX_FD, &fd, + DBUS_TYPE_INVALID)) + { + g_warning ("Inhibit() reply parsing failed: %s", error.message); + } + +done: + + if (message) + dbus_message_unref (message); + if (reply) + dbus_message_unref (reply); + dbus_error_free (&error); + + return fd; +} + +static void +xfpm_manager_systemd_events_changed (XfpmManager *manager) +{ + if (manager->priv->inhibit_fd >= 0) + close (manager->priv->inhibit_fd); + + if (manager->priv->system_bus) + manager->priv->inhibit_fd = xfpm_manager_inhibit_sleep_systemd (manager); +} + XfpmManager * xfpm_manager_new (DBusGConnection *bus, const gchar *client_id) { @@ -528,6 +666,8 @@ void xfpm_manager_start (XfpmManager *manager) { + GError *error = NULL; + if ( !xfpm_manager_reserve_names (manager) ) goto out; @@ -550,6 +690,17 @@ manager->priv->disks = xfpm_disks_new (); manager->priv->inhibit = xfpm_inhibit_new (); manager->priv->idle = egg_idletime_new (); + + /* Don't allow systemd to handle power/suspend/hibernate buttons + * and lid-switch */ + manager->priv->system_bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error); + if (manager->priv->system_bus) + manager->priv->inhibit_fd = xfpm_manager_inhibit_sleep_systemd (manager); + else + { + g_warning ("Unable connect to system bus: %s", error->message); + g_clear_error (&error); + } g_signal_connect (manager->priv->idle, "alarm-expired", G_CALLBACK (xfpm_manager_alarm_timeout_cb), manager); @@ -559,7 +710,19 @@ g_signal_connect_swapped (manager->priv->conf, "notify::" ON_BATTERY_INACTIVITY_TIMEOUT, G_CALLBACK (xfpm_manager_set_idle_alarm_on_battery), manager); - + + g_signal_connect_swapped (manager->priv->conf, "notify::" LOGIND_HANDLE_POWER_KEY, + G_CALLBACK (xfpm_manager_systemd_events_changed), manager); + + g_signal_connect_swapped (manager->priv->conf, "notify::" LOGIND_HANDLE_SUSPEND_KEY, + G_CALLBACK (xfpm_manager_systemd_events_changed), manager); + + g_signal_connect_swapped (manager->priv->conf, "notify::" LOGIND_HANDLE_HIBERNATE_KEY, + G_CALLBACK (xfpm_manager_systemd_events_changed), manager); + + g_signal_connect_swapped (manager->priv->conf, "notify::" LOGIND_HANDLE_LID_SWITCH, + G_CALLBACK (xfpm_manager_systemd_events_changed), manager); + xfpm_manager_set_idle_alarm (manager); g_signal_connect (manager->priv->inhibit, "has-inhibit-changed", --- a/src/xfpm-xfconf.c +++ b/src/xfpm-xfconf.c @@ -84,6 +84,10 @@ PROP_SPIN_DOWN_DISK_ON_BATTERY, PROP_SPIN_DOWN_DISK_ON_AC_TIMEOUT, PROP_SPIN_DOWN_DISK_ON_BATTERY_TIMEOUT, + PROP_LOGIND_HANDLE_POWER_KEY, + PROP_LOGIND_HANDLE_SUSPEND_KEY, + PROP_LOGIND_HANDLE_HIBERNATE_KEY, + PROP_LOGIND_HANDLE_LID_SWITCH, N_PROPERTIES }; @@ -561,6 +565,46 @@ 120, G_PARAM_READWRITE)); + /** + * XfpmXfconf::logind-handle-power-key + **/ + g_object_class_install_property (object_class, + PROP_LOGIND_HANDLE_POWER_KEY, + g_param_spec_boolean (LOGIND_HANDLE_POWER_KEY, + NULL, NULL, + TRUE, + G_PARAM_READWRITE)); + + /** + * XfpmXfconf::logind-handle-suspend-key + **/ + g_object_class_install_property (object_class, + PROP_LOGIND_HANDLE_SUSPEND_KEY, + g_param_spec_boolean (LOGIND_HANDLE_SUSPEND_KEY, + NULL, NULL, + TRUE, + G_PARAM_READWRITE)); + + /** + * XfpmXfconf::logind-handle-hibernate-key + **/ + g_object_class_install_property (object_class, + PROP_LOGIND_HANDLE_HIBERNATE_KEY, + g_param_spec_boolean (LOGIND_HANDLE_HIBERNATE_KEY, + NULL, NULL, + TRUE, + G_PARAM_READWRITE)); + + /** + * XfpmXfconf::logind-handle-lid-switch + **/ + g_object_class_install_property (object_class, + PROP_LOGIND_HANDLE_LID_SWITCH, + g_param_spec_boolean (LOGIND_HANDLE_LID_SWITCH, + NULL, NULL, + TRUE, + G_PARAM_READWRITE)); + g_type_class_add_private (klass, sizeof (XfpmXfconfPrivate)); } debian/patches/08_show_preferences_lxde.patch0000664000000000000000000000144012320537603016524 0ustar Subject: Hide settings menu only on desktop environment which have another power manager, to make it appear on LXDE menu. Author: Julien Lavergne Index: xfce4-power-manager/settings/xfce4-power-manager-settings.desktop.in =================================================================== --- xfce4-power-manager.orig/settings/xfce4-power-manager-settings.desktop.in 2013-08-13 06:55:09.261877911 +1000 +++ xfce4-power-manager/settings/xfce4-power-manager-settings.desktop.in 2013-08-13 06:55:09.253877872 +1000 @@ -8,7 +8,7 @@ Terminal=false Type=Application Categories=XFCE;GTK;Settings;DesktopSettings;X-XFCE-SettingsDialog;X-XFCE-HardwareSettings; -OnlyShowIn=XFCE; +NotShowIn=GNOME;KDE;Unity; StartupNotify=true X-XfcePluggable=true X-XfceHelpFile=xfce4-power-manager debian/patches/02_translations-fix-invalid-format-strings.patch0000664000000000000000000000646612320537603022064 0ustar Description: Fix incorrect usage of format strings in translations Author: Lionel Le Folgoc Bug-Ubuntu: https://bugs.launchpad.net/bugs/975880 Bug-Ubuntu: https://bugs.launchpad.net/bugs/1054907 Bug: https://bugzilla.xfce.org/show_bug.cgi?id=8992 Forwarded: yes, to the coordinator/last translator of each affected language Index: xfce4-power-manager/po/te.po =================================================================== --- xfce4-power-manager.orig/po/te.po 2013-08-13 06:54:58.825826162 +1000 +++ xfce4-power-manager/po/te.po 2013-08-13 06:54:58.821826142 +1000 @@ -535,16 +535,6 @@ msgid "Your %s is charging" msgstr "మీ %s చార్జింగ్ అవుతున్నది" -#: ../src/xfpm-battery.c:222 -#, c-format -msgid "" -"%s (%i%%)\n" -"%s until is fully charged." -msgstr "" -"%s\n" -"మీ %s చార్జింగు అవుతున్నది (%i%%)\n" -"%s లలో పూర్తిగా చార్జ్ అవుతుంది." - #: ../src/xfpm-battery.c:230 ../src/xfpm-battery.c:266 #, c-format msgid "Your %s is discharging" @@ -555,16 +545,6 @@ msgid "System is running on %s power" msgstr "వ్యవస్థ %s విద్యుత్ పై నడుస్తున్నది" -#: ../src/xfpm-battery.c:242 -#, c-format -msgid "" -"%s (%i%%)\n" -"Estimated time left is %s." -msgstr "" -"%s\n" -"మీ %s డిస్చార్జ్ అవుతున్నది (%i%%)\n" -"ఇంకా మిగిలివున్న సమయం %s." - #: ../src/xfpm-battery.c:248 ../src/xfpm-battery.c:269 #, c-format msgid "Your %s is empty" Index: xfce4-power-manager/po/en_GB.po =================================================================== --- xfce4-power-manager.orig/po/en_GB.po 2013-08-13 06:54:58.825826162 +1000 +++ xfce4-power-manager/po/en_GB.po 2013-08-13 06:54:58.821826142 +1000 @@ -548,8 +548,7 @@ "%s (%i%%)\n" "%s until is fully charged." msgstr "" -"%s\n" -"Your %s is charging (%i%%)\n" +"%s (%i%%)\n" "%s until is fully charged." #: ../src/xfpm-battery.c:232 ../src/xfpm-battery.c:268 @@ -568,8 +567,7 @@ "%s (%i%%)\n" "Estimated time left is %s." msgstr "" -"%s\n" -"Your %s is discharging (%i%%)\n" +"%s (%i%%)\n" "Estimated time left is %s." #: ../src/xfpm-battery.c:250 ../src/xfpm-battery.c:271 Index: xfce4-power-manager/po/tr.po =================================================================== --- xfce4-power-manager.orig/po/tr.po 2013-08-13 06:54:58.825826162 +1000 +++ xfce4-power-manager/po/tr.po 2013-08-13 06:54:58.821826142 +1000 @@ -408,16 +408,6 @@ msgid "System is running on low power" msgstr "Sistem düşük güçte çalışıyor" -#: ../src/xfpm-power.c:955 -#, c-format -msgid "" -"Your %s charge level is low\n" -"Estimated time left %s" -msgstr "" -"%s\n" -"%s deşarj oluyor (%i%%)\n" -"tahmini kalan süre %s." - #: ../src/xfpm-power.c:1158 ../src/xfpm-power.c:1163 msgid "Adaptor is offline" msgstr "Adaptör takılı değil" @@ -558,16 +548,6 @@ msgid "System is running on %s power" msgstr "Sistem, %s gücüyle çalışıyor." -#: ../src/xfpm-battery.c:242 -#, c-format -msgid "" -"%s (%i%%)\n" -"Estimated time left is %s." -msgstr "" -"%s\n" -"%s deşarj oluyor (%i%%)\n" -"tahmini kalan süre %s." - #: ../src/xfpm-battery.c:248 ../src/xfpm-battery.c:269 #, c-format msgid "Your %s is empty" debian/patches/07_fix-screen-dimming.patch0000664000000000000000000002251312320537603015637 0ustar Author: Martin Matuska Description: fix screen dimming in xfce4-power-manager Bug-Upstream: https://bugzilla.xfce.org/show_bug.cgi?id=8840 Bug-Debian: https://bugs.debian.org/676854 Bug-Ubuntu: https://bugs.launchpad.net/bugs/1067749 --- a/common/xfpm-brightness.c +++ b/common/xfpm-brightness.c @@ -92,11 +92,11 @@ out: } static gboolean -xfpm_brightness_xrandr_get_level (XfpmBrightness *brightness, RROutput output, long *current) +xfpm_brightness_xrandr_get_level (XfpmBrightness *brightness, RROutput output, gint32 *current) { unsigned long nitems; unsigned long bytes_after; - long *prop; + gint32 *prop; Atom actual_type; int actual_format; gboolean ret = FALSE; @@ -124,7 +124,7 @@ xfpm_brightness_xrandr_get_level (XfpmBr } static gboolean -xfpm_brightness_xrandr_set_level (XfpmBrightness *brightness, RROutput output, long level) +xfpm_brightness_xrandr_set_level (XfpmBrightness *brightness, RROutput output, gint32 level) { gboolean ret = TRUE; @@ -137,7 +137,7 @@ xfpm_brightness_xrandr_set_level (XfpmBr if ( gdk_error_trap_pop () ) { - g_warning ("failed to XRRChangeOutputProperty for brightness %li", level); + g_warning ("failed to XRRChangeOutputProperty for brightness %d", level); ret = FALSE; } @@ -225,11 +225,11 @@ xfpm_brightness_setup_xrandr (XfpmBright } static gboolean -xfpm_brightness_xrand_up (XfpmBrightness *brightness, glong *new_level) +xfpm_brightness_xrand_up (XfpmBrightness *brightness, gint32 *new_level) { - long hw_level; + gint32 hw_level; gboolean ret = FALSE; - long set_level; + gint32 set_level; ret = xfpm_brightness_xrandr_get_level (brightness, brightness->priv->output, &hw_level); @@ -250,14 +250,14 @@ xfpm_brightness_xrand_up (XfpmBrightness if ( !ret ) { - g_warning ("xfpm_brightness_xrand_up failed for %li", set_level); + g_warning ("xfpm_brightness_xrand_up failed for %d", set_level); return FALSE; } /* Nothing changed in the hardware*/ if ( *new_level == hw_level ) { - g_warning ("xfpm_brightness_xrand_up did not change the hw level to %li", set_level); + g_warning ("xfpm_brightness_xrand_up did not change the hw level to %d", set_level); return FALSE; } @@ -265,11 +265,11 @@ xfpm_brightness_xrand_up (XfpmBrightness } static gboolean -xfpm_brightness_xrand_down (XfpmBrightness *brightness, long *new_level) +xfpm_brightness_xrand_down (XfpmBrightness *brightness, gint32 *new_level) { - long hw_level; + gint32 hw_level; gboolean ret; - long set_level; + gint32 set_level; ret = xfpm_brightness_xrandr_get_level (brightness, brightness->priv->output, &hw_level); @@ -290,14 +290,14 @@ xfpm_brightness_xrand_down (XfpmBrightne if ( !ret ) { - g_warning ("xfpm_brightness_xrand_down failed for %li", set_level); + g_warning ("xfpm_brightness_xrand_down failed for %d", set_level); return FALSE; } /* Nothing changed in the hardware*/ if ( *new_level == hw_level ) { - g_warning ("xfpm_brightness_xrand_down did not change the hw level to %li", set_level); + g_warning ("xfpm_brightness_xrand_down did not change the hw level to %d", set_level); return FALSE; } @@ -361,7 +361,7 @@ xfpm_brightness_setup_helper (XfpmBright } static gboolean -xfpm_brightness_helper_get_level (XfpmBrightness *brg, glong *level) +xfpm_brightness_helper_get_level (XfpmBrightness *brg, gint32 *level) { int ret; @@ -406,11 +406,11 @@ out: } static gboolean -xfpm_brightness_helper_up (XfpmBrightness *brightness, glong *new_level) +xfpm_brightness_helper_up (XfpmBrightness *brightness, gint32 *new_level) { - glong hw_level; + gint32 hw_level; gboolean ret = FALSE; - gint set_level; + gint32 set_level; ret = xfpm_brightness_helper_get_level (brightness, &hw_level); @@ -446,11 +446,11 @@ xfpm_brightness_helper_up (XfpmBrightnes } static gboolean -xfpm_brightness_helper_down (XfpmBrightness *brightness, glong *new_level) +xfpm_brightness_helper_down (XfpmBrightness *brightness, gint32 *new_level) { - glong hw_level; + gint32 hw_level; gboolean ret; - gint set_level; + gint32 set_level; ret = xfpm_brightness_helper_get_level (brightness, &hw_level); @@ -572,7 +572,7 @@ xfpm_brightness_setup (XfpmBrightness *b return FALSE; } -gboolean xfpm_brightness_up (XfpmBrightness *brightness, glong *new_level) +gboolean xfpm_brightness_up (XfpmBrightness *brightness, gint32 *new_level) { gboolean ret = FALSE; @@ -589,7 +589,7 @@ gboolean xfpm_brightness_up (XfpmBrightn return ret; } -gboolean xfpm_brightness_down (XfpmBrightness *brightness, glong *new_level) +gboolean xfpm_brightness_down (XfpmBrightness *brightness, gint32 *new_level) { gboolean ret = FALSE; @@ -618,7 +618,7 @@ gint xfpm_brightness_get_max_level (Xfpm return brightness->priv->max_level; } -gboolean xfpm_brightness_get_level (XfpmBrightness *brightness, glong *level) +gboolean xfpm_brightness_get_level (XfpmBrightness *brightness, gint32 *level) { gboolean ret = FALSE; @@ -632,7 +632,7 @@ gboolean xfpm_brightness_get_level (Xfpm return ret; } -gboolean xfpm_brightness_set_level (XfpmBrightness *brightness, glong level) +gboolean xfpm_brightness_set_level (XfpmBrightness *brightness, gint32 level) { gboolean ret = FALSE; --- a/common/xfpm-brightness.h +++ b/common/xfpm-brightness.h @@ -51,20 +51,20 @@ XfpmBrightness *xfpm_brigh gboolean xfpm_brightness_setup (XfpmBrightness *brightness); gboolean xfpm_brightness_up (XfpmBrightness *brightness, - glong *new_level); + gint32 *new_level); gboolean xfpm_brightness_down (XfpmBrightness *brightness, - glong *new_level); + gint32 *new_level); gboolean xfpm_brightness_has_hw (XfpmBrightness *brightness); gint xfpm_brightness_get_max_level (XfpmBrightness *brightness); gboolean xfpm_brightness_get_level (XfpmBrightness *brightness, - glong *level); + gint32 *level); gboolean xfpm_brightness_set_level (XfpmBrightness *brightness, - glong level); + gint32 level); gboolean xfpm_brightness_dim_down (XfpmBrightness *brightness); --- a/panel-plugins/brightness/brightness-button.c +++ b/panel-plugins/brightness/brightness-button.c @@ -186,7 +186,7 @@ static gboolean brightness_button_popup_win (GtkWidget *widget, GdkEvent *ev, guint32 ev_time) { gint x, y; - glong current_level = 0; + gint32 current_level = 0; GdkDisplay *display; GdkScreen *screen; BrightnessButton *button; @@ -342,7 +342,7 @@ plus_clicked (GtkWidget *widget, Brightn static void range_value_changed (GtkWidget *widget, BrightnessButton *button) { - glong range_level, hw_level; + gint32 range_level, hw_level; range_level = (gint) gtk_range_get_value (GTK_RANGE (button->priv->range)); @@ -428,8 +428,8 @@ brightness_button_create_popup (Brightne static void brightness_button_up (BrightnessButton *button) { - glong level; - glong max_level; + gint32 level; + gint32 max_level; xfpm_brightness_get_level (button->priv->brightness, &level); max_level = xfpm_brightness_get_max_level (button->priv->brightness); @@ -443,7 +443,7 @@ brightness_button_up (BrightnessButton * static void brightness_button_down (BrightnessButton *button) { - glong level; + gint32 level; xfpm_brightness_get_level (button->priv->brightness, &level); if ( level != 0 ) --- a/src/xfpm-backlight.c +++ b/src/xfpm-backlight.c @@ -63,8 +63,8 @@ struct XfpmBacklightPrivate gboolean has_hw; gboolean on_battery; - glong last_level; - glong max_level; + gint32 last_level; + gint32 max_level; gboolean dimmed; gboolean block; @@ -79,7 +79,7 @@ xfpm_backlight_dim_brightness (XfpmBackl if (xfpm_power_get_mode (backlight->priv->power) == XFPM_POWER_MODE_NORMAL ) { - glong dim_level; + gint32 dim_level; g_object_get (G_OBJECT (backlight->priv->conf), backlight->priv->on_battery ? BRIGHTNESS_LEVEL_ON_BATTERY : BRIGHTNESS_LEVEL_ON_AC, &dim_level, @@ -101,7 +101,7 @@ xfpm_backlight_dim_brightness (XfpmBackl **/ if (backlight->priv->last_level > dim_level) { - XFPM_DEBUG ("Current brightness level before dimming : %li, new %li", backlight->priv->last_level, dim_level); + XFPM_DEBUG ("Current brightness level before dimming : %d, new %d", backlight->priv->last_level, dim_level); backlight->priv->dimmed = xfpm_brightness_set_level (backlight->priv->brightness, dim_level); } } @@ -182,7 +182,7 @@ xfpm_backlight_reset_cb (EggIdletime *id { if ( !backlight->priv->block) { - XFPM_DEBUG ("Alarm reset, setting level to %li", backlight->priv->last_level); + XFPM_DEBUG ("Alarm reset, setting level to %d", backlight->priv->last_level); xfpm_brightness_set_level (backlight->priv->brightness, backlight->priv->last_level); } backlight->priv->dimmed = FALSE; @@ -192,7 +192,7 @@ xfpm_backlight_reset_cb (EggIdletime *id static void xfpm_backlight_button_pressed_cb (XfpmButton *button, XfpmButtonKey type, XfpmBacklight *backlight) { - glong level; + gint32 level; gboolean ret = TRUE; gboolean enable_brightness, show_popup; debian/copyright0000664000000000000000000000203612320537603011125 0ustar This package was debianized by Yves-Alexis Perez on Mon, 27 Oct 2008 07:32:27 +0100 It was downloaded from http://goodies.xfce.org/projects/applications/xfce4-power-manager Copyright Holders: © 2008-2009 Ali src/xfpm-button-xf86.c: © 2008-2009 Ali with some code from gnome-power-manager which is: © 2006-2007 Richard Hughes src/xfpm-idle.c: © 2008-2009 Ali and some code from GDM 2.24.2 which is: © 2007 Richard Hughes brightness/brightness-button.c: © 2009 Ali with some code taken from GtkScaleButton (GTK), which is: © 2005 Ronald S. Bultje © 2006, 2007 Christian Persch © 2006 Jan Arne Petersen © 2005-2007 Red Hat, Inc. License: You are free to distribute this software under the terms of the GNU General Public License (version 2 or later). On Debian systems, the complete text of the GNU General Public License can be found in the file `/usr/share/common-licenses/GPL-2' debian/watch0000664000000000000000000000017412320537603010224 0ustar version=3 http://archive.xfce.org/src/xfce/xfce4-power-manager/([\d\.]+)/ \ xfce4-power-manager-([\d\.]+)\.tar\.(?:gz|bz2) debian/xfce4-power-manager-plugins.install0000664000000000000000000000004612320537603016013 0ustar usr/lib usr/share/xfce4/panel-plugins debian/xfce4-power-manager-data.install0000664000000000000000000000010312320537603015235 0ustar usr/share/locale usr/share/xfce4/doc usr/share/icons usr/share/man debian/rules0000775000000000000000000000053612320537603010255 0ustar #!/usr/bin/make -f export DEB_LDFLAGS_MAINT_APPEND=-Wl,-z,defs -Wl,--as-needed -Wl,-O1 export DEB_BUILD_MAINT_OPTIONS=hardening=+all override_dh_auto_configure: NOCONFIGURE=1 xdt-autogen dh_auto_configure override_dh_install: dh_install --fail-missing override_dh_autoreconf: dh_autoreconf xdt-autogen %: dh $@ --parallel --with autoreconf