Merge lp:~noskcaj/ubuntu/trusty/xfce4-power-manager/dimming into lp:ubuntu/trusty/xfce4-power-manager

Proposed by Jackson Doak
Status: Merged
Merge reported by: Dmitry Shachnev
Merged at revision: not available
Proposed branch: lp:~noskcaj/ubuntu/trusty/xfce4-power-manager/dimming
Merge into: lp:ubuntu/trusty/xfce4-power-manager
Diff against target: 32764 lines (+2129/-15068)
34 files modified
.pc/01_Remove_custom_OSD_brightness_popup,_use_libnotify_instead.patch/po/POTFILES.in (+0/-19)
.pc/01_Remove_custom_OSD_brightness_popup,_use_libnotify_instead.patch/src/Makefile.am (+0/-211)
.pc/01_Remove_custom_OSD_brightness_popup,_use_libnotify_instead.patch/src/gsd-media-keys-window.c (+0/-1078)
.pc/01_Remove_custom_OSD_brightness_popup,_use_libnotify_instead.patch/src/gsd-media-keys-window.h (+0/-71)
.pc/01_Remove_custom_OSD_brightness_popup,_use_libnotify_instead.patch/src/xfpm-backlight.c (+0/-478)
.pc/01_Remove_custom_OSD_brightness_popup,_use_libnotify_instead.patch/src/xfpm-notify.c (+0/-409)
.pc/02_translations-fix-invalid-format-strings.patch/po/en_GB.po (+0/-1083)
.pc/02_translations-fix-invalid-format-strings.patch/po/te.po (+0/-1061)
.pc/02_translations-fix-invalid-format-strings.patch/po/tr.po (+0/-1486)
.pc/03_fix-insert-battery.patch/src/xfpm-battery.c (+0/-916)
.pc/03_fix-insert-battery.patch/src/xfpm-power.c (+0/-1755)
.pc/04_fix-missing-icons-for-non-system-batteries.patch/src/xfpm-battery.c (+0/-918)
.pc/05_dont-allow-systemd-to-handle-suspend-hibernate-events.patch/src/xfpm-main.c (+0/-430)
.pc/06_add-shutdown-reboot-functionality-for-systemd.patch/configure.ac (+0/-257)
.pc/06_add-shutdown-reboot-functionality-for-systemd.patch/src/Makefile.am (+0/-209)
.pc/06_add-shutdown-reboot-functionality-for-systemd.patch/src/xfpm-manager.c (+0/-734)
.pc/06_add-shutdown-reboot-functionality-for-systemd.patch/src/xfpm-power.c (+0/-1756)
.pc/06_fix-suspend-auth-check.patch/src/xfpm-power.c (+0/-1828)
.pc/07_fix-screen-dimming.patch/common/xfpm-brightness.c (+661/-0)
.pc/07_fix-screen-dimming.patch/common/xfpm-brightness.h (+73/-0)
.pc/07_fix-screen-dimming.patch/panel-plugins/brightness/brightness-button.c (+656/-0)
.pc/07_fix-screen-dimming.patch/src/xfpm-backlight.c (+384/-0)
.pc/08_show_preferences_lxde.patch/settings/xfce4-power-manager-settings.desktop.in (+0/-14)
.pc/applied-patches (+0/-8)
common/xfpm-brightness.c (+25/-25)
common/xfpm-brightness.h (+4/-4)
debian/changelog (+7/-0)
debian/patches/06_add-shutdown-reboot-functionality-for-systemd.patch (+5/-0)
debian/patches/07_fix-screen-dimming.patch (+302/-0)
debian/patches/series (+1/-0)
panel-plugins/brightness/brightness-button.c (+5/-5)
src/xfpm-backlight.c (+6/-6)
src/xfpm-systemd.c (+0/-245)
src/xfpm-systemd.h (+0/-62)
To merge this branch: bzr merge lp:~noskcaj/ubuntu/trusty/xfce4-power-manager/dimming
Reviewer Review Type Date Requested Status
Dmitry Shachnev Approve
Ubuntu branches Pending
Review via email: mp+202597@code.launchpad.net

Description of the change

Fix screen dimming support, add a dep3 header to another patch.

To post a comment you must log in.
Revision history for this message
Dmitry Shachnev (mitya57) wrote :

Uploaded, thanks for your work. Some notes:

- You are doing something weird with the bzr branch (like removing and then re-adding .pc directory), that makes it harder to review.
- In DEP-3 patches, we prefer short bug URLs (like https://bugs.launchpad.net/bugs/1234567).
- Patch descriptions work like Description: field in debian/control, so should start with lowercase (and not end with a period).

review: Approve
Revision history for this message
Jackson Doak (noskcaj) wrote :

thanks, and thanks for the info.

On Wed, Jan 22, 2014 at 9:28 PM, Dmitry Shachnev <email address hidden> wrote:

> The proposal to merge
> lp:~noskcaj/ubuntu/trusty/xfce4-power-manager/dimming into
> lp:ubuntu/xfce4-power-manager has been updated.
>
> Status: Needs review => Merged
>
> For more details, see:
>
> https://code.launchpad.net/~noskcaj/ubuntu/trusty/xfce4-power-manager/dimming/+merge/202597
> --
>
> https://code.launchpad.net/~noskcaj/ubuntu/trusty/xfce4-power-manager/dimming/+merge/202597
> You are the owner of lp:~noskcaj/ubuntu/trusty/xfce4-power-manager/dimming.
>

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory '.pc/01_Remove_custom_OSD_brightness_popup,_use_libnotify_instead.patch'
2=== removed directory '.pc/01_Remove_custom_OSD_brightness_popup,_use_libnotify_instead.patch'
3=== added file '.pc/01_Remove_custom_OSD_brightness_popup,_use_libnotify_instead.patch/.timestamp'
4=== added directory '.pc/01_Remove_custom_OSD_brightness_popup,_use_libnotify_instead.patch/po'
5=== removed directory '.pc/01_Remove_custom_OSD_brightness_popup,_use_libnotify_instead.patch/po'
6=== added file '.pc/01_Remove_custom_OSD_brightness_popup,_use_libnotify_instead.patch/po/POTFILES.in'
7--- .pc/01_Remove_custom_OSD_brightness_popup,_use_libnotify_instead.patch/po/POTFILES.in 1970-01-01 00:00:00 +0000
8+++ .pc/01_Remove_custom_OSD_brightness_popup,_use_libnotify_instead.patch/po/POTFILES.in 2014-01-22 05:17:49 +0000
9@@ -0,0 +1,19 @@
10+[encoding: UTF-8]
11+[type: gettext/glade]data/interfaces/xfpm-settings.ui
12+settings/xfpm-settings.c
13+settings/xfpm-settings-main.c
14+settings/xfce4-power-manager-settings.desktop.in
15+common/xfpm-common.c
16+src/xfpm-power.c
17+src/xfpm-power-common.c
18+src/xfpm-battery.c
19+src/xfpm-battery.c
20+src/xfpm-main.c
21+src/xfpm-network-manager.c
22+src/xfpm-dpms.c
23+src/xfpm-inhibit.c
24+src/xfpm-power-info.c
25+src/xfce4-power-manager.desktop.in
26+src/org.xfce.power.policy.in2
27+panel-plugins/brightness/brightness-button.c
28+panel-plugins/brightness/xfce4-brightness-plugin.desktop.in.in
29
30=== removed file '.pc/01_Remove_custom_OSD_brightness_popup,_use_libnotify_instead.patch/po/POTFILES.in'
31--- .pc/01_Remove_custom_OSD_brightness_popup,_use_libnotify_instead.patch/po/POTFILES.in 2013-05-22 00:46:08 +0000
32+++ .pc/01_Remove_custom_OSD_brightness_popup,_use_libnotify_instead.patch/po/POTFILES.in 1970-01-01 00:00:00 +0000
33@@ -1,19 +0,0 @@
34-[encoding: UTF-8]
35-[type: gettext/glade]data/interfaces/xfpm-settings.ui
36-settings/xfpm-settings.c
37-settings/xfpm-settings-main.c
38-settings/xfce4-power-manager-settings.desktop.in
39-common/xfpm-common.c
40-src/xfpm-power.c
41-src/xfpm-power-common.c
42-src/xfpm-battery.c
43-src/xfpm-battery.c
44-src/xfpm-main.c
45-src/xfpm-network-manager.c
46-src/xfpm-dpms.c
47-src/xfpm-inhibit.c
48-src/xfpm-power-info.c
49-src/xfce4-power-manager.desktop.in
50-src/org.xfce.power.policy.in2
51-panel-plugins/brightness/brightness-button.c
52-panel-plugins/brightness/xfce4-brightness-plugin.desktop.in.in
53
54=== added directory '.pc/01_Remove_custom_OSD_brightness_popup,_use_libnotify_instead.patch/src'
55=== removed directory '.pc/01_Remove_custom_OSD_brightness_popup,_use_libnotify_instead.patch/src'
56=== added file '.pc/01_Remove_custom_OSD_brightness_popup,_use_libnotify_instead.patch/src/Makefile.am'
57--- .pc/01_Remove_custom_OSD_brightness_popup,_use_libnotify_instead.patch/src/Makefile.am 1970-01-01 00:00:00 +0000
58+++ .pc/01_Remove_custom_OSD_brightness_popup,_use_libnotify_instead.patch/src/Makefile.am 2014-01-22 05:17:49 +0000
59@@ -0,0 +1,211 @@
60+bin_PROGRAMS = xfce4-power-manager \
61+ xfce4-power-information
62+
63+xfce4_power_manager_SOURCES = \
64+ $(BUILT_SOURCES) \
65+ xfpm-enum.h \
66+ xfpm-enum-glib.h \
67+ xfpm-main.c \
68+ xfpm-manager.c \
69+ xfpm-manager.h \
70+ xfpm-power.c \
71+ xfpm-power.h \
72+ xfpm-power-common.c \
73+ xfpm-power-common.h \
74+ xfpm-battery.c \
75+ xfpm-battery.h \
76+ xfpm-xfconf.c \
77+ xfpm-xfconf.h \
78+ xfpm-disks.c \
79+ xfpm-disks.h \
80+ xfpm-console-kit.c \
81+ xfpm-console-kit.h \
82+ egg-idletime.c \
83+ egg-idletime.h \
84+ xfpm-backlight.c \
85+ xfpm-backlight.h \
86+ xfpm-dpms.c \
87+ xfpm-dpms.h \
88+ xfpm-button.c \
89+ xfpm-button.h \
90+ xfpm-network-manager.c \
91+ xfpm-network-manager.h \
92+ xfpm-inhibit.c \
93+ xfpm-inhibit.h \
94+ xfpm-notify.c \
95+ xfpm-notify.h \
96+ xfpm-polkit.c \
97+ xfpm-polkit.h \
98+ xfpm-errors.c \
99+ xfpm-errors.h \
100+ gsd-media-keys-window.c \
101+ gsd-media-keys-window.h
102+
103+xfce4_power_manager_CFLAGS = \
104+ -I$(top_srcdir) \
105+ -I$(top_srcdir)/common \
106+ -I$(top_srcdir)/libdbus \
107+ -DLOCALEDIR=\"$(localedir)\" \
108+ -DG_LOG_DOMAIN=\"xfce4-power-manager\" \
109+ -DSYSCONFDIR=\"$(sysconfdir)\" \
110+ $(GOBJECT_CFLAGS) \
111+ $(GTHREAD_CFLAGS) \
112+ $(DBUS_GLIB_CFLAGS) \
113+ $(LIBXFCE4UI_CFLAGS) \
114+ $(XFCONF_CFLAGS) \
115+ $(LIBNOTIFY_CFLAGS) \
116+ $(XRANDR_CFLAGS) \
117+ $(DPMS_CFLAGS) \
118+ $(PLATFORM_CPPFLAGS) \
119+ $(PLATFORM_CFLAGS)
120+
121+xfce4_power_manager_LDFLAGS = \
122+ -no-undefined \
123+ $(PLATFORM_LDFLAGS)
124+
125+xfce4_power_manager_LDADD = \
126+ $(top_builddir)/common/libxfpmcommon.la \
127+ $(top_builddir)/libdbus/libxfpmdbus.la \
128+ $(GOBJECT_LIBS) \
129+ $(GTHREAD_LIBS) \
130+ $(DBUS_GLIB_LIBS) \
131+ $(LIBXFCE4UI_LIBS) \
132+ $(XFCONF_LIBS) \
133+ $(LIBNOTIFY_LIBS) \
134+ $(XRANDR_LIBS) \
135+ $(DPMS_LIBS)
136+
137+xfce4_power_information_SOURCES = \
138+ xfpm-power-info.c \
139+ xfpm-power-common.c \
140+ xfpm-power-common.h
141+
142+xfce4_power_information_CFLAGS = \
143+ -I$(top_srcdir) \
144+ -I$(top_srcdir)/common \
145+ -I$(top_srcdir)/libdbus \
146+ -DLOCALEDIR=\"$(localedir)\" \
147+ -DG_LOG_DOMAIN=\"xfce4-power-information\"\
148+ $(GOBJECT_CFLAGS) \
149+ $(DBUS_GLIB_CFLAGS) \
150+ $(LIBXFCE4UI_CFLAGS) \
151+ $(PLATFORM_CPPFLAGS) \
152+ $(PLATFORM_CFLAGS)
153+
154+xfce4_power_information_LDFLAGS = \
155+ -no-undefined \
156+ $(PLATFORM_LDFLAGS)
157+
158+xfce4_power_information_LDADD = \
159+ $(GOBJECT_LIBS) \
160+ $(DBUS_GLIB_LIBS) \
161+ $(LIBXFCE4UI_LIBS) \
162+ $(top_builddir)/libdbus/libxfpmdbus.la
163+
164+if ENABLE_POLKIT
165+
166+sbin_PROGRAMS = xfpm-power-backlight-helper
167+
168+xfpm_power_backlight_helper_SOURCES = \
169+ xfpm-backlight-helper.c
170+
171+xfpm_power_backlight_helper_LDADD = \
172+ $(GLIB_LIBS) \
173+ -lm
174+
175+xfpm_power_backlight_helper_CFLAGS = \
176+ $(GLIB_CFLAGS) \
177+ $(PLATFORM_CPPFLAGS) \
178+ $(PLATFORM_CFLAGS)
179+
180+polkit_policydir = $(datadir)/polkit-1/actions
181+polkit_policy_DATA = \
182+ org.xfce.power.policy
183+
184+# You will need a recent intltool or the patch from this bug
185+# http://bugzilla.gnome.org/show_bug.cgi?id=462312
186+@INTLTOOL_POLICY_RULE@
187+
188+.in2.in:
189+ sed "s|[@]sbindir@|${sbindir}|" $< > $@
190+
191+endif
192+
193+manpagedir = $(mandir)/man1
194+
195+manpage_DATA = xfce4-power-manager.1
196+
197+xfpm_glib_headers = \
198+ $(srcdir)/xfpm-enum-glib.h
199+
200+BUILT_SOURCES = \
201+ xfce-power-manager-dbus-server.h \
202+ xfce-power-manager-dbus-client.h \
203+ xfpm-enum-types.c \
204+ xfpm-enum-types.h \
205+ xfpm-marshal.c \
206+ xfpm-marshal.h \
207+ org.freedesktop.PowerManagement.h \
208+ org.freedesktop.PowerManagement.Inhibit.h
209+
210+if MAINTAINER_MODE
211+
212+xfpm-enum-types.h: $(xfpm_glib_headers)
213+ ( cd $(srcdir) && glib-mkenums \
214+ --fhead "#ifndef _XFPM_ENUM_TYPES_H\n#define _XFPM_ENUM_TYPES_H\n#include <glib-object.h>\nG_BEGIN_DECLS\n" \
215+ --fprod "/* enumerations from \"@filename@\" */\n" \
216+ --vhead "GType @enum_name@_get_type (void);\n#define XFPM_TYPE_@ENUMSHORT@ (@enum_name@_get_type())\n" \
217+ --ftail "G_END_DECLS\n\n#endif /* _XFPM_ENUM_TYPES_H__ */" \
218+ $(xfpm_glib_headers) ) >> xgen \
219+ && (cmp -s xgen xfpm-enum-types.h || cp xgen xfpm-enum-types.h ) \
220+ && rm -f xgen xgen~
221+
222+xfpm-enum-types.c: xfpm-enum-types.h
223+ ( cd $(srcdir) && glib-mkenums \
224+ --fhead "#include <xfpm-enum-types.h>\n" \
225+ --fhead "#include \"xfpm-enum-glib.h\"\n\n" \
226+ --fprod "\n/* enumerations from \"@filename@\" */\n" \
227+ --vhead "GType\n@enum_name@_get_type (void)\n{\n\tstatic GType type = 0;\n\tif (type == 0) {\n\tstatic const G@Type@Value values[] = {"\
228+ --vprod "\t{ @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \
229+ --vtail "\t{ 0, NULL, NULL }\n\t};\n\ttype = g_@type@_register_static (\"@EnumName@\", values);\n }\n\treturn type;\n}\n" \
230+ $(xfpm_glib_headers) ) > xgen \
231+ && cp xgen xfpm-enum-types.c \
232+ && rm -f xgen xgen~
233+
234+xfpm-marshal.c: xfpm-marshal.list
235+ echo "#include \"xfpm-marshal.h\"" > $@ && \
236+ glib-genmarshal $< --prefix=_xfpm_marshal --body >> $@
237+
238+xfpm-marshal.h: xfpm-marshal.list
239+ glib-genmarshal $< --prefix=_xfpm_marshal --header > $@
240+
241+xfce-power-manager-dbus-server.h: $(srcdir)/org.xfce.Power.Manager.xml
242+ dbus-binding-tool --mode=glib-server --prefix=xfpm_manager $< >$@
243+
244+xfce-power-manager-dbus-client.h: $(srcdir)/org.xfce.Power.Manager.xml
245+ dbus-binding-tool --mode=glib-client --prefix=xfpm_manager $< >$@
246+
247+org.freedesktop.PowerManagement.h: $(srcdir)/org.freedesktop.PowerManagement.xml
248+ dbus-binding-tool --mode=glib-server --prefix=xfpm_power $< >$@
249+
250+org.freedesktop.PowerManagement.Inhibit.h: $(srcdir)/org.freedesktop.PowerManagement.Inhibit.xml
251+ dbus-binding-tool --mode=glib-server --prefix=xfpm_inhibit $< >$@
252+
253+endif
254+
255+@INTLTOOL_DESKTOP_RULE@
256+autostartdir = $(sysconfdir)/xdg/autostart
257+autostart_in_files = xfce4-power-manager.desktop.in
258+autostart_DATA = $(autostart_in_files:.desktop.in=.desktop)
259+
260+EXTRA_DIST = \
261+ xfpm-marshal.list \
262+ $(autostart_in_files) \
263+ org.xfce.power.policy.in2 \
264+ $(manpage_DATA)
265+
266+DISTCLEANFILES = \
267+ $(BUILT_SOURCES) \
268+ xfce4-power-manager.desktop \
269+ org.xfce.power.policy \
270+ org.xfce.power.policy.in
271
272=== removed file '.pc/01_Remove_custom_OSD_brightness_popup,_use_libnotify_instead.patch/src/Makefile.am'
273--- .pc/01_Remove_custom_OSD_brightness_popup,_use_libnotify_instead.patch/src/Makefile.am 2013-05-22 00:46:08 +0000
274+++ .pc/01_Remove_custom_OSD_brightness_popup,_use_libnotify_instead.patch/src/Makefile.am 1970-01-01 00:00:00 +0000
275@@ -1,211 +0,0 @@
276-bin_PROGRAMS = xfce4-power-manager \
277- xfce4-power-information
278-
279-xfce4_power_manager_SOURCES = \
280- $(BUILT_SOURCES) \
281- xfpm-enum.h \
282- xfpm-enum-glib.h \
283- xfpm-main.c \
284- xfpm-manager.c \
285- xfpm-manager.h \
286- xfpm-power.c \
287- xfpm-power.h \
288- xfpm-power-common.c \
289- xfpm-power-common.h \
290- xfpm-battery.c \
291- xfpm-battery.h \
292- xfpm-xfconf.c \
293- xfpm-xfconf.h \
294- xfpm-disks.c \
295- xfpm-disks.h \
296- xfpm-console-kit.c \
297- xfpm-console-kit.h \
298- egg-idletime.c \
299- egg-idletime.h \
300- xfpm-backlight.c \
301- xfpm-backlight.h \
302- xfpm-dpms.c \
303- xfpm-dpms.h \
304- xfpm-button.c \
305- xfpm-button.h \
306- xfpm-network-manager.c \
307- xfpm-network-manager.h \
308- xfpm-inhibit.c \
309- xfpm-inhibit.h \
310- xfpm-notify.c \
311- xfpm-notify.h \
312- xfpm-polkit.c \
313- xfpm-polkit.h \
314- xfpm-errors.c \
315- xfpm-errors.h \
316- gsd-media-keys-window.c \
317- gsd-media-keys-window.h
318-
319-xfce4_power_manager_CFLAGS = \
320- -I$(top_srcdir) \
321- -I$(top_srcdir)/common \
322- -I$(top_srcdir)/libdbus \
323- -DLOCALEDIR=\"$(localedir)\" \
324- -DG_LOG_DOMAIN=\"xfce4-power-manager\" \
325- -DSYSCONFDIR=\"$(sysconfdir)\" \
326- $(GOBJECT_CFLAGS) \
327- $(GTHREAD_CFLAGS) \
328- $(DBUS_GLIB_CFLAGS) \
329- $(LIBXFCE4UI_CFLAGS) \
330- $(XFCONF_CFLAGS) \
331- $(LIBNOTIFY_CFLAGS) \
332- $(XRANDR_CFLAGS) \
333- $(DPMS_CFLAGS) \
334- $(PLATFORM_CPPFLAGS) \
335- $(PLATFORM_CFLAGS)
336-
337-xfce4_power_manager_LDFLAGS = \
338- -no-undefined \
339- $(PLATFORM_LDFLAGS)
340-
341-xfce4_power_manager_LDADD = \
342- $(top_builddir)/common/libxfpmcommon.la \
343- $(top_builddir)/libdbus/libxfpmdbus.la \
344- $(GOBJECT_LIBS) \
345- $(GTHREAD_LIBS) \
346- $(DBUS_GLIB_LIBS) \
347- $(LIBXFCE4UI_LIBS) \
348- $(XFCONF_LIBS) \
349- $(LIBNOTIFY_LIBS) \
350- $(XRANDR_LIBS) \
351- $(DPMS_LIBS)
352-
353-xfce4_power_information_SOURCES = \
354- xfpm-power-info.c \
355- xfpm-power-common.c \
356- xfpm-power-common.h
357-
358-xfce4_power_information_CFLAGS = \
359- -I$(top_srcdir) \
360- -I$(top_srcdir)/common \
361- -I$(top_srcdir)/libdbus \
362- -DLOCALEDIR=\"$(localedir)\" \
363- -DG_LOG_DOMAIN=\"xfce4-power-information\"\
364- $(GOBJECT_CFLAGS) \
365- $(DBUS_GLIB_CFLAGS) \
366- $(LIBXFCE4UI_CFLAGS) \
367- $(PLATFORM_CPPFLAGS) \
368- $(PLATFORM_CFLAGS)
369-
370-xfce4_power_information_LDFLAGS = \
371- -no-undefined \
372- $(PLATFORM_LDFLAGS)
373-
374-xfce4_power_information_LDADD = \
375- $(GOBJECT_LIBS) \
376- $(DBUS_GLIB_LIBS) \
377- $(LIBXFCE4UI_LIBS) \
378- $(top_builddir)/libdbus/libxfpmdbus.la
379-
380-if ENABLE_POLKIT
381-
382-sbin_PROGRAMS = xfpm-power-backlight-helper
383-
384-xfpm_power_backlight_helper_SOURCES = \
385- xfpm-backlight-helper.c
386-
387-xfpm_power_backlight_helper_LDADD = \
388- $(GLIB_LIBS) \
389- -lm
390-
391-xfpm_power_backlight_helper_CFLAGS = \
392- $(GLIB_CFLAGS) \
393- $(PLATFORM_CPPFLAGS) \
394- $(PLATFORM_CFLAGS)
395-
396-polkit_policydir = $(datadir)/polkit-1/actions
397-polkit_policy_DATA = \
398- org.xfce.power.policy
399-
400-# You will need a recent intltool or the patch from this bug
401-# http://bugzilla.gnome.org/show_bug.cgi?id=462312
402-@INTLTOOL_POLICY_RULE@
403-
404-.in2.in:
405- sed "s|[@]sbindir@|${sbindir}|" $< > $@
406-
407-endif
408-
409-manpagedir = $(mandir)/man1
410-
411-manpage_DATA = xfce4-power-manager.1
412-
413-xfpm_glib_headers = \
414- $(srcdir)/xfpm-enum-glib.h
415-
416-BUILT_SOURCES = \
417- xfce-power-manager-dbus-server.h \
418- xfce-power-manager-dbus-client.h \
419- xfpm-enum-types.c \
420- xfpm-enum-types.h \
421- xfpm-marshal.c \
422- xfpm-marshal.h \
423- org.freedesktop.PowerManagement.h \
424- org.freedesktop.PowerManagement.Inhibit.h
425-
426-if MAINTAINER_MODE
427-
428-xfpm-enum-types.h: $(xfpm_glib_headers)
429- ( cd $(srcdir) && glib-mkenums \
430- --fhead "#ifndef _XFPM_ENUM_TYPES_H\n#define _XFPM_ENUM_TYPES_H\n#include <glib-object.h>\nG_BEGIN_DECLS\n" \
431- --fprod "/* enumerations from \"@filename@\" */\n" \
432- --vhead "GType @enum_name@_get_type (void);\n#define XFPM_TYPE_@ENUMSHORT@ (@enum_name@_get_type())\n" \
433- --ftail "G_END_DECLS\n\n#endif /* _XFPM_ENUM_TYPES_H__ */" \
434- $(xfpm_glib_headers) ) >> xgen \
435- && (cmp -s xgen xfpm-enum-types.h || cp xgen xfpm-enum-types.h ) \
436- && rm -f xgen xgen~
437-
438-xfpm-enum-types.c: xfpm-enum-types.h
439- ( cd $(srcdir) && glib-mkenums \
440- --fhead "#include <xfpm-enum-types.h>\n" \
441- --fhead "#include \"xfpm-enum-glib.h\"\n\n" \
442- --fprod "\n/* enumerations from \"@filename@\" */\n" \
443- --vhead "GType\n@enum_name@_get_type (void)\n{\n\tstatic GType type = 0;\n\tif (type == 0) {\n\tstatic const G@Type@Value values[] = {"\
444- --vprod "\t{ @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \
445- --vtail "\t{ 0, NULL, NULL }\n\t};\n\ttype = g_@type@_register_static (\"@EnumName@\", values);\n }\n\treturn type;\n}\n" \
446- $(xfpm_glib_headers) ) > xgen \
447- && cp xgen xfpm-enum-types.c \
448- && rm -f xgen xgen~
449-
450-xfpm-marshal.c: xfpm-marshal.list
451- echo "#include \"xfpm-marshal.h\"" > $@ && \
452- glib-genmarshal $< --prefix=_xfpm_marshal --body >> $@
453-
454-xfpm-marshal.h: xfpm-marshal.list
455- glib-genmarshal $< --prefix=_xfpm_marshal --header > $@
456-
457-xfce-power-manager-dbus-server.h: $(srcdir)/org.xfce.Power.Manager.xml
458- dbus-binding-tool --mode=glib-server --prefix=xfpm_manager $< >$@
459-
460-xfce-power-manager-dbus-client.h: $(srcdir)/org.xfce.Power.Manager.xml
461- dbus-binding-tool --mode=glib-client --prefix=xfpm_manager $< >$@
462-
463-org.freedesktop.PowerManagement.h: $(srcdir)/org.freedesktop.PowerManagement.xml
464- dbus-binding-tool --mode=glib-server --prefix=xfpm_power $< >$@
465-
466-org.freedesktop.PowerManagement.Inhibit.h: $(srcdir)/org.freedesktop.PowerManagement.Inhibit.xml
467- dbus-binding-tool --mode=glib-server --prefix=xfpm_inhibit $< >$@
468-
469-endif
470-
471-@INTLTOOL_DESKTOP_RULE@
472-autostartdir = $(sysconfdir)/xdg/autostart
473-autostart_in_files = xfce4-power-manager.desktop.in
474-autostart_DATA = $(autostart_in_files:.desktop.in=.desktop)
475-
476-EXTRA_DIST = \
477- xfpm-marshal.list \
478- $(autostart_in_files) \
479- org.xfce.power.policy.in2 \
480- $(manpage_DATA)
481-
482-DISTCLEANFILES = \
483- $(BUILT_SOURCES) \
484- xfce4-power-manager.desktop \
485- org.xfce.power.policy \
486- org.xfce.power.policy.in
487
488=== added file '.pc/01_Remove_custom_OSD_brightness_popup,_use_libnotify_instead.patch/src/gsd-media-keys-window.c'
489--- .pc/01_Remove_custom_OSD_brightness_popup,_use_libnotify_instead.patch/src/gsd-media-keys-window.c 1970-01-01 00:00:00 +0000
490+++ .pc/01_Remove_custom_OSD_brightness_popup,_use_libnotify_instead.patch/src/gsd-media-keys-window.c 2014-01-22 05:17:49 +0000
491@@ -0,0 +1,1078 @@
492+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
493+ *
494+ * Copyright (C) 2006-2007 William Jon McCann <mccann@jhu.edu>
495+ *
496+ * This program is free software; you can redistribute it and/or modify
497+ * it under the terms of the GNU General Public License as published by
498+ * the Free Software Foundation; either version 2 of the License, or
499+ * (at your option) any later version.
500+ *
501+ * This program is distributed in the hope that it will be useful,
502+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
503+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
504+ * GNU General Public License for more details.
505+ *
506+ * You should have received a copy of the GNU General Public License
507+ * along with this program; if not, write to the Free Software
508+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
509+ *
510+ */
511+
512+#include "config.h"
513+
514+#include <stdlib.h>
515+#include <string.h>
516+#include <math.h>
517+#include <glib.h>
518+#include <glib/gi18n.h>
519+#include <gtk/gtk.h>
520+
521+#include "gsd-media-keys-window.h"
522+
523+#include "data/interfaces/acme_ui.h"
524+
525+#define DIALOG_TIMEOUT 2000 /* dialog timeout in ms */
526+#define DIALOG_FADE_TIMEOUT 1500 /* timeout before fade starts */
527+#define FADE_TIMEOUT 10 /* timeout in ms between each frame of the fade */
528+
529+#define BG_ALPHA 0.75
530+#define FG_ALPHA 1.00
531+
532+#define GSD_MEDIA_KEYS_WINDOW_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_MEDIA_KEYS_WINDOW, GsdMediaKeysWindowPrivate))
533+
534+struct GsdMediaKeysWindowPrivate
535+{
536+ guint is_composited : 1;
537+ guint hide_timeout_id;
538+ guint fade_timeout_id;
539+ double fade_out_alpha;
540+ GsdMediaKeysWindowAction action;
541+ char *icon_name;
542+ gboolean show_level;
543+
544+ guint volume_muted : 1;
545+ int volume_level;
546+
547+ GtkImage *image;
548+ GtkWidget *progress;
549+};
550+
551+G_DEFINE_TYPE (GsdMediaKeysWindow, gsd_media_keys_window, GTK_TYPE_WINDOW)
552+
553+static gboolean
554+fade_timeout (GsdMediaKeysWindow *window)
555+{
556+ if (window->priv->fade_out_alpha <= 0.0) {
557+ gtk_widget_hide (GTK_WIDGET (window));
558+
559+ /* Reset it for the next time */
560+ window->priv->fade_out_alpha = 1.0;
561+ window->priv->fade_timeout_id = 0;
562+
563+ return FALSE;
564+ } else {
565+ GdkRectangle rect;
566+ GtkWidget *win = GTK_WIDGET (window);
567+ GtkAllocation allocation;
568+
569+ window->priv->fade_out_alpha -= 0.10;
570+
571+ rect.x = 0;
572+ rect.y = 0;
573+ gtk_widget_get_allocation (win, &allocation);
574+ rect.width = allocation.width;
575+ rect.height = allocation.height;
576+
577+ gtk_widget_realize (win);
578+ gdk_window_invalidate_rect (gtk_widget_get_window (win), &rect, FALSE);
579+ }
580+
581+ return TRUE;
582+}
583+
584+static gboolean
585+hide_timeout (GsdMediaKeysWindow *window)
586+{
587+ if (window->priv->is_composited) {
588+ window->priv->hide_timeout_id = 0;
589+ window->priv->fade_timeout_id = g_timeout_add (FADE_TIMEOUT,
590+ (GSourceFunc) fade_timeout,
591+ window);
592+ } else {
593+ gtk_widget_hide (GTK_WIDGET (window));
594+ }
595+
596+ return FALSE;
597+}
598+
599+static void
600+remove_hide_timeout (GsdMediaKeysWindow *window)
601+{
602+ if (window->priv->hide_timeout_id != 0) {
603+ g_source_remove (window->priv->hide_timeout_id);
604+ window->priv->hide_timeout_id = 0;
605+ }
606+
607+ if (window->priv->fade_timeout_id != 0) {
608+ g_source_remove (window->priv->fade_timeout_id);
609+ window->priv->fade_timeout_id = 0;
610+ window->priv->fade_out_alpha = 1.0;
611+ }
612+}
613+
614+static void
615+add_hide_timeout (GsdMediaKeysWindow *window)
616+{
617+ int timeout;
618+
619+ if (window->priv->is_composited) {
620+ timeout = DIALOG_FADE_TIMEOUT;
621+ } else {
622+ timeout = DIALOG_TIMEOUT;
623+ }
624+ window->priv->hide_timeout_id = g_timeout_add (timeout,
625+ (GSourceFunc) hide_timeout,
626+ window);
627+}
628+
629+static void
630+update_window (GsdMediaKeysWindow *window)
631+{
632+ remove_hide_timeout (window);
633+ add_hide_timeout (window);
634+
635+ if (window->priv->is_composited) {
636+ gtk_widget_queue_draw (GTK_WIDGET (window));
637+ }
638+}
639+
640+static void
641+volume_controls_set_visible (GsdMediaKeysWindow *window,
642+ gboolean visible)
643+{
644+ if (window->priv->progress == NULL)
645+ return;
646+
647+ if (visible) {
648+ gtk_widget_show (window->priv->progress);
649+ } else {
650+ gtk_widget_hide (window->priv->progress);
651+ }
652+}
653+
654+static void
655+window_set_icon_name (GsdMediaKeysWindow *window,
656+ const char *name)
657+{
658+ if (window->priv->image == NULL)
659+ return;
660+
661+ gtk_image_set_from_icon_name (window->priv->image,
662+ name, GTK_ICON_SIZE_DIALOG);
663+}
664+
665+static void
666+action_changed (GsdMediaKeysWindow *window)
667+{
668+ if (! window->priv->is_composited) {
669+ switch (window->priv->action) {
670+ case GSD_MEDIA_KEYS_WINDOW_ACTION_VOLUME:
671+ volume_controls_set_visible (window, TRUE);
672+
673+ if (window->priv->volume_muted) {
674+ window_set_icon_name (window, "audio-volume-muted");
675+ } else {
676+ window_set_icon_name (window, "audio-volume-high");
677+ }
678+
679+ break;
680+ case GSD_MEDIA_KEYS_WINDOW_ACTION_CUSTOM:
681+ volume_controls_set_visible (window, window->priv->show_level);
682+ window_set_icon_name (window, window->priv->icon_name);
683+ break;
684+ default:
685+ g_assert_not_reached ();
686+ break;
687+ }
688+ }
689+
690+ update_window (window);
691+}
692+
693+static void
694+volume_level_changed (GsdMediaKeysWindow *window)
695+{
696+ update_window (window);
697+
698+ if (!window->priv->is_composited && window->priv->progress != NULL) {
699+ double fraction;
700+
701+ fraction = (double) window->priv->volume_level / 100.0;
702+
703+ gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (window->priv->progress),
704+ fraction);
705+ }
706+}
707+
708+static void
709+volume_muted_changed (GsdMediaKeysWindow *window)
710+{
711+ update_window (window);
712+
713+ if (! window->priv->is_composited) {
714+ if (window->priv->volume_muted) {
715+ window_set_icon_name (window, "audio-volume-muted");
716+ } else {
717+ window_set_icon_name (window, "audio-volume-high");
718+ }
719+ }
720+}
721+
722+void
723+gsd_media_keys_window_set_action (GsdMediaKeysWindow *window,
724+ GsdMediaKeysWindowAction action)
725+{
726+ g_return_if_fail (GSD_IS_MEDIA_KEYS_WINDOW (window));
727+ g_return_if_fail (action == GSD_MEDIA_KEYS_WINDOW_ACTION_VOLUME);
728+
729+ if (window->priv->action != action) {
730+ window->priv->action = action;
731+ action_changed (window);
732+ } else {
733+ update_window (window);
734+ }
735+}
736+
737+void
738+gsd_media_keys_window_set_action_custom (GsdMediaKeysWindow *window,
739+ const char *icon_name,
740+ gboolean show_level)
741+{
742+ g_return_if_fail (GSD_IS_MEDIA_KEYS_WINDOW (window));
743+ g_return_if_fail (icon_name != NULL);
744+
745+ if (window->priv->action != GSD_MEDIA_KEYS_WINDOW_ACTION_CUSTOM ||
746+ g_strcmp0 (window->priv->icon_name, icon_name) != 0 ||
747+ window->priv->show_level != show_level) {
748+ window->priv->action = GSD_MEDIA_KEYS_WINDOW_ACTION_CUSTOM;
749+ g_free (window->priv->icon_name);
750+ window->priv->icon_name = g_strdup (icon_name);
751+ window->priv->show_level = show_level;
752+ action_changed (window);
753+ } else {
754+ update_window (window);
755+ }
756+}
757+
758+void
759+gsd_media_keys_window_set_volume_muted (GsdMediaKeysWindow *window,
760+ gboolean muted)
761+{
762+ g_return_if_fail (GSD_IS_MEDIA_KEYS_WINDOW (window));
763+
764+ if (window->priv->volume_muted != muted) {
765+ window->priv->volume_muted = muted;
766+ volume_muted_changed (window);
767+ }
768+}
769+
770+void
771+gsd_media_keys_window_set_volume_level (GsdMediaKeysWindow *window,
772+ int level)
773+{
774+ g_return_if_fail (GSD_IS_MEDIA_KEYS_WINDOW (window));
775+
776+ if (window->priv->volume_level != level) {
777+ window->priv->volume_level = level;
778+ volume_level_changed (window);
779+ }
780+}
781+
782+static void
783+rounded_rectangle (cairo_t* cr,
784+ gdouble aspect,
785+ gdouble x,
786+ gdouble y,
787+ gdouble corner_radius,
788+ gdouble width,
789+ gdouble height)
790+{
791+ gdouble radius = corner_radius / aspect;
792+
793+ cairo_move_to (cr, x + radius, y);
794+
795+ cairo_line_to (cr,
796+ x + width - radius,
797+ y);
798+ cairo_arc (cr,
799+ x + width - radius,
800+ y + radius,
801+ radius,
802+ -90.0f * G_PI / 180.0f,
803+ 0.0f * G_PI / 180.0f);
804+ cairo_line_to (cr,
805+ x + width,
806+ y + height - radius);
807+ cairo_arc (cr,
808+ x + width - radius,
809+ y + height - radius,
810+ radius,
811+ 0.0f * G_PI / 180.0f,
812+ 90.0f * G_PI / 180.0f);
813+ cairo_line_to (cr,
814+ x + radius,
815+ y + height);
816+ cairo_arc (cr,
817+ x + radius,
818+ y + height - radius,
819+ radius,
820+ 90.0f * G_PI / 180.0f,
821+ 180.0f * G_PI / 180.0f);
822+ cairo_line_to (cr,
823+ x,
824+ y + radius);
825+ cairo_arc (cr,
826+ x + radius,
827+ y + radius,
828+ radius,
829+ 180.0f * G_PI / 180.0f,
830+ 270.0f * G_PI / 180.0f);
831+ cairo_close_path (cr);
832+}
833+
834+static GdkPixbuf *
835+load_pixbuf (GsdMediaKeysWindow *window,
836+ const char *name,
837+ int icon_size)
838+{
839+ GtkIconTheme *theme;
840+ GdkPixbuf *pixbuf;
841+
842+ if (window != NULL && gtk_widget_has_screen (GTK_WIDGET (window))) {
843+ theme = gtk_icon_theme_get_for_screen (gtk_widget_get_screen (GTK_WIDGET (window)));
844+ } else {
845+ theme = gtk_icon_theme_get_default ();
846+ }
847+
848+ pixbuf = gtk_icon_theme_load_icon (theme,
849+ name,
850+ icon_size,
851+ GTK_ICON_LOOKUP_FORCE_SVG,
852+ NULL);
853+
854+ /* make sure the pixbuf is close to the requested size
855+ * this is necessary because GTK_ICON_LOOKUP_FORCE_SVG
856+ * seems to be broken */
857+ if (pixbuf != NULL) {
858+ int width;
859+
860+ width = gdk_pixbuf_get_width (pixbuf);
861+ if (width < (float)icon_size * 0.75) {
862+ g_object_unref (pixbuf);
863+ pixbuf = NULL;
864+ }
865+ }
866+
867+ return pixbuf;
868+}
869+
870+static void
871+draw_eject (cairo_t *cr,
872+ double _x0,
873+ double _y0,
874+ double width,
875+ double height)
876+{
877+ int box_height;
878+ int tri_height;
879+ int separation;
880+
881+ box_height = height * 0.2;
882+ separation = box_height / 3;
883+ tri_height = height - box_height - separation;
884+
885+ cairo_rectangle (cr, _x0, _y0 + height - box_height, width, box_height);
886+
887+ cairo_move_to (cr, _x0, _y0 + tri_height);
888+ cairo_rel_line_to (cr, width, 0);
889+ cairo_rel_line_to (cr, -width / 2, -tri_height);
890+ cairo_rel_line_to (cr, -width / 2, tri_height);
891+ cairo_close_path (cr);
892+ cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, FG_ALPHA);
893+ cairo_fill_preserve (cr);
894+
895+ cairo_set_source_rgba (cr, 0.6, 0.6, 0.6, FG_ALPHA / 2);
896+ cairo_set_line_width (cr, 2);
897+ cairo_stroke (cr);
898+}
899+
900+static void
901+draw_waves (cairo_t *cr,
902+ double cx,
903+ double cy,
904+ double max_radius,
905+ int volume_level)
906+{
907+ const int n_waves = 3;
908+ int last_wave;
909+ int i;
910+
911+ last_wave = n_waves * volume_level / 100;
912+
913+ for (i = 0; i < n_waves; i++) {
914+ double angle1;
915+ double angle2;
916+ double radius;
917+ double alpha;
918+
919+ angle1 = -M_PI / 4;
920+ angle2 = M_PI / 4;
921+
922+ if (i < last_wave)
923+ alpha = 1.0;
924+ else if (i > last_wave)
925+ alpha = 0.1;
926+ else alpha = 0.1 + 0.9 * (n_waves * volume_level % 100) / 100.0;
927+
928+ radius = (i + 1) * (max_radius / n_waves);
929+ cairo_arc (cr, cx, cy, radius, angle1, angle2);
930+ cairo_set_source_rgba (cr, 0.6, 0.6, 0.6, alpha / 2);
931+ cairo_set_line_width (cr, 14);
932+ cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND);
933+ cairo_stroke_preserve (cr);
934+
935+ cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, alpha);
936+ cairo_set_line_width (cr, 10);
937+ cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND);
938+ cairo_stroke (cr);
939+ }
940+}
941+
942+static void
943+draw_cross (cairo_t *cr,
944+ double cx,
945+ double cy,
946+ double size)
947+{
948+ cairo_move_to (cr, cx, cy - size/2.0);
949+ cairo_rel_line_to (cr, size, size);
950+
951+ cairo_move_to (cr, cx, cy + size/2.0);
952+ cairo_rel_line_to (cr, size, -size);
953+
954+ cairo_set_source_rgba (cr, 0.6, 0.6, 0.6, FG_ALPHA / 2);
955+ cairo_set_line_width (cr, 14);
956+ cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND);
957+ cairo_stroke_preserve (cr);
958+
959+ cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, FG_ALPHA);
960+ cairo_set_line_width (cr, 10);
961+ cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND);
962+ cairo_stroke (cr);
963+}
964+
965+static void
966+draw_speaker (cairo_t *cr,
967+ double cx,
968+ double cy,
969+ double width,
970+ double height)
971+{
972+ double box_width;
973+ double box_height;
974+ double _x0;
975+ double _y0;
976+
977+ box_width = width / 3;
978+ box_height = height / 3;
979+
980+ _x0 = cx - (width / 2) + box_width;
981+ _y0 = cy - box_height / 2;
982+
983+ cairo_move_to (cr, _x0, _y0);
984+ cairo_rel_line_to (cr, - box_width, 0);
985+ cairo_rel_line_to (cr, 0, box_height);
986+ cairo_rel_line_to (cr, box_width, 0);
987+
988+ cairo_line_to (cr, cx + box_width, cy + height / 2);
989+ cairo_rel_line_to (cr, 0, -height);
990+ cairo_line_to (cr, _x0, _y0);
991+ cairo_close_path (cr);
992+
993+ cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, FG_ALPHA);
994+ cairo_fill_preserve (cr);
995+
996+ cairo_set_source_rgba (cr, 0.6, 0.6, 0.6, FG_ALPHA / 2);
997+ cairo_set_line_width (cr, 2);
998+ cairo_stroke (cr);
999+}
1000+
1001+static gboolean
1002+render_speaker (GsdMediaKeysWindow *window,
1003+ cairo_t *cr,
1004+ double _x0,
1005+ double _y0,
1006+ double width,
1007+ double height)
1008+{
1009+ GdkPixbuf *pixbuf;
1010+ int icon_size;
1011+ int n;
1012+ static const char *icon_names[] = {
1013+ "audio-volume-muted",
1014+ "audio-volume-low",
1015+ "audio-volume-medium",
1016+ "audio-volume-high",
1017+ NULL
1018+ };
1019+
1020+ if (window->priv->volume_muted) {
1021+ n = 0;
1022+ } else {
1023+ /* select image */
1024+ n = 3 * window->priv->volume_level / 100 + 1;
1025+ if (n < 1) {
1026+ n = 1;
1027+ } else if (n > 3) {
1028+ n = 3;
1029+ }
1030+ }
1031+
1032+ icon_size = (int)width;
1033+
1034+ pixbuf = load_pixbuf (window, icon_names[n], icon_size);
1035+
1036+ if (pixbuf == NULL) {
1037+ return FALSE;
1038+ }
1039+
1040+ gdk_cairo_set_source_pixbuf (cr, pixbuf, _x0, _y0);
1041+ cairo_paint_with_alpha (cr, FG_ALPHA);
1042+
1043+ g_object_unref (pixbuf);
1044+
1045+ return TRUE;
1046+}
1047+
1048+static void
1049+color_reverse (const GdkColor *a,
1050+ GdkColor *b)
1051+{
1052+ gdouble red;
1053+ gdouble green;
1054+ gdouble blue;
1055+ gdouble h;
1056+ gdouble s;
1057+ gdouble v;
1058+
1059+ red = (gdouble) a->red / 65535.0;
1060+ green = (gdouble) a->green / 65535.0;
1061+ blue = (gdouble) a->blue / 65535.0;
1062+
1063+ gtk_rgb_to_hsv (red, green, blue, &h, &s, &v);
1064+
1065+ v = 0.5 + (0.5 - v);
1066+ if (v > 1.0)
1067+ v = 1.0;
1068+ else if (v < 0.0)
1069+ v = 0.0;
1070+
1071+ gtk_hsv_to_rgb (h, s, v, &red, &green, &blue);
1072+
1073+ b->red = red * 65535.0;
1074+ b->green = green * 65535.0;
1075+ b->blue = blue * 65535.0;
1076+}
1077+
1078+static void
1079+draw_volume_boxes (GsdMediaKeysWindow *window,
1080+ cairo_t *cr,
1081+ double percentage,
1082+ double _x0,
1083+ double _y0,
1084+ double width,
1085+ double height)
1086+{
1087+ gdouble x1;
1088+ GdkColor color;
1089+ double r, g, b;
1090+ GtkStyle *style;
1091+
1092+ _x0 += 0.5;
1093+ _y0 += 0.5;
1094+ height = round (height) - 1;
1095+ width = round (width) - 1;
1096+ x1 = round ((width - 1) * percentage);
1097+ style = gtk_widget_get_style (GTK_WIDGET (window));
1098+
1099+ /* bar background */
1100+ color_reverse (&style->dark[GTK_STATE_NORMAL], &color);
1101+ r = (float)color.red / 65535.0;
1102+ g = (float)color.green / 65535.0;
1103+ b = (float)color.blue / 65535.0;
1104+ rounded_rectangle (cr, 1.0, _x0, _y0, height / 6, width, height);
1105+ cairo_set_source_rgba (cr, r, g, b, FG_ALPHA / 2);
1106+ cairo_fill_preserve (cr);
1107+
1108+ /* bar border */
1109+ color_reverse (&style->light[GTK_STATE_NORMAL], &color);
1110+ r = (float)color.red / 65535.0;
1111+ g = (float)color.green / 65535.0;
1112+ b = (float)color.blue / 65535.0;
1113+ cairo_set_source_rgba (cr, r, g, b, FG_ALPHA / 2);
1114+ cairo_set_line_width (cr, 1);
1115+ cairo_stroke (cr);
1116+
1117+ /* bar progress */
1118+ if (percentage < 0.01)
1119+ return;
1120+ color = style->bg[GTK_STATE_NORMAL];
1121+ r = (float)color.red / 65535.0;
1122+ g = (float)color.green / 65535.0;
1123+ b = (float)color.blue / 65535.0;
1124+ rounded_rectangle (cr, 1.0, _x0 + 0.5, _y0 + 0.5, height / 6 - 0.5, x1, height - 1);
1125+ cairo_set_source_rgba (cr, r, g, b, FG_ALPHA);
1126+ cairo_fill (cr);
1127+}
1128+
1129+static void
1130+draw_action_volume (GsdMediaKeysWindow *window,
1131+ cairo_t *cr)
1132+{
1133+ int window_width;
1134+ int window_height;
1135+ double icon_box_width;
1136+ double icon_box_height;
1137+ double icon_box_x0;
1138+ double icon_box_y0;
1139+ double volume_box_x0;
1140+ double volume_box_y0;
1141+ double volume_box_width;
1142+ double volume_box_height;
1143+ gboolean res;
1144+
1145+ gtk_window_get_size (GTK_WINDOW (window), &window_width, &window_height);
1146+
1147+ icon_box_width = round (window_width * 0.65);
1148+ icon_box_height = round (window_height * 0.65);
1149+ volume_box_width = icon_box_width;
1150+ volume_box_height = round (window_height * 0.05);
1151+
1152+ icon_box_x0 = (window_width - icon_box_width) / 2;
1153+ icon_box_y0 = (window_height - icon_box_height - volume_box_height) / 2;
1154+ volume_box_x0 = round (icon_box_x0);
1155+ volume_box_y0 = round (icon_box_height + icon_box_y0);
1156+
1157+#if 0
1158+ g_message ("icon box: w=%f h=%f _x0=%f _y0=%f",
1159+ icon_box_width,
1160+ icon_box_height,
1161+ icon_box_x0,
1162+ icon_box_y0);
1163+ g_message ("volume box: w=%f h=%f _x0=%f _y0=%f",
1164+ volume_box_width,
1165+ volume_box_height,
1166+ volume_box_x0,
1167+ volume_box_y0);
1168+#endif
1169+
1170+ res = render_speaker (window,
1171+ cr,
1172+ icon_box_x0, icon_box_y0,
1173+ icon_box_width, icon_box_height);
1174+ if (! res) {
1175+ double speaker_width;
1176+ double speaker_height;
1177+ double speaker_cx;
1178+ double speaker_cy;
1179+
1180+ speaker_width = icon_box_width * 0.5;
1181+ speaker_height = icon_box_height * 0.75;
1182+ speaker_cx = icon_box_x0 + speaker_width / 2;
1183+ speaker_cy = icon_box_y0 + speaker_height / 2;
1184+
1185+#if 0
1186+ g_message ("speaker box: w=%f h=%f cx=%f cy=%f",
1187+ speaker_width,
1188+ speaker_height,
1189+ speaker_cx,
1190+ speaker_cy);
1191+#endif
1192+
1193+ /* draw speaker symbol */
1194+ draw_speaker (cr, speaker_cx, speaker_cy, speaker_width, speaker_height);
1195+
1196+ if (! window->priv->volume_muted) {
1197+ /* draw sound waves */
1198+ double wave_x0;
1199+ double wave_y0;
1200+ double wave_radius;
1201+
1202+ wave_x0 = window_width / 2;
1203+ wave_y0 = speaker_cy;
1204+ wave_radius = icon_box_width / 2;
1205+
1206+ draw_waves (cr, wave_x0, wave_y0, wave_radius, window->priv->volume_level);
1207+ } else {
1208+ /* draw 'mute' cross */
1209+ double cross_x0;
1210+ double cross_y0;
1211+ double cross_size;
1212+
1213+ cross_size = speaker_width * 3 / 4;
1214+ cross_x0 = icon_box_x0 + icon_box_width - cross_size;
1215+ cross_y0 = speaker_cy;
1216+
1217+ draw_cross (cr, cross_x0, cross_y0, cross_size);
1218+ }
1219+ }
1220+
1221+ /* draw volume meter */
1222+ draw_volume_boxes (window,
1223+ cr,
1224+ (double)window->priv->volume_level / 100.0,
1225+ volume_box_x0,
1226+ volume_box_y0,
1227+ volume_box_width,
1228+ volume_box_height);
1229+}
1230+
1231+static gboolean
1232+render_custom (GsdMediaKeysWindow *window,
1233+ cairo_t *cr,
1234+ double _x0,
1235+ double _y0,
1236+ double width,
1237+ double height)
1238+{
1239+ GdkPixbuf *pixbuf;
1240+ int icon_size;
1241+
1242+ icon_size = (int)width;
1243+
1244+ pixbuf = load_pixbuf (window, window->priv->icon_name, icon_size);
1245+
1246+ if (pixbuf == NULL) {
1247+ char *name;
1248+ if (gtk_widget_get_direction (GTK_WIDGET (window)) == GTK_TEXT_DIR_RTL)
1249+ name = g_strdup_printf ("%s-rtl", window->priv->icon_name);
1250+ else
1251+ name = g_strdup_printf ("%s-ltr", window->priv->icon_name);
1252+ pixbuf = load_pixbuf (window, name, icon_size);
1253+ g_free (name);
1254+ if (pixbuf == NULL)
1255+ return FALSE;
1256+ }
1257+
1258+ gdk_cairo_set_source_pixbuf (cr, pixbuf, _x0, _y0);
1259+ cairo_paint_with_alpha (cr, FG_ALPHA);
1260+
1261+ g_object_unref (pixbuf);
1262+
1263+ return TRUE;
1264+}
1265+
1266+static void
1267+draw_action_custom (GsdMediaKeysWindow *window,
1268+ cairo_t *cr)
1269+{
1270+ int window_width;
1271+ int window_height;
1272+ double icon_box_width;
1273+ double icon_box_height;
1274+ double icon_box_x0;
1275+ double icon_box_y0;
1276+ double bright_box_x0;
1277+ double bright_box_y0;
1278+ double bright_box_width;
1279+ double bright_box_height;
1280+ gboolean res;
1281+
1282+ gtk_window_get_size (GTK_WINDOW (window), &window_width, &window_height);
1283+
1284+ icon_box_width = round (window_width * 0.65);
1285+ icon_box_height = round (window_height * 0.65);
1286+ bright_box_width = round (icon_box_width);
1287+ bright_box_height = round (window_height * 0.05);
1288+
1289+ icon_box_x0 = (window_width - icon_box_width) / 2;
1290+ icon_box_y0 = (window_height - icon_box_height - bright_box_height) / 2;
1291+ bright_box_x0 = round (icon_box_x0);
1292+ bright_box_y0 = round (icon_box_height + icon_box_y0);
1293+
1294+#if 0
1295+ g_message ("icon box: w=%f h=%f _x0=%f _y0=%f",
1296+ icon_box_width,
1297+ icon_box_height,
1298+ icon_box_x0,
1299+ icon_box_y0);
1300+ g_message ("brightness box: w=%f h=%f _x0=%f _y0=%f",
1301+ bright_box_width,
1302+ bright_box_height,
1303+ bright_box_x0,
1304+ bright_box_y0);
1305+#endif
1306+
1307+ res = render_custom (window,
1308+ cr,
1309+ icon_box_x0, icon_box_y0,
1310+ icon_box_width, icon_box_height);
1311+ if (! res && g_strcmp0 (window->priv->icon_name, "media-eject") == 0) {
1312+ /* draw eject symbol */
1313+ draw_eject (cr,
1314+ icon_box_x0, icon_box_y0,
1315+ icon_box_width, icon_box_height);
1316+ }
1317+
1318+ if (window->priv->show_level != FALSE) {
1319+ /* draw volume meter */
1320+ draw_volume_boxes (window,
1321+ cr,
1322+ (double)window->priv->volume_level / 100.0,
1323+ bright_box_x0,
1324+ bright_box_y0,
1325+ bright_box_width,
1326+ bright_box_height);
1327+ }
1328+}
1329+
1330+static void
1331+draw_action (GsdMediaKeysWindow *window,
1332+ cairo_t *cr)
1333+{
1334+ switch (window->priv->action) {
1335+ case GSD_MEDIA_KEYS_WINDOW_ACTION_VOLUME:
1336+ draw_action_volume (window, cr);
1337+ break;
1338+ case GSD_MEDIA_KEYS_WINDOW_ACTION_CUSTOM:
1339+ draw_action_custom (window, cr);
1340+ break;
1341+ default:
1342+ break;
1343+ }
1344+}
1345+
1346+static gboolean
1347+on_expose_event (GtkWidget *widget,
1348+ GdkEventExpose *event,
1349+ GsdMediaKeysWindow *window)
1350+{
1351+ cairo_t *context;
1352+ cairo_t *cr;
1353+ cairo_surface_t *surface;
1354+ int width;
1355+ int height;
1356+ GtkStyle *style;
1357+ GdkColor color;
1358+ double r, g, b;
1359+
1360+ context = gdk_cairo_create (gtk_widget_get_window (widget));
1361+
1362+ style = gtk_widget_get_style (widget);
1363+ cairo_set_operator (context, CAIRO_OPERATOR_SOURCE);
1364+ gtk_window_get_size (GTK_WINDOW (widget), &width, &height);
1365+
1366+ surface = cairo_surface_create_similar (cairo_get_target (context),
1367+ CAIRO_CONTENT_COLOR_ALPHA,
1368+ width,
1369+ height);
1370+
1371+ if (cairo_surface_status (surface) != CAIRO_STATUS_SUCCESS) {
1372+ goto done;
1373+ }
1374+
1375+ cr = cairo_create (surface);
1376+ if (cairo_status (cr) != CAIRO_STATUS_SUCCESS) {
1377+ goto done;
1378+ }
1379+ cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, 0.0);
1380+ cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
1381+ cairo_paint (cr);
1382+
1383+ /* draw a box */
1384+ rounded_rectangle (cr, 1.0, 0.5, 0.5, height / 10, width-1, height-1);
1385+ color_reverse (&style->bg[GTK_STATE_NORMAL], &color);
1386+ r = (float)color.red / 65535.0;
1387+ g = (float)color.green / 65535.0;
1388+ b = (float)color.blue / 65535.0;
1389+ cairo_set_source_rgba (cr, r, g, b, BG_ALPHA);
1390+ cairo_fill_preserve (cr);
1391+
1392+ color_reverse (&style->text_aa[GTK_STATE_NORMAL], &color);
1393+ r = (float)color.red / 65535.0;
1394+ g = (float)color.green / 65535.0;
1395+ b = (float)color.blue / 65535.0;
1396+ cairo_set_source_rgba (cr, r, g, b, BG_ALPHA / 2);
1397+ cairo_set_line_width (cr, 1);
1398+ cairo_stroke (cr);
1399+
1400+ /* draw action */
1401+ draw_action (window, cr);
1402+
1403+ cairo_destroy (cr);
1404+
1405+ /* Make sure we have a transparent background */
1406+ cairo_rectangle (context, 0, 0, width, height);
1407+ cairo_set_source_rgba (context, 0.0, 0.0, 0.0, 0.0);
1408+ cairo_fill (context);
1409+
1410+ cairo_set_source_surface (context, surface, 0, 0);
1411+ cairo_paint_with_alpha (context, window->priv->fade_out_alpha);
1412+
1413+ done:
1414+ if (surface != NULL) {
1415+ cairo_surface_destroy (surface);
1416+ }
1417+ cairo_destroy (context);
1418+
1419+ return FALSE;
1420+}
1421+
1422+static void
1423+gsd_media_keys_window_real_show (GtkWidget *widget)
1424+{
1425+ GsdMediaKeysWindow *window;
1426+
1427+ if (GTK_WIDGET_CLASS (gsd_media_keys_window_parent_class)->show) {
1428+ GTK_WIDGET_CLASS (gsd_media_keys_window_parent_class)->show (widget);
1429+ }
1430+
1431+ window = GSD_MEDIA_KEYS_WINDOW (widget);
1432+ remove_hide_timeout (window);
1433+ add_hide_timeout (window);
1434+}
1435+
1436+static void
1437+gsd_media_keys_window_real_hide (GtkWidget *widget)
1438+{
1439+ GsdMediaKeysWindow *window;
1440+
1441+ if (GTK_WIDGET_CLASS (gsd_media_keys_window_parent_class)->hide) {
1442+ GTK_WIDGET_CLASS (gsd_media_keys_window_parent_class)->hide (widget);
1443+ }
1444+
1445+ window = GSD_MEDIA_KEYS_WINDOW (widget);
1446+ remove_hide_timeout (window);
1447+}
1448+
1449+static void
1450+gsd_media_keys_window_real_realize (GtkWidget *widget)
1451+{
1452+ GdkColormap *colormap;
1453+ GtkAllocation allocation;
1454+ GdkBitmap *mask;
1455+ cairo_t *cr;
1456+
1457+ colormap = gdk_screen_get_rgba_colormap (gtk_widget_get_screen (widget));
1458+
1459+ if (colormap != NULL) {
1460+ gtk_widget_set_colormap (widget, colormap);
1461+ }
1462+
1463+ if (GTK_WIDGET_CLASS (gsd_media_keys_window_parent_class)->realize) {
1464+ GTK_WIDGET_CLASS (gsd_media_keys_window_parent_class)->realize (widget);
1465+ }
1466+
1467+ gtk_widget_get_allocation (widget, &allocation);
1468+ mask = gdk_pixmap_new (gtk_widget_get_window (widget),
1469+ allocation.width,
1470+ allocation.height,
1471+ 1);
1472+ cr = gdk_cairo_create (mask);
1473+
1474+ cairo_set_source_rgba (cr, 1., 1., 1., 0.);
1475+ cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
1476+ cairo_paint (cr);
1477+
1478+ /* make the whole window ignore events */
1479+ gdk_window_input_shape_combine_mask (gtk_widget_get_window (widget), mask, 0, 0);
1480+ g_object_unref (mask);
1481+ cairo_destroy (cr);
1482+}
1483+
1484+static void
1485+gsd_media_keys_window_class_init (GsdMediaKeysWindowClass *klass)
1486+{
1487+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
1488+
1489+ widget_class->show = gsd_media_keys_window_real_show;
1490+ widget_class->hide = gsd_media_keys_window_real_hide;
1491+ widget_class->realize = gsd_media_keys_window_real_realize;
1492+
1493+ g_type_class_add_private (klass, sizeof (GsdMediaKeysWindowPrivate));
1494+}
1495+
1496+gboolean
1497+gsd_media_keys_window_is_valid (GsdMediaKeysWindow *window)
1498+{
1499+ GdkScreen *screen = gtk_widget_get_screen (GTK_WIDGET (window));
1500+ return gdk_screen_is_composited (screen) == window->priv->is_composited;
1501+}
1502+
1503+static void
1504+gsd_media_keys_window_init (GsdMediaKeysWindow *window)
1505+{
1506+ GdkScreen *screen;
1507+
1508+ window->priv = GSD_MEDIA_KEYS_WINDOW_GET_PRIVATE (window);
1509+
1510+ screen = gtk_widget_get_screen (GTK_WIDGET (window));
1511+
1512+ window->priv->is_composited = gdk_screen_is_composited (screen);
1513+
1514+ if (window->priv->is_composited) {
1515+ gdouble scalew, scaleh, scale;
1516+ gint size;
1517+
1518+ gtk_window_set_decorated (GTK_WINDOW (window), FALSE);
1519+ gtk_widget_set_app_paintable (GTK_WIDGET (window), TRUE);
1520+
1521+ /* assume 130x130 on a 640x480 display and scale from there */
1522+ scalew = gdk_screen_get_width (screen) / 640.0;
1523+ scaleh = gdk_screen_get_height (screen) / 480.0;
1524+ scale = MIN (scalew, scaleh);
1525+ size = 130 * MAX (1, scale);
1526+
1527+ gtk_window_set_default_size (GTK_WINDOW (window), size, size);
1528+ g_signal_connect (window, "expose-event", G_CALLBACK (on_expose_event), window);
1529+
1530+ window->priv->fade_out_alpha = 1.0;
1531+ } else {
1532+ GtkBuilder *builder;
1533+ const gchar *objects[] = {"acme_frame", NULL};
1534+ GtkWidget *frame;
1535+
1536+ builder = gtk_builder_new ();
1537+ gtk_builder_add_objects_from_string (builder, acme_ui, acme_ui_length, (char **)objects, NULL);
1538+
1539+ window->priv->image = GTK_IMAGE (gtk_builder_get_object (builder, "acme_image"));
1540+ window->priv->progress = GTK_WIDGET (gtk_builder_get_object (builder, "acme_volume_progressbar"));
1541+ frame = GTK_WIDGET (gtk_builder_get_object (builder,
1542+ "acme_frame"));
1543+
1544+ if (frame != NULL) {
1545+ gtk_container_add (GTK_CONTAINER (window), frame);
1546+ gtk_widget_show_all (frame);
1547+ }
1548+
1549+ /* The builder needs to stay alive until the window
1550+ takes ownership of the frame (and its children) */
1551+ g_object_unref (builder);
1552+ }
1553+}
1554+
1555+GtkWidget *
1556+gsd_media_keys_window_new (void)
1557+{
1558+ GObject *object;
1559+
1560+ object = g_object_new (GSD_TYPE_MEDIA_KEYS_WINDOW,
1561+ "type", GTK_WINDOW_POPUP,
1562+ "type-hint", GDK_WINDOW_TYPE_HINT_NOTIFICATION,
1563+ "skip-taskbar-hint", TRUE,
1564+ "skip-pager-hint", TRUE,
1565+ "focus-on-map", FALSE,
1566+ NULL);
1567+
1568+ return GTK_WIDGET (object);
1569+}
1570
1571=== removed file '.pc/01_Remove_custom_OSD_brightness_popup,_use_libnotify_instead.patch/src/gsd-media-keys-window.c'
1572--- .pc/01_Remove_custom_OSD_brightness_popup,_use_libnotify_instead.patch/src/gsd-media-keys-window.c 2013-05-22 00:46:08 +0000
1573+++ .pc/01_Remove_custom_OSD_brightness_popup,_use_libnotify_instead.patch/src/gsd-media-keys-window.c 1970-01-01 00:00:00 +0000
1574@@ -1,1078 +0,0 @@
1575-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
1576- *
1577- * Copyright (C) 2006-2007 William Jon McCann <mccann@jhu.edu>
1578- *
1579- * This program is free software; you can redistribute it and/or modify
1580- * it under the terms of the GNU General Public License as published by
1581- * the Free Software Foundation; either version 2 of the License, or
1582- * (at your option) any later version.
1583- *
1584- * This program is distributed in the hope that it will be useful,
1585- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1586- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1587- * GNU General Public License for more details.
1588- *
1589- * You should have received a copy of the GNU General Public License
1590- * along with this program; if not, write to the Free Software
1591- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1592- *
1593- */
1594-
1595-#include "config.h"
1596-
1597-#include <stdlib.h>
1598-#include <string.h>
1599-#include <math.h>
1600-#include <glib.h>
1601-#include <glib/gi18n.h>
1602-#include <gtk/gtk.h>
1603-
1604-#include "gsd-media-keys-window.h"
1605-
1606-#include "data/interfaces/acme_ui.h"
1607-
1608-#define DIALOG_TIMEOUT 2000 /* dialog timeout in ms */
1609-#define DIALOG_FADE_TIMEOUT 1500 /* timeout before fade starts */
1610-#define FADE_TIMEOUT 10 /* timeout in ms between each frame of the fade */
1611-
1612-#define BG_ALPHA 0.75
1613-#define FG_ALPHA 1.00
1614-
1615-#define GSD_MEDIA_KEYS_WINDOW_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_MEDIA_KEYS_WINDOW, GsdMediaKeysWindowPrivate))
1616-
1617-struct GsdMediaKeysWindowPrivate
1618-{
1619- guint is_composited : 1;
1620- guint hide_timeout_id;
1621- guint fade_timeout_id;
1622- double fade_out_alpha;
1623- GsdMediaKeysWindowAction action;
1624- char *icon_name;
1625- gboolean show_level;
1626-
1627- guint volume_muted : 1;
1628- int volume_level;
1629-
1630- GtkImage *image;
1631- GtkWidget *progress;
1632-};
1633-
1634-G_DEFINE_TYPE (GsdMediaKeysWindow, gsd_media_keys_window, GTK_TYPE_WINDOW)
1635-
1636-static gboolean
1637-fade_timeout (GsdMediaKeysWindow *window)
1638-{
1639- if (window->priv->fade_out_alpha <= 0.0) {
1640- gtk_widget_hide (GTK_WIDGET (window));
1641-
1642- /* Reset it for the next time */
1643- window->priv->fade_out_alpha = 1.0;
1644- window->priv->fade_timeout_id = 0;
1645-
1646- return FALSE;
1647- } else {
1648- GdkRectangle rect;
1649- GtkWidget *win = GTK_WIDGET (window);
1650- GtkAllocation allocation;
1651-
1652- window->priv->fade_out_alpha -= 0.10;
1653-
1654- rect.x = 0;
1655- rect.y = 0;
1656- gtk_widget_get_allocation (win, &allocation);
1657- rect.width = allocation.width;
1658- rect.height = allocation.height;
1659-
1660- gtk_widget_realize (win);
1661- gdk_window_invalidate_rect (gtk_widget_get_window (win), &rect, FALSE);
1662- }
1663-
1664- return TRUE;
1665-}
1666-
1667-static gboolean
1668-hide_timeout (GsdMediaKeysWindow *window)
1669-{
1670- if (window->priv->is_composited) {
1671- window->priv->hide_timeout_id = 0;
1672- window->priv->fade_timeout_id = g_timeout_add (FADE_TIMEOUT,
1673- (GSourceFunc) fade_timeout,
1674- window);
1675- } else {
1676- gtk_widget_hide (GTK_WIDGET (window));
1677- }
1678-
1679- return FALSE;
1680-}
1681-
1682-static void
1683-remove_hide_timeout (GsdMediaKeysWindow *window)
1684-{
1685- if (window->priv->hide_timeout_id != 0) {
1686- g_source_remove (window->priv->hide_timeout_id);
1687- window->priv->hide_timeout_id = 0;
1688- }
1689-
1690- if (window->priv->fade_timeout_id != 0) {
1691- g_source_remove (window->priv->fade_timeout_id);
1692- window->priv->fade_timeout_id = 0;
1693- window->priv->fade_out_alpha = 1.0;
1694- }
1695-}
1696-
1697-static void
1698-add_hide_timeout (GsdMediaKeysWindow *window)
1699-{
1700- int timeout;
1701-
1702- if (window->priv->is_composited) {
1703- timeout = DIALOG_FADE_TIMEOUT;
1704- } else {
1705- timeout = DIALOG_TIMEOUT;
1706- }
1707- window->priv->hide_timeout_id = g_timeout_add (timeout,
1708- (GSourceFunc) hide_timeout,
1709- window);
1710-}
1711-
1712-static void
1713-update_window (GsdMediaKeysWindow *window)
1714-{
1715- remove_hide_timeout (window);
1716- add_hide_timeout (window);
1717-
1718- if (window->priv->is_composited) {
1719- gtk_widget_queue_draw (GTK_WIDGET (window));
1720- }
1721-}
1722-
1723-static void
1724-volume_controls_set_visible (GsdMediaKeysWindow *window,
1725- gboolean visible)
1726-{
1727- if (window->priv->progress == NULL)
1728- return;
1729-
1730- if (visible) {
1731- gtk_widget_show (window->priv->progress);
1732- } else {
1733- gtk_widget_hide (window->priv->progress);
1734- }
1735-}
1736-
1737-static void
1738-window_set_icon_name (GsdMediaKeysWindow *window,
1739- const char *name)
1740-{
1741- if (window->priv->image == NULL)
1742- return;
1743-
1744- gtk_image_set_from_icon_name (window->priv->image,
1745- name, GTK_ICON_SIZE_DIALOG);
1746-}
1747-
1748-static void
1749-action_changed (GsdMediaKeysWindow *window)
1750-{
1751- if (! window->priv->is_composited) {
1752- switch (window->priv->action) {
1753- case GSD_MEDIA_KEYS_WINDOW_ACTION_VOLUME:
1754- volume_controls_set_visible (window, TRUE);
1755-
1756- if (window->priv->volume_muted) {
1757- window_set_icon_name (window, "audio-volume-muted");
1758- } else {
1759- window_set_icon_name (window, "audio-volume-high");
1760- }
1761-
1762- break;
1763- case GSD_MEDIA_KEYS_WINDOW_ACTION_CUSTOM:
1764- volume_controls_set_visible (window, window->priv->show_level);
1765- window_set_icon_name (window, window->priv->icon_name);
1766- break;
1767- default:
1768- g_assert_not_reached ();
1769- break;
1770- }
1771- }
1772-
1773- update_window (window);
1774-}
1775-
1776-static void
1777-volume_level_changed (GsdMediaKeysWindow *window)
1778-{
1779- update_window (window);
1780-
1781- if (!window->priv->is_composited && window->priv->progress != NULL) {
1782- double fraction;
1783-
1784- fraction = (double) window->priv->volume_level / 100.0;
1785-
1786- gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (window->priv->progress),
1787- fraction);
1788- }
1789-}
1790-
1791-static void
1792-volume_muted_changed (GsdMediaKeysWindow *window)
1793-{
1794- update_window (window);
1795-
1796- if (! window->priv->is_composited) {
1797- if (window->priv->volume_muted) {
1798- window_set_icon_name (window, "audio-volume-muted");
1799- } else {
1800- window_set_icon_name (window, "audio-volume-high");
1801- }
1802- }
1803-}
1804-
1805-void
1806-gsd_media_keys_window_set_action (GsdMediaKeysWindow *window,
1807- GsdMediaKeysWindowAction action)
1808-{
1809- g_return_if_fail (GSD_IS_MEDIA_KEYS_WINDOW (window));
1810- g_return_if_fail (action == GSD_MEDIA_KEYS_WINDOW_ACTION_VOLUME);
1811-
1812- if (window->priv->action != action) {
1813- window->priv->action = action;
1814- action_changed (window);
1815- } else {
1816- update_window (window);
1817- }
1818-}
1819-
1820-void
1821-gsd_media_keys_window_set_action_custom (GsdMediaKeysWindow *window,
1822- const char *icon_name,
1823- gboolean show_level)
1824-{
1825- g_return_if_fail (GSD_IS_MEDIA_KEYS_WINDOW (window));
1826- g_return_if_fail (icon_name != NULL);
1827-
1828- if (window->priv->action != GSD_MEDIA_KEYS_WINDOW_ACTION_CUSTOM ||
1829- g_strcmp0 (window->priv->icon_name, icon_name) != 0 ||
1830- window->priv->show_level != show_level) {
1831- window->priv->action = GSD_MEDIA_KEYS_WINDOW_ACTION_CUSTOM;
1832- g_free (window->priv->icon_name);
1833- window->priv->icon_name = g_strdup (icon_name);
1834- window->priv->show_level = show_level;
1835- action_changed (window);
1836- } else {
1837- update_window (window);
1838- }
1839-}
1840-
1841-void
1842-gsd_media_keys_window_set_volume_muted (GsdMediaKeysWindow *window,
1843- gboolean muted)
1844-{
1845- g_return_if_fail (GSD_IS_MEDIA_KEYS_WINDOW (window));
1846-
1847- if (window->priv->volume_muted != muted) {
1848- window->priv->volume_muted = muted;
1849- volume_muted_changed (window);
1850- }
1851-}
1852-
1853-void
1854-gsd_media_keys_window_set_volume_level (GsdMediaKeysWindow *window,
1855- int level)
1856-{
1857- g_return_if_fail (GSD_IS_MEDIA_KEYS_WINDOW (window));
1858-
1859- if (window->priv->volume_level != level) {
1860- window->priv->volume_level = level;
1861- volume_level_changed (window);
1862- }
1863-}
1864-
1865-static void
1866-rounded_rectangle (cairo_t* cr,
1867- gdouble aspect,
1868- gdouble x,
1869- gdouble y,
1870- gdouble corner_radius,
1871- gdouble width,
1872- gdouble height)
1873-{
1874- gdouble radius = corner_radius / aspect;
1875-
1876- cairo_move_to (cr, x + radius, y);
1877-
1878- cairo_line_to (cr,
1879- x + width - radius,
1880- y);
1881- cairo_arc (cr,
1882- x + width - radius,
1883- y + radius,
1884- radius,
1885- -90.0f * G_PI / 180.0f,
1886- 0.0f * G_PI / 180.0f);
1887- cairo_line_to (cr,
1888- x + width,
1889- y + height - radius);
1890- cairo_arc (cr,
1891- x + width - radius,
1892- y + height - radius,
1893- radius,
1894- 0.0f * G_PI / 180.0f,
1895- 90.0f * G_PI / 180.0f);
1896- cairo_line_to (cr,
1897- x + radius,
1898- y + height);
1899- cairo_arc (cr,
1900- x + radius,
1901- y + height - radius,
1902- radius,
1903- 90.0f * G_PI / 180.0f,
1904- 180.0f * G_PI / 180.0f);
1905- cairo_line_to (cr,
1906- x,
1907- y + radius);
1908- cairo_arc (cr,
1909- x + radius,
1910- y + radius,
1911- radius,
1912- 180.0f * G_PI / 180.0f,
1913- 270.0f * G_PI / 180.0f);
1914- cairo_close_path (cr);
1915-}
1916-
1917-static GdkPixbuf *
1918-load_pixbuf (GsdMediaKeysWindow *window,
1919- const char *name,
1920- int icon_size)
1921-{
1922- GtkIconTheme *theme;
1923- GdkPixbuf *pixbuf;
1924-
1925- if (window != NULL && gtk_widget_has_screen (GTK_WIDGET (window))) {
1926- theme = gtk_icon_theme_get_for_screen (gtk_widget_get_screen (GTK_WIDGET (window)));
1927- } else {
1928- theme = gtk_icon_theme_get_default ();
1929- }
1930-
1931- pixbuf = gtk_icon_theme_load_icon (theme,
1932- name,
1933- icon_size,
1934- GTK_ICON_LOOKUP_FORCE_SVG,
1935- NULL);
1936-
1937- /* make sure the pixbuf is close to the requested size
1938- * this is necessary because GTK_ICON_LOOKUP_FORCE_SVG
1939- * seems to be broken */
1940- if (pixbuf != NULL) {
1941- int width;
1942-
1943- width = gdk_pixbuf_get_width (pixbuf);
1944- if (width < (float)icon_size * 0.75) {
1945- g_object_unref (pixbuf);
1946- pixbuf = NULL;
1947- }
1948- }
1949-
1950- return pixbuf;
1951-}
1952-
1953-static void
1954-draw_eject (cairo_t *cr,
1955- double _x0,
1956- double _y0,
1957- double width,
1958- double height)
1959-{
1960- int box_height;
1961- int tri_height;
1962- int separation;
1963-
1964- box_height = height * 0.2;
1965- separation = box_height / 3;
1966- tri_height = height - box_height - separation;
1967-
1968- cairo_rectangle (cr, _x0, _y0 + height - box_height, width, box_height);
1969-
1970- cairo_move_to (cr, _x0, _y0 + tri_height);
1971- cairo_rel_line_to (cr, width, 0);
1972- cairo_rel_line_to (cr, -width / 2, -tri_height);
1973- cairo_rel_line_to (cr, -width / 2, tri_height);
1974- cairo_close_path (cr);
1975- cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, FG_ALPHA);
1976- cairo_fill_preserve (cr);
1977-
1978- cairo_set_source_rgba (cr, 0.6, 0.6, 0.6, FG_ALPHA / 2);
1979- cairo_set_line_width (cr, 2);
1980- cairo_stroke (cr);
1981-}
1982-
1983-static void
1984-draw_waves (cairo_t *cr,
1985- double cx,
1986- double cy,
1987- double max_radius,
1988- int volume_level)
1989-{
1990- const int n_waves = 3;
1991- int last_wave;
1992- int i;
1993-
1994- last_wave = n_waves * volume_level / 100;
1995-
1996- for (i = 0; i < n_waves; i++) {
1997- double angle1;
1998- double angle2;
1999- double radius;
2000- double alpha;
2001-
2002- angle1 = -M_PI / 4;
2003- angle2 = M_PI / 4;
2004-
2005- if (i < last_wave)
2006- alpha = 1.0;
2007- else if (i > last_wave)
2008- alpha = 0.1;
2009- else alpha = 0.1 + 0.9 * (n_waves * volume_level % 100) / 100.0;
2010-
2011- radius = (i + 1) * (max_radius / n_waves);
2012- cairo_arc (cr, cx, cy, radius, angle1, angle2);
2013- cairo_set_source_rgba (cr, 0.6, 0.6, 0.6, alpha / 2);
2014- cairo_set_line_width (cr, 14);
2015- cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND);
2016- cairo_stroke_preserve (cr);
2017-
2018- cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, alpha);
2019- cairo_set_line_width (cr, 10);
2020- cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND);
2021- cairo_stroke (cr);
2022- }
2023-}
2024-
2025-static void
2026-draw_cross (cairo_t *cr,
2027- double cx,
2028- double cy,
2029- double size)
2030-{
2031- cairo_move_to (cr, cx, cy - size/2.0);
2032- cairo_rel_line_to (cr, size, size);
2033-
2034- cairo_move_to (cr, cx, cy + size/2.0);
2035- cairo_rel_line_to (cr, size, -size);
2036-
2037- cairo_set_source_rgba (cr, 0.6, 0.6, 0.6, FG_ALPHA / 2);
2038- cairo_set_line_width (cr, 14);
2039- cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND);
2040- cairo_stroke_preserve (cr);
2041-
2042- cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, FG_ALPHA);
2043- cairo_set_line_width (cr, 10);
2044- cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND);
2045- cairo_stroke (cr);
2046-}
2047-
2048-static void
2049-draw_speaker (cairo_t *cr,
2050- double cx,
2051- double cy,
2052- double width,
2053- double height)
2054-{
2055- double box_width;
2056- double box_height;
2057- double _x0;
2058- double _y0;
2059-
2060- box_width = width / 3;
2061- box_height = height / 3;
2062-
2063- _x0 = cx - (width / 2) + box_width;
2064- _y0 = cy - box_height / 2;
2065-
2066- cairo_move_to (cr, _x0, _y0);
2067- cairo_rel_line_to (cr, - box_width, 0);
2068- cairo_rel_line_to (cr, 0, box_height);
2069- cairo_rel_line_to (cr, box_width, 0);
2070-
2071- cairo_line_to (cr, cx + box_width, cy + height / 2);
2072- cairo_rel_line_to (cr, 0, -height);
2073- cairo_line_to (cr, _x0, _y0);
2074- cairo_close_path (cr);
2075-
2076- cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, FG_ALPHA);
2077- cairo_fill_preserve (cr);
2078-
2079- cairo_set_source_rgba (cr, 0.6, 0.6, 0.6, FG_ALPHA / 2);
2080- cairo_set_line_width (cr, 2);
2081- cairo_stroke (cr);
2082-}
2083-
2084-static gboolean
2085-render_speaker (GsdMediaKeysWindow *window,
2086- cairo_t *cr,
2087- double _x0,
2088- double _y0,
2089- double width,
2090- double height)
2091-{
2092- GdkPixbuf *pixbuf;
2093- int icon_size;
2094- int n;
2095- static const char *icon_names[] = {
2096- "audio-volume-muted",
2097- "audio-volume-low",
2098- "audio-volume-medium",
2099- "audio-volume-high",
2100- NULL
2101- };
2102-
2103- if (window->priv->volume_muted) {
2104- n = 0;
2105- } else {
2106- /* select image */
2107- n = 3 * window->priv->volume_level / 100 + 1;
2108- if (n < 1) {
2109- n = 1;
2110- } else if (n > 3) {
2111- n = 3;
2112- }
2113- }
2114-
2115- icon_size = (int)width;
2116-
2117- pixbuf = load_pixbuf (window, icon_names[n], icon_size);
2118-
2119- if (pixbuf == NULL) {
2120- return FALSE;
2121- }
2122-
2123- gdk_cairo_set_source_pixbuf (cr, pixbuf, _x0, _y0);
2124- cairo_paint_with_alpha (cr, FG_ALPHA);
2125-
2126- g_object_unref (pixbuf);
2127-
2128- return TRUE;
2129-}
2130-
2131-static void
2132-color_reverse (const GdkColor *a,
2133- GdkColor *b)
2134-{
2135- gdouble red;
2136- gdouble green;
2137- gdouble blue;
2138- gdouble h;
2139- gdouble s;
2140- gdouble v;
2141-
2142- red = (gdouble) a->red / 65535.0;
2143- green = (gdouble) a->green / 65535.0;
2144- blue = (gdouble) a->blue / 65535.0;
2145-
2146- gtk_rgb_to_hsv (red, green, blue, &h, &s, &v);
2147-
2148- v = 0.5 + (0.5 - v);
2149- if (v > 1.0)
2150- v = 1.0;
2151- else if (v < 0.0)
2152- v = 0.0;
2153-
2154- gtk_hsv_to_rgb (h, s, v, &red, &green, &blue);
2155-
2156- b->red = red * 65535.0;
2157- b->green = green * 65535.0;
2158- b->blue = blue * 65535.0;
2159-}
2160-
2161-static void
2162-draw_volume_boxes (GsdMediaKeysWindow *window,
2163- cairo_t *cr,
2164- double percentage,
2165- double _x0,
2166- double _y0,
2167- double width,
2168- double height)
2169-{
2170- gdouble x1;
2171- GdkColor color;
2172- double r, g, b;
2173- GtkStyle *style;
2174-
2175- _x0 += 0.5;
2176- _y0 += 0.5;
2177- height = round (height) - 1;
2178- width = round (width) - 1;
2179- x1 = round ((width - 1) * percentage);
2180- style = gtk_widget_get_style (GTK_WIDGET (window));
2181-
2182- /* bar background */
2183- color_reverse (&style->dark[GTK_STATE_NORMAL], &color);
2184- r = (float)color.red / 65535.0;
2185- g = (float)color.green / 65535.0;
2186- b = (float)color.blue / 65535.0;
2187- rounded_rectangle (cr, 1.0, _x0, _y0, height / 6, width, height);
2188- cairo_set_source_rgba (cr, r, g, b, FG_ALPHA / 2);
2189- cairo_fill_preserve (cr);
2190-
2191- /* bar border */
2192- color_reverse (&style->light[GTK_STATE_NORMAL], &color);
2193- r = (float)color.red / 65535.0;
2194- g = (float)color.green / 65535.0;
2195- b = (float)color.blue / 65535.0;
2196- cairo_set_source_rgba (cr, r, g, b, FG_ALPHA / 2);
2197- cairo_set_line_width (cr, 1);
2198- cairo_stroke (cr);
2199-
2200- /* bar progress */
2201- if (percentage < 0.01)
2202- return;
2203- color = style->bg[GTK_STATE_NORMAL];
2204- r = (float)color.red / 65535.0;
2205- g = (float)color.green / 65535.0;
2206- b = (float)color.blue / 65535.0;
2207- rounded_rectangle (cr, 1.0, _x0 + 0.5, _y0 + 0.5, height / 6 - 0.5, x1, height - 1);
2208- cairo_set_source_rgba (cr, r, g, b, FG_ALPHA);
2209- cairo_fill (cr);
2210-}
2211-
2212-static void
2213-draw_action_volume (GsdMediaKeysWindow *window,
2214- cairo_t *cr)
2215-{
2216- int window_width;
2217- int window_height;
2218- double icon_box_width;
2219- double icon_box_height;
2220- double icon_box_x0;
2221- double icon_box_y0;
2222- double volume_box_x0;
2223- double volume_box_y0;
2224- double volume_box_width;
2225- double volume_box_height;
2226- gboolean res;
2227-
2228- gtk_window_get_size (GTK_WINDOW (window), &window_width, &window_height);
2229-
2230- icon_box_width = round (window_width * 0.65);
2231- icon_box_height = round (window_height * 0.65);
2232- volume_box_width = icon_box_width;
2233- volume_box_height = round (window_height * 0.05);
2234-
2235- icon_box_x0 = (window_width - icon_box_width) / 2;
2236- icon_box_y0 = (window_height - icon_box_height - volume_box_height) / 2;
2237- volume_box_x0 = round (icon_box_x0);
2238- volume_box_y0 = round (icon_box_height + icon_box_y0);
2239-
2240-#if 0
2241- g_message ("icon box: w=%f h=%f _x0=%f _y0=%f",
2242- icon_box_width,
2243- icon_box_height,
2244- icon_box_x0,
2245- icon_box_y0);
2246- g_message ("volume box: w=%f h=%f _x0=%f _y0=%f",
2247- volume_box_width,
2248- volume_box_height,
2249- volume_box_x0,
2250- volume_box_y0);
2251-#endif
2252-
2253- res = render_speaker (window,
2254- cr,
2255- icon_box_x0, icon_box_y0,
2256- icon_box_width, icon_box_height);
2257- if (! res) {
2258- double speaker_width;
2259- double speaker_height;
2260- double speaker_cx;
2261- double speaker_cy;
2262-
2263- speaker_width = icon_box_width * 0.5;
2264- speaker_height = icon_box_height * 0.75;
2265- speaker_cx = icon_box_x0 + speaker_width / 2;
2266- speaker_cy = icon_box_y0 + speaker_height / 2;
2267-
2268-#if 0
2269- g_message ("speaker box: w=%f h=%f cx=%f cy=%f",
2270- speaker_width,
2271- speaker_height,
2272- speaker_cx,
2273- speaker_cy);
2274-#endif
2275-
2276- /* draw speaker symbol */
2277- draw_speaker (cr, speaker_cx, speaker_cy, speaker_width, speaker_height);
2278-
2279- if (! window->priv->volume_muted) {
2280- /* draw sound waves */
2281- double wave_x0;
2282- double wave_y0;
2283- double wave_radius;
2284-
2285- wave_x0 = window_width / 2;
2286- wave_y0 = speaker_cy;
2287- wave_radius = icon_box_width / 2;
2288-
2289- draw_waves (cr, wave_x0, wave_y0, wave_radius, window->priv->volume_level);
2290- } else {
2291- /* draw 'mute' cross */
2292- double cross_x0;
2293- double cross_y0;
2294- double cross_size;
2295-
2296- cross_size = speaker_width * 3 / 4;
2297- cross_x0 = icon_box_x0 + icon_box_width - cross_size;
2298- cross_y0 = speaker_cy;
2299-
2300- draw_cross (cr, cross_x0, cross_y0, cross_size);
2301- }
2302- }
2303-
2304- /* draw volume meter */
2305- draw_volume_boxes (window,
2306- cr,
2307- (double)window->priv->volume_level / 100.0,
2308- volume_box_x0,
2309- volume_box_y0,
2310- volume_box_width,
2311- volume_box_height);
2312-}
2313-
2314-static gboolean
2315-render_custom (GsdMediaKeysWindow *window,
2316- cairo_t *cr,
2317- double _x0,
2318- double _y0,
2319- double width,
2320- double height)
2321-{
2322- GdkPixbuf *pixbuf;
2323- int icon_size;
2324-
2325- icon_size = (int)width;
2326-
2327- pixbuf = load_pixbuf (window, window->priv->icon_name, icon_size);
2328-
2329- if (pixbuf == NULL) {
2330- char *name;
2331- if (gtk_widget_get_direction (GTK_WIDGET (window)) == GTK_TEXT_DIR_RTL)
2332- name = g_strdup_printf ("%s-rtl", window->priv->icon_name);
2333- else
2334- name = g_strdup_printf ("%s-ltr", window->priv->icon_name);
2335- pixbuf = load_pixbuf (window, name, icon_size);
2336- g_free (name);
2337- if (pixbuf == NULL)
2338- return FALSE;
2339- }
2340-
2341- gdk_cairo_set_source_pixbuf (cr, pixbuf, _x0, _y0);
2342- cairo_paint_with_alpha (cr, FG_ALPHA);
2343-
2344- g_object_unref (pixbuf);
2345-
2346- return TRUE;
2347-}
2348-
2349-static void
2350-draw_action_custom (GsdMediaKeysWindow *window,
2351- cairo_t *cr)
2352-{
2353- int window_width;
2354- int window_height;
2355- double icon_box_width;
2356- double icon_box_height;
2357- double icon_box_x0;
2358- double icon_box_y0;
2359- double bright_box_x0;
2360- double bright_box_y0;
2361- double bright_box_width;
2362- double bright_box_height;
2363- gboolean res;
2364-
2365- gtk_window_get_size (GTK_WINDOW (window), &window_width, &window_height);
2366-
2367- icon_box_width = round (window_width * 0.65);
2368- icon_box_height = round (window_height * 0.65);
2369- bright_box_width = round (icon_box_width);
2370- bright_box_height = round (window_height * 0.05);
2371-
2372- icon_box_x0 = (window_width - icon_box_width) / 2;
2373- icon_box_y0 = (window_height - icon_box_height - bright_box_height) / 2;
2374- bright_box_x0 = round (icon_box_x0);
2375- bright_box_y0 = round (icon_box_height + icon_box_y0);
2376-
2377-#if 0
2378- g_message ("icon box: w=%f h=%f _x0=%f _y0=%f",
2379- icon_box_width,
2380- icon_box_height,
2381- icon_box_x0,
2382- icon_box_y0);
2383- g_message ("brightness box: w=%f h=%f _x0=%f _y0=%f",
2384- bright_box_width,
2385- bright_box_height,
2386- bright_box_x0,
2387- bright_box_y0);
2388-#endif
2389-
2390- res = render_custom (window,
2391- cr,
2392- icon_box_x0, icon_box_y0,
2393- icon_box_width, icon_box_height);
2394- if (! res && g_strcmp0 (window->priv->icon_name, "media-eject") == 0) {
2395- /* draw eject symbol */
2396- draw_eject (cr,
2397- icon_box_x0, icon_box_y0,
2398- icon_box_width, icon_box_height);
2399- }
2400-
2401- if (window->priv->show_level != FALSE) {
2402- /* draw volume meter */
2403- draw_volume_boxes (window,
2404- cr,
2405- (double)window->priv->volume_level / 100.0,
2406- bright_box_x0,
2407- bright_box_y0,
2408- bright_box_width,
2409- bright_box_height);
2410- }
2411-}
2412-
2413-static void
2414-draw_action (GsdMediaKeysWindow *window,
2415- cairo_t *cr)
2416-{
2417- switch (window->priv->action) {
2418- case GSD_MEDIA_KEYS_WINDOW_ACTION_VOLUME:
2419- draw_action_volume (window, cr);
2420- break;
2421- case GSD_MEDIA_KEYS_WINDOW_ACTION_CUSTOM:
2422- draw_action_custom (window, cr);
2423- break;
2424- default:
2425- break;
2426- }
2427-}
2428-
2429-static gboolean
2430-on_expose_event (GtkWidget *widget,
2431- GdkEventExpose *event,
2432- GsdMediaKeysWindow *window)
2433-{
2434- cairo_t *context;
2435- cairo_t *cr;
2436- cairo_surface_t *surface;
2437- int width;
2438- int height;
2439- GtkStyle *style;
2440- GdkColor color;
2441- double r, g, b;
2442-
2443- context = gdk_cairo_create (gtk_widget_get_window (widget));
2444-
2445- style = gtk_widget_get_style (widget);
2446- cairo_set_operator (context, CAIRO_OPERATOR_SOURCE);
2447- gtk_window_get_size (GTK_WINDOW (widget), &width, &height);
2448-
2449- surface = cairo_surface_create_similar (cairo_get_target (context),
2450- CAIRO_CONTENT_COLOR_ALPHA,
2451- width,
2452- height);
2453-
2454- if (cairo_surface_status (surface) != CAIRO_STATUS_SUCCESS) {
2455- goto done;
2456- }
2457-
2458- cr = cairo_create (surface);
2459- if (cairo_status (cr) != CAIRO_STATUS_SUCCESS) {
2460- goto done;
2461- }
2462- cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, 0.0);
2463- cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
2464- cairo_paint (cr);
2465-
2466- /* draw a box */
2467- rounded_rectangle (cr, 1.0, 0.5, 0.5, height / 10, width-1, height-1);
2468- color_reverse (&style->bg[GTK_STATE_NORMAL], &color);
2469- r = (float)color.red / 65535.0;
2470- g = (float)color.green / 65535.0;
2471- b = (float)color.blue / 65535.0;
2472- cairo_set_source_rgba (cr, r, g, b, BG_ALPHA);
2473- cairo_fill_preserve (cr);
2474-
2475- color_reverse (&style->text_aa[GTK_STATE_NORMAL], &color);
2476- r = (float)color.red / 65535.0;
2477- g = (float)color.green / 65535.0;
2478- b = (float)color.blue / 65535.0;
2479- cairo_set_source_rgba (cr, r, g, b, BG_ALPHA / 2);
2480- cairo_set_line_width (cr, 1);
2481- cairo_stroke (cr);
2482-
2483- /* draw action */
2484- draw_action (window, cr);
2485-
2486- cairo_destroy (cr);
2487-
2488- /* Make sure we have a transparent background */
2489- cairo_rectangle (context, 0, 0, width, height);
2490- cairo_set_source_rgba (context, 0.0, 0.0, 0.0, 0.0);
2491- cairo_fill (context);
2492-
2493- cairo_set_source_surface (context, surface, 0, 0);
2494- cairo_paint_with_alpha (context, window->priv->fade_out_alpha);
2495-
2496- done:
2497- if (surface != NULL) {
2498- cairo_surface_destroy (surface);
2499- }
2500- cairo_destroy (context);
2501-
2502- return FALSE;
2503-}
2504-
2505-static void
2506-gsd_media_keys_window_real_show (GtkWidget *widget)
2507-{
2508- GsdMediaKeysWindow *window;
2509-
2510- if (GTK_WIDGET_CLASS (gsd_media_keys_window_parent_class)->show) {
2511- GTK_WIDGET_CLASS (gsd_media_keys_window_parent_class)->show (widget);
2512- }
2513-
2514- window = GSD_MEDIA_KEYS_WINDOW (widget);
2515- remove_hide_timeout (window);
2516- add_hide_timeout (window);
2517-}
2518-
2519-static void
2520-gsd_media_keys_window_real_hide (GtkWidget *widget)
2521-{
2522- GsdMediaKeysWindow *window;
2523-
2524- if (GTK_WIDGET_CLASS (gsd_media_keys_window_parent_class)->hide) {
2525- GTK_WIDGET_CLASS (gsd_media_keys_window_parent_class)->hide (widget);
2526- }
2527-
2528- window = GSD_MEDIA_KEYS_WINDOW (widget);
2529- remove_hide_timeout (window);
2530-}
2531-
2532-static void
2533-gsd_media_keys_window_real_realize (GtkWidget *widget)
2534-{
2535- GdkColormap *colormap;
2536- GtkAllocation allocation;
2537- GdkBitmap *mask;
2538- cairo_t *cr;
2539-
2540- colormap = gdk_screen_get_rgba_colormap (gtk_widget_get_screen (widget));
2541-
2542- if (colormap != NULL) {
2543- gtk_widget_set_colormap (widget, colormap);
2544- }
2545-
2546- if (GTK_WIDGET_CLASS (gsd_media_keys_window_parent_class)->realize) {
2547- GTK_WIDGET_CLASS (gsd_media_keys_window_parent_class)->realize (widget);
2548- }
2549-
2550- gtk_widget_get_allocation (widget, &allocation);
2551- mask = gdk_pixmap_new (gtk_widget_get_window (widget),
2552- allocation.width,
2553- allocation.height,
2554- 1);
2555- cr = gdk_cairo_create (mask);
2556-
2557- cairo_set_source_rgba (cr, 1., 1., 1., 0.);
2558- cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
2559- cairo_paint (cr);
2560-
2561- /* make the whole window ignore events */
2562- gdk_window_input_shape_combine_mask (gtk_widget_get_window (widget), mask, 0, 0);
2563- g_object_unref (mask);
2564- cairo_destroy (cr);
2565-}
2566-
2567-static void
2568-gsd_media_keys_window_class_init (GsdMediaKeysWindowClass *klass)
2569-{
2570- GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
2571-
2572- widget_class->show = gsd_media_keys_window_real_show;
2573- widget_class->hide = gsd_media_keys_window_real_hide;
2574- widget_class->realize = gsd_media_keys_window_real_realize;
2575-
2576- g_type_class_add_private (klass, sizeof (GsdMediaKeysWindowPrivate));
2577-}
2578-
2579-gboolean
2580-gsd_media_keys_window_is_valid (GsdMediaKeysWindow *window)
2581-{
2582- GdkScreen *screen = gtk_widget_get_screen (GTK_WIDGET (window));
2583- return gdk_screen_is_composited (screen) == window->priv->is_composited;
2584-}
2585-
2586-static void
2587-gsd_media_keys_window_init (GsdMediaKeysWindow *window)
2588-{
2589- GdkScreen *screen;
2590-
2591- window->priv = GSD_MEDIA_KEYS_WINDOW_GET_PRIVATE (window);
2592-
2593- screen = gtk_widget_get_screen (GTK_WIDGET (window));
2594-
2595- window->priv->is_composited = gdk_screen_is_composited (screen);
2596-
2597- if (window->priv->is_composited) {
2598- gdouble scalew, scaleh, scale;
2599- gint size;
2600-
2601- gtk_window_set_decorated (GTK_WINDOW (window), FALSE);
2602- gtk_widget_set_app_paintable (GTK_WIDGET (window), TRUE);
2603-
2604- /* assume 130x130 on a 640x480 display and scale from there */
2605- scalew = gdk_screen_get_width (screen) / 640.0;
2606- scaleh = gdk_screen_get_height (screen) / 480.0;
2607- scale = MIN (scalew, scaleh);
2608- size = 130 * MAX (1, scale);
2609-
2610- gtk_window_set_default_size (GTK_WINDOW (window), size, size);
2611- g_signal_connect (window, "expose-event", G_CALLBACK (on_expose_event), window);
2612-
2613- window->priv->fade_out_alpha = 1.0;
2614- } else {
2615- GtkBuilder *builder;
2616- const gchar *objects[] = {"acme_frame", NULL};
2617- GtkWidget *frame;
2618-
2619- builder = gtk_builder_new ();
2620- gtk_builder_add_objects_from_string (builder, acme_ui, acme_ui_length, (char **)objects, NULL);
2621-
2622- window->priv->image = GTK_IMAGE (gtk_builder_get_object (builder, "acme_image"));
2623- window->priv->progress = GTK_WIDGET (gtk_builder_get_object (builder, "acme_volume_progressbar"));
2624- frame = GTK_WIDGET (gtk_builder_get_object (builder,
2625- "acme_frame"));
2626-
2627- if (frame != NULL) {
2628- gtk_container_add (GTK_CONTAINER (window), frame);
2629- gtk_widget_show_all (frame);
2630- }
2631-
2632- /* The builder needs to stay alive until the window
2633- takes ownership of the frame (and its children) */
2634- g_object_unref (builder);
2635- }
2636-}
2637-
2638-GtkWidget *
2639-gsd_media_keys_window_new (void)
2640-{
2641- GObject *object;
2642-
2643- object = g_object_new (GSD_TYPE_MEDIA_KEYS_WINDOW,
2644- "type", GTK_WINDOW_POPUP,
2645- "type-hint", GDK_WINDOW_TYPE_HINT_NOTIFICATION,
2646- "skip-taskbar-hint", TRUE,
2647- "skip-pager-hint", TRUE,
2648- "focus-on-map", FALSE,
2649- NULL);
2650-
2651- return GTK_WIDGET (object);
2652-}
2653
2654=== added file '.pc/01_Remove_custom_OSD_brightness_popup,_use_libnotify_instead.patch/src/gsd-media-keys-window.h'
2655--- .pc/01_Remove_custom_OSD_brightness_popup,_use_libnotify_instead.patch/src/gsd-media-keys-window.h 1970-01-01 00:00:00 +0000
2656+++ .pc/01_Remove_custom_OSD_brightness_popup,_use_libnotify_instead.patch/src/gsd-media-keys-window.h 2014-01-22 05:17:49 +0000
2657@@ -0,0 +1,71 @@
2658+/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8; tab-width: 8 -*-
2659+ *
2660+ * Copyright (C) 2006 William Jon McCann <mccann@jhu.edu>
2661+ *
2662+ * This program is free software; you can redistribute it and/or
2663+ * modify it under the terms of the GNU General Public License as
2664+ * published by the Free Software Foundation; either version 2 of the
2665+ * License, or (at your option) any later version.
2666+ *
2667+ * This program is distributed in the hope that it will be useful,
2668+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2669+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2670+ * General Public License for more details.
2671+ *
2672+ * You should have received a copy of the GNU General Public
2673+ * License along with this program; if not, write to the
2674+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
2675+ * Boston, MA 02111-1307, USA.
2676+ *
2677+ */
2678+
2679+#ifndef GSD_MEDIA_KEYS_WINDOW_H
2680+#define GSD_MEDIA_KEYS_WINDOW_H
2681+
2682+#include <glib-object.h>
2683+#include <gtk/gtk.h>
2684+
2685+G_BEGIN_DECLS
2686+
2687+#define GSD_TYPE_MEDIA_KEYS_WINDOW (gsd_media_keys_window_get_type ())
2688+#define GSD_MEDIA_KEYS_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GSD_TYPE_MEDIA_KEYS_WINDOW, GsdMediaKeysWindow))
2689+#define GSD_MEDIA_KEYS_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GSD_TYPE_MEDIA_KEYS_WINDOW, GsdMediaKeysWindowClass))
2690+#define GSD_IS_MEDIA_KEYS_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GSD_TYPE_MEDIA_KEYS_WINDOW))
2691+#define GSD_IS_MEDIA_KEYS_WINDOW_CLASS(klass) (G_TYPE_INSTANCE_GET_CLASS ((klass), GSD_TYPE_MEDIA_KEYS_WINDOW))
2692+
2693+typedef struct GsdMediaKeysWindow GsdMediaKeysWindow;
2694+typedef struct GsdMediaKeysWindowClass GsdMediaKeysWindowClass;
2695+typedef struct GsdMediaKeysWindowPrivate GsdMediaKeysWindowPrivate;
2696+
2697+struct GsdMediaKeysWindow {
2698+ GtkWindow parent;
2699+
2700+ GsdMediaKeysWindowPrivate *priv;
2701+};
2702+
2703+struct GsdMediaKeysWindowClass {
2704+ GtkWindowClass parent_class;
2705+};
2706+
2707+typedef enum {
2708+ GSD_MEDIA_KEYS_WINDOW_ACTION_VOLUME,
2709+ GSD_MEDIA_KEYS_WINDOW_ACTION_CUSTOM
2710+} GsdMediaKeysWindowAction;
2711+
2712+GType gsd_media_keys_window_get_type (void);
2713+
2714+GtkWidget * gsd_media_keys_window_new (void);
2715+void gsd_media_keys_window_set_action (GsdMediaKeysWindow *window,
2716+ GsdMediaKeysWindowAction action);
2717+void gsd_media_keys_window_set_action_custom (GsdMediaKeysWindow *window,
2718+ const char *icon_name,
2719+ gboolean show_level);
2720+void gsd_media_keys_window_set_volume_muted (GsdMediaKeysWindow *window,
2721+ gboolean muted);
2722+void gsd_media_keys_window_set_volume_level (GsdMediaKeysWindow *window,
2723+ int level);
2724+gboolean gsd_media_keys_window_is_valid (GsdMediaKeysWindow *window);
2725+
2726+G_END_DECLS
2727+
2728+#endif
2729
2730=== removed file '.pc/01_Remove_custom_OSD_brightness_popup,_use_libnotify_instead.patch/src/gsd-media-keys-window.h'
2731--- .pc/01_Remove_custom_OSD_brightness_popup,_use_libnotify_instead.patch/src/gsd-media-keys-window.h 2013-05-22 00:46:08 +0000
2732+++ .pc/01_Remove_custom_OSD_brightness_popup,_use_libnotify_instead.patch/src/gsd-media-keys-window.h 1970-01-01 00:00:00 +0000
2733@@ -1,71 +0,0 @@
2734-/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8; tab-width: 8 -*-
2735- *
2736- * Copyright (C) 2006 William Jon McCann <mccann@jhu.edu>
2737- *
2738- * This program is free software; you can redistribute it and/or
2739- * modify it under the terms of the GNU General Public License as
2740- * published by the Free Software Foundation; either version 2 of the
2741- * License, or (at your option) any later version.
2742- *
2743- * This program is distributed in the hope that it will be useful,
2744- * but WITHOUT ANY WARRANTY; without even the implied warranty of
2745- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2746- * General Public License for more details.
2747- *
2748- * You should have received a copy of the GNU General Public
2749- * License along with this program; if not, write to the
2750- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
2751- * Boston, MA 02111-1307, USA.
2752- *
2753- */
2754-
2755-#ifndef GSD_MEDIA_KEYS_WINDOW_H
2756-#define GSD_MEDIA_KEYS_WINDOW_H
2757-
2758-#include <glib-object.h>
2759-#include <gtk/gtk.h>
2760-
2761-G_BEGIN_DECLS
2762-
2763-#define GSD_TYPE_MEDIA_KEYS_WINDOW (gsd_media_keys_window_get_type ())
2764-#define GSD_MEDIA_KEYS_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GSD_TYPE_MEDIA_KEYS_WINDOW, GsdMediaKeysWindow))
2765-#define GSD_MEDIA_KEYS_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GSD_TYPE_MEDIA_KEYS_WINDOW, GsdMediaKeysWindowClass))
2766-#define GSD_IS_MEDIA_KEYS_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GSD_TYPE_MEDIA_KEYS_WINDOW))
2767-#define GSD_IS_MEDIA_KEYS_WINDOW_CLASS(klass) (G_TYPE_INSTANCE_GET_CLASS ((klass), GSD_TYPE_MEDIA_KEYS_WINDOW))
2768-
2769-typedef struct GsdMediaKeysWindow GsdMediaKeysWindow;
2770-typedef struct GsdMediaKeysWindowClass GsdMediaKeysWindowClass;
2771-typedef struct GsdMediaKeysWindowPrivate GsdMediaKeysWindowPrivate;
2772-
2773-struct GsdMediaKeysWindow {
2774- GtkWindow parent;
2775-
2776- GsdMediaKeysWindowPrivate *priv;
2777-};
2778-
2779-struct GsdMediaKeysWindowClass {
2780- GtkWindowClass parent_class;
2781-};
2782-
2783-typedef enum {
2784- GSD_MEDIA_KEYS_WINDOW_ACTION_VOLUME,
2785- GSD_MEDIA_KEYS_WINDOW_ACTION_CUSTOM
2786-} GsdMediaKeysWindowAction;
2787-
2788-GType gsd_media_keys_window_get_type (void);
2789-
2790-GtkWidget * gsd_media_keys_window_new (void);
2791-void gsd_media_keys_window_set_action (GsdMediaKeysWindow *window,
2792- GsdMediaKeysWindowAction action);
2793-void gsd_media_keys_window_set_action_custom (GsdMediaKeysWindow *window,
2794- const char *icon_name,
2795- gboolean show_level);
2796-void gsd_media_keys_window_set_volume_muted (GsdMediaKeysWindow *window,
2797- gboolean muted);
2798-void gsd_media_keys_window_set_volume_level (GsdMediaKeysWindow *window,
2799- int level);
2800-gboolean gsd_media_keys_window_is_valid (GsdMediaKeysWindow *window);
2801-
2802-G_END_DECLS
2803-
2804-#endif
2805
2806=== added file '.pc/01_Remove_custom_OSD_brightness_popup,_use_libnotify_instead.patch/src/xfpm-backlight.c'
2807--- .pc/01_Remove_custom_OSD_brightness_popup,_use_libnotify_instead.patch/src/xfpm-backlight.c 1970-01-01 00:00:00 +0000
2808+++ .pc/01_Remove_custom_OSD_brightness_popup,_use_libnotify_instead.patch/src/xfpm-backlight.c 2014-01-22 05:17:49 +0000
2809@@ -0,0 +1,478 @@
2810+/*
2811+ * * Copyright (C) 2009-2011 Ali <aliov@xfce.org>
2812+ *
2813+ * Licensed under the GNU General Public License Version 2
2814+ *
2815+ * This program is free software; you can redistribute it and/or modify
2816+ * it under the terms of the GNU General Public License as published by
2817+ * the Free Software Foundation; either version 2 of the License, or
2818+ * (at your option) any later version.
2819+ *
2820+ * This program is distributed in the hope that it will be useful,
2821+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2822+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2823+ * GNU General Public License for more details.
2824+ *
2825+ * You should have received a copy of the GNU General Public License
2826+ * along with this program; if not, write to the Free Software
2827+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2828+ */
2829+
2830+#ifdef HAVE_CONFIG_H
2831+#include <config.h>
2832+#endif
2833+
2834+#include <stdio.h>
2835+#include <stdlib.h>
2836+#include <string.h>
2837+
2838+#include <math.h>
2839+
2840+#include <gtk/gtk.h>
2841+#include <libxfce4util/libxfce4util.h>
2842+
2843+#include "xfpm-backlight.h"
2844+#include "egg-idletime.h"
2845+#include "xfpm-notify.h"
2846+#include "xfpm-xfconf.h"
2847+#include "xfpm-power.h"
2848+#include "xfpm-config.h"
2849+#include "xfpm-button.h"
2850+#include "xfpm-brightness.h"
2851+#include "xfpm-debug.h"
2852+#include "xfpm-icons.h"
2853+
2854+#include "gsd-media-keys-window.h"
2855+
2856+static void xfpm_backlight_finalize (GObject *object);
2857+
2858+static void xfpm_backlight_create_popup (XfpmBacklight *backlight);
2859+
2860+#define ALARM_DISABLED 9
2861+#define BRIGHTNESS_POPUP_SIZE 180
2862+
2863+#define XFPM_BACKLIGHT_GET_PRIVATE(o) \
2864+(G_TYPE_INSTANCE_GET_PRIVATE ((o), XFPM_TYPE_BACKLIGHT, XfpmBacklightPrivate))
2865+
2866+struct XfpmBacklightPrivate
2867+{
2868+ XfpmBrightness *brightness;
2869+ XfpmPower *power;
2870+ EggIdletime *idle;
2871+ XfpmXfconf *conf;
2872+ XfpmButton *button;
2873+ XfpmNotify *notify;
2874+
2875+ GtkWidget *osd;
2876+ NotifyNotification *n;
2877+
2878+
2879+ gulong destroy_id;
2880+
2881+ gboolean has_hw;
2882+ gboolean on_battery;
2883+
2884+ glong last_level;
2885+ glong max_level;
2886+
2887+ gboolean dimmed;
2888+ gboolean block;
2889+};
2890+
2891+G_DEFINE_TYPE (XfpmBacklight, xfpm_backlight, G_TYPE_OBJECT)
2892+
2893+static void
2894+xfpm_backlight_dim_brightness (XfpmBacklight *backlight)
2895+{
2896+ gboolean ret;
2897+
2898+ if (xfpm_power_get_mode (backlight->priv->power) == XFPM_POWER_MODE_NORMAL )
2899+ {
2900+ glong dim_level;
2901+
2902+ g_object_get (G_OBJECT (backlight->priv->conf),
2903+ backlight->priv->on_battery ? BRIGHTNESS_LEVEL_ON_BATTERY : BRIGHTNESS_LEVEL_ON_AC, &dim_level,
2904+ NULL);
2905+
2906+ ret = xfpm_brightness_get_level (backlight->priv->brightness, &backlight->priv->last_level);
2907+
2908+ if ( !ret )
2909+ {
2910+ g_warning ("Unable to get current brightness level");
2911+ return;
2912+ }
2913+
2914+ dim_level = dim_level * backlight->priv->max_level / 100;
2915+
2916+ /**
2917+ * Only reduce if the current level is brighter than
2918+ * the configured dim_level
2919+ **/
2920+ if (backlight->priv->last_level > dim_level)
2921+ {
2922+ XFPM_DEBUG ("Current brightness level before dimming : %li, new %li", backlight->priv->last_level, dim_level);
2923+ backlight->priv->dimmed = xfpm_brightness_set_level (backlight->priv->brightness, dim_level);
2924+ }
2925+ }
2926+}
2927+
2928+static gboolean
2929+xfpm_backlight_destroy_popup (gpointer data)
2930+{
2931+ XfpmBacklight *backlight;
2932+
2933+ backlight = XFPM_BACKLIGHT (data);
2934+
2935+ if ( backlight->priv->osd )
2936+ {
2937+ gtk_widget_destroy (backlight->priv->osd);
2938+ backlight->priv->osd = NULL;
2939+ }
2940+
2941+ if ( backlight->priv->n )
2942+ {
2943+ g_object_unref (backlight->priv->n);
2944+ backlight->priv->n = NULL;
2945+ }
2946+
2947+ return FALSE;
2948+}
2949+
2950+static void
2951+xfpm_backlight_composited_changed_cb (XfpmBacklight *backlight)
2952+{
2953+ xfpm_backlight_destroy_popup (backlight);
2954+ xfpm_backlight_create_popup (backlight);
2955+}
2956+
2957+static void
2958+xfpm_backlight_show_notification (XfpmBacklight *backlight, gfloat value)
2959+{
2960+ gint i;
2961+
2962+ static const char *display_icon_name[] =
2963+ {
2964+ "notification-display-brightness-off",
2965+ "notification-display-brightness-low",
2966+ "notification-display-brightness-medium",
2967+ "notification-display-brightness-high",
2968+ "notification-display-brightness-full",
2969+ NULL
2970+ };
2971+
2972+ if ( backlight->priv->n == NULL )
2973+ {
2974+ backlight->priv->n = xfpm_notify_new_notification (backlight->priv->notify,
2975+ " ",
2976+ "",
2977+ NULL,
2978+ 0,
2979+ XFPM_NOTIFY_NORMAL,
2980+ NULL);
2981+ }
2982+
2983+ i = (gint)value / 25;
2984+
2985+ if ( i > 4 || i < 0 )
2986+ return;
2987+
2988+ notify_notification_set_hint_int32 (backlight->priv->n,
2989+ "value",
2990+ value);
2991+
2992+ notify_notification_set_hint_string (backlight->priv->n,
2993+ "x-canonical-private-synchronous",
2994+ "brightness");
2995+
2996+ notify_notification_update (backlight->priv->n,
2997+ " ",
2998+ "",
2999+ display_icon_name[i]);
3000+
3001+ notify_notification_show (backlight->priv->n, NULL);
3002+}
3003+
3004+static void
3005+xfpm_backlight_create_popup (XfpmBacklight *backlight)
3006+{
3007+ if ( backlight->priv->osd != NULL )
3008+ return;
3009+
3010+ backlight->priv->osd = gsd_media_keys_window_new ();
3011+ gsd_media_keys_window_set_action_custom (GSD_MEDIA_KEYS_WINDOW (backlight->priv->osd),
3012+ XFPM_DISPLAY_BRIGHTNESS_ICON,
3013+ TRUE);
3014+ gtk_window_set_position (GTK_WINDOW (backlight->priv->osd), GTK_WIN_POS_CENTER);
3015+
3016+ g_signal_connect_swapped (backlight->priv->osd, "composited-changed",
3017+ G_CALLBACK (xfpm_backlight_composited_changed_cb), backlight);
3018+
3019+}
3020+
3021+static void
3022+xfpm_backlight_show (XfpmBacklight *backlight, gint level)
3023+{
3024+ gfloat value;
3025+ gboolean sync_notify;
3026+ gboolean show_popup;
3027+
3028+ XFPM_DEBUG ("Level %u", level);
3029+
3030+ g_object_get (G_OBJECT (backlight->priv->conf),
3031+ SHOW_BRIGHTNESS_POPUP, &show_popup,
3032+ NULL);
3033+
3034+ if ( !show_popup )
3035+ goto out;
3036+
3037+ g_object_get (G_OBJECT (backlight->priv->notify),
3038+ "sync", &sync_notify,
3039+ NULL);
3040+
3041+ value = (gfloat) 100 * level / backlight->priv->max_level;
3042+
3043+ if ( !sync_notify ) /*Notification server doesn't support sync notifications*/
3044+ {
3045+ xfpm_backlight_create_popup (backlight);
3046+ gsd_media_keys_window_set_volume_level (GSD_MEDIA_KEYS_WINDOW (backlight->priv->osd),
3047+ round (value));
3048+ if ( !GTK_WIDGET_VISIBLE (backlight->priv->osd))
3049+ gtk_window_present (GTK_WINDOW (backlight->priv->osd));
3050+ }
3051+ else
3052+ {
3053+ xfpm_backlight_show_notification (backlight, value);
3054+ }
3055+
3056+ if ( backlight->priv->destroy_id != 0 )
3057+ {
3058+ g_source_remove (backlight->priv->destroy_id);
3059+ backlight->priv->destroy_id = 0;
3060+ }
3061+
3062+out:
3063+ /* Release the memory after 60 seconds */
3064+ backlight->priv->destroy_id = g_timeout_add_seconds (60, (GSourceFunc) xfpm_backlight_destroy_popup, backlight);
3065+}
3066+
3067+
3068+static void
3069+xfpm_backlight_alarm_timeout_cb (EggIdletime *idle, guint id, XfpmBacklight *backlight)
3070+{
3071+ backlight->priv->block = FALSE;
3072+
3073+ if ( id == TIMEOUT_BRIGHTNESS_ON_AC && !backlight->priv->on_battery)
3074+ xfpm_backlight_dim_brightness (backlight);
3075+ else if ( id == TIMEOUT_BRIGHTNESS_ON_BATTERY && backlight->priv->on_battery)
3076+ xfpm_backlight_dim_brightness (backlight);
3077+}
3078+
3079+static void
3080+xfpm_backlight_reset_cb (EggIdletime *idle, XfpmBacklight *backlight)
3081+{
3082+ if ( backlight->priv->dimmed)
3083+ {
3084+ if ( !backlight->priv->block)
3085+ {
3086+ XFPM_DEBUG ("Alarm reset, setting level to %li", backlight->priv->last_level);
3087+ xfpm_brightness_set_level (backlight->priv->brightness, backlight->priv->last_level);
3088+ }
3089+ backlight->priv->dimmed = FALSE;
3090+ }
3091+}
3092+
3093+static void
3094+xfpm_backlight_button_pressed_cb (XfpmButton *button, XfpmButtonKey type, XfpmBacklight *backlight)
3095+{
3096+ glong level;
3097+ gboolean ret = TRUE;
3098+
3099+ gboolean enable_brightness, show_popup;
3100+
3101+ g_object_get (G_OBJECT (backlight->priv->conf),
3102+ ENABLE_BRIGHTNESS_CONTROL, &enable_brightness,
3103+ SHOW_BRIGHTNESS_POPUP, &show_popup,
3104+ NULL);
3105+
3106+ if ( type == BUTTON_MON_BRIGHTNESS_UP )
3107+ {
3108+ backlight->priv->block = TRUE;
3109+ if ( enable_brightness )
3110+ ret = xfpm_brightness_up (backlight->priv->brightness, &level);
3111+ if ( ret && show_popup)
3112+ xfpm_backlight_show (backlight, level);
3113+ }
3114+ else if ( type == BUTTON_MON_BRIGHTNESS_DOWN )
3115+ {
3116+ backlight->priv->block = TRUE;
3117+ if ( enable_brightness )
3118+ ret = xfpm_brightness_down (backlight->priv->brightness, &level);
3119+ if ( ret && show_popup)
3120+ xfpm_backlight_show (backlight, level);
3121+ }
3122+}
3123+
3124+static void
3125+xfpm_backlight_brightness_on_ac_settings_changed (XfpmBacklight *backlight)
3126+{
3127+ guint timeout_on_ac;
3128+
3129+ g_object_get (G_OBJECT (backlight->priv->conf),
3130+ BRIGHTNESS_ON_AC, &timeout_on_ac,
3131+ NULL);
3132+
3133+ XFPM_DEBUG ("Alarm on ac timeout changed %u", timeout_on_ac);
3134+
3135+ if ( timeout_on_ac == ALARM_DISABLED )
3136+ {
3137+ egg_idletime_alarm_remove (backlight->priv->idle, TIMEOUT_BRIGHTNESS_ON_AC );
3138+ }
3139+ else
3140+ {
3141+ egg_idletime_alarm_set (backlight->priv->idle, TIMEOUT_BRIGHTNESS_ON_AC, timeout_on_ac * 1000);
3142+ }
3143+}
3144+
3145+static void
3146+xfpm_backlight_brightness_on_battery_settings_changed (XfpmBacklight *backlight)
3147+{
3148+ guint timeout_on_battery ;
3149+
3150+ g_object_get (G_OBJECT (backlight->priv->conf),
3151+ BRIGHTNESS_ON_BATTERY, &timeout_on_battery,
3152+ NULL);
3153+
3154+ XFPM_DEBUG ("Alarm on battery timeout changed %u", timeout_on_battery);
3155+
3156+ if ( timeout_on_battery == ALARM_DISABLED )
3157+ {
3158+ egg_idletime_alarm_remove (backlight->priv->idle, TIMEOUT_BRIGHTNESS_ON_BATTERY );
3159+ }
3160+ else
3161+ {
3162+ egg_idletime_alarm_set (backlight->priv->idle, TIMEOUT_BRIGHTNESS_ON_BATTERY, timeout_on_battery * 1000);
3163+ }
3164+}
3165+
3166+
3167+static void
3168+xfpm_backlight_set_timeouts (XfpmBacklight *backlight)
3169+{
3170+ xfpm_backlight_brightness_on_ac_settings_changed (backlight);
3171+ xfpm_backlight_brightness_on_battery_settings_changed (backlight);
3172+}
3173+
3174+static void
3175+xfpm_backlight_on_battery_changed_cb (XfpmPower *power, gboolean on_battery, XfpmBacklight *backlight)
3176+{
3177+ backlight->priv->on_battery = on_battery;
3178+}
3179+
3180+static void
3181+xfpm_backlight_class_init (XfpmBacklightClass *klass)
3182+{
3183+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
3184+
3185+ object_class->finalize = xfpm_backlight_finalize;
3186+
3187+ g_type_class_add_private (klass, sizeof (XfpmBacklightPrivate));
3188+}
3189+
3190+static void
3191+xfpm_backlight_init (XfpmBacklight *backlight)
3192+{
3193+ backlight->priv = XFPM_BACKLIGHT_GET_PRIVATE (backlight);
3194+
3195+ backlight->priv->brightness = xfpm_brightness_new ();
3196+ backlight->priv->has_hw = xfpm_brightness_setup (backlight->priv->brightness);
3197+
3198+ backlight->priv->osd = NULL;
3199+ backlight->priv->notify = NULL;
3200+ backlight->priv->idle = NULL;
3201+ backlight->priv->conf = NULL;
3202+ backlight->priv->button = NULL;
3203+ backlight->priv->power = NULL;
3204+ backlight->priv->dimmed = FALSE;
3205+ backlight->priv->block = FALSE;
3206+ backlight->priv->destroy_id = 0;
3207+
3208+ if ( !backlight->priv->has_hw )
3209+ {
3210+ g_object_unref (backlight->priv->brightness);
3211+ backlight->priv->brightness = NULL;
3212+ }
3213+ else
3214+ {
3215+ backlight->priv->idle = egg_idletime_new ();
3216+ backlight->priv->conf = xfpm_xfconf_new ();
3217+ backlight->priv->button = xfpm_button_new ();
3218+ backlight->priv->power = xfpm_power_get ();
3219+ backlight->priv->notify = xfpm_notify_new ();
3220+ backlight->priv->max_level = xfpm_brightness_get_max_level (backlight->priv->brightness);
3221+ g_signal_connect (backlight->priv->idle, "alarm-expired",
3222+ G_CALLBACK (xfpm_backlight_alarm_timeout_cb), backlight);
3223+
3224+ g_signal_connect (backlight->priv->idle, "reset",
3225+ G_CALLBACK(xfpm_backlight_reset_cb), backlight);
3226+
3227+ g_signal_connect (backlight->priv->button, "button-pressed",
3228+ G_CALLBACK (xfpm_backlight_button_pressed_cb), backlight);
3229+
3230+ g_signal_connect_swapped (backlight->priv->conf, "notify::" BRIGHTNESS_ON_AC,
3231+ G_CALLBACK (xfpm_backlight_brightness_on_ac_settings_changed), backlight);
3232+
3233+ g_signal_connect_swapped (backlight->priv->conf, "notify::" BRIGHTNESS_ON_BATTERY,
3234+ G_CALLBACK (xfpm_backlight_brightness_on_battery_settings_changed), backlight);
3235+
3236+ g_signal_connect (backlight->priv->power, "on-battery-changed",
3237+ G_CALLBACK (xfpm_backlight_on_battery_changed_cb), backlight);
3238+ g_object_get (G_OBJECT (backlight->priv->power),
3239+ "on-battery", &backlight->priv->on_battery,
3240+ NULL);
3241+ xfpm_brightness_get_level (backlight->priv->brightness, &backlight->priv->last_level);
3242+ xfpm_backlight_set_timeouts (backlight);
3243+ }
3244+}
3245+
3246+static void
3247+xfpm_backlight_finalize (GObject *object)
3248+{
3249+ XfpmBacklight *backlight;
3250+
3251+ backlight = XFPM_BACKLIGHT (object);
3252+
3253+ xfpm_backlight_destroy_popup (backlight);
3254+
3255+ if ( backlight->priv->brightness )
3256+ g_object_unref (backlight->priv->brightness);
3257+
3258+ if ( backlight->priv->idle )
3259+ g_object_unref (backlight->priv->idle);
3260+
3261+ if ( backlight->priv->conf )
3262+ g_object_unref (backlight->priv->conf);
3263+
3264+ if ( backlight->priv->button )
3265+ g_object_unref (backlight->priv->button);
3266+
3267+ if ( backlight->priv->power )
3268+ g_object_unref (backlight->priv->power);
3269+
3270+ if ( backlight->priv->notify)
3271+ g_object_unref (backlight->priv->notify);
3272+
3273+ G_OBJECT_CLASS (xfpm_backlight_parent_class)->finalize (object);
3274+}
3275+
3276+XfpmBacklight *
3277+xfpm_backlight_new (void)
3278+{
3279+ XfpmBacklight *backlight = NULL;
3280+ backlight = g_object_new (XFPM_TYPE_BACKLIGHT, NULL);
3281+ return backlight;
3282+}
3283+
3284+gboolean xfpm_backlight_has_hw (XfpmBacklight *backlight)
3285+{
3286+ return backlight->priv->has_hw;
3287+}
3288
3289=== removed file '.pc/01_Remove_custom_OSD_brightness_popup,_use_libnotify_instead.patch/src/xfpm-backlight.c'
3290--- .pc/01_Remove_custom_OSD_brightness_popup,_use_libnotify_instead.patch/src/xfpm-backlight.c 2013-05-22 00:46:08 +0000
3291+++ .pc/01_Remove_custom_OSD_brightness_popup,_use_libnotify_instead.patch/src/xfpm-backlight.c 1970-01-01 00:00:00 +0000
3292@@ -1,478 +0,0 @@
3293-/*
3294- * * Copyright (C) 2009-2011 Ali <aliov@xfce.org>
3295- *
3296- * Licensed under the GNU General Public License Version 2
3297- *
3298- * This program is free software; you can redistribute it and/or modify
3299- * it under the terms of the GNU General Public License as published by
3300- * the Free Software Foundation; either version 2 of the License, or
3301- * (at your option) any later version.
3302- *
3303- * This program is distributed in the hope that it will be useful,
3304- * but WITHOUT ANY WARRANTY; without even the implied warranty of
3305- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3306- * GNU General Public License for more details.
3307- *
3308- * You should have received a copy of the GNU General Public License
3309- * along with this program; if not, write to the Free Software
3310- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
3311- */
3312-
3313-#ifdef HAVE_CONFIG_H
3314-#include <config.h>
3315-#endif
3316-
3317-#include <stdio.h>
3318-#include <stdlib.h>
3319-#include <string.h>
3320-
3321-#include <math.h>
3322-
3323-#include <gtk/gtk.h>
3324-#include <libxfce4util/libxfce4util.h>
3325-
3326-#include "xfpm-backlight.h"
3327-#include "egg-idletime.h"
3328-#include "xfpm-notify.h"
3329-#include "xfpm-xfconf.h"
3330-#include "xfpm-power.h"
3331-#include "xfpm-config.h"
3332-#include "xfpm-button.h"
3333-#include "xfpm-brightness.h"
3334-#include "xfpm-debug.h"
3335-#include "xfpm-icons.h"
3336-
3337-#include "gsd-media-keys-window.h"
3338-
3339-static void xfpm_backlight_finalize (GObject *object);
3340-
3341-static void xfpm_backlight_create_popup (XfpmBacklight *backlight);
3342-
3343-#define ALARM_DISABLED 9
3344-#define BRIGHTNESS_POPUP_SIZE 180
3345-
3346-#define XFPM_BACKLIGHT_GET_PRIVATE(o) \
3347-(G_TYPE_INSTANCE_GET_PRIVATE ((o), XFPM_TYPE_BACKLIGHT, XfpmBacklightPrivate))
3348-
3349-struct XfpmBacklightPrivate
3350-{
3351- XfpmBrightness *brightness;
3352- XfpmPower *power;
3353- EggIdletime *idle;
3354- XfpmXfconf *conf;
3355- XfpmButton *button;
3356- XfpmNotify *notify;
3357-
3358- GtkWidget *osd;
3359- NotifyNotification *n;
3360-
3361-
3362- gulong destroy_id;
3363-
3364- gboolean has_hw;
3365- gboolean on_battery;
3366-
3367- glong last_level;
3368- glong max_level;
3369-
3370- gboolean dimmed;
3371- gboolean block;
3372-};
3373-
3374-G_DEFINE_TYPE (XfpmBacklight, xfpm_backlight, G_TYPE_OBJECT)
3375-
3376-static void
3377-xfpm_backlight_dim_brightness (XfpmBacklight *backlight)
3378-{
3379- gboolean ret;
3380-
3381- if (xfpm_power_get_mode (backlight->priv->power) == XFPM_POWER_MODE_NORMAL )
3382- {
3383- glong dim_level;
3384-
3385- g_object_get (G_OBJECT (backlight->priv->conf),
3386- backlight->priv->on_battery ? BRIGHTNESS_LEVEL_ON_BATTERY : BRIGHTNESS_LEVEL_ON_AC, &dim_level,
3387- NULL);
3388-
3389- ret = xfpm_brightness_get_level (backlight->priv->brightness, &backlight->priv->last_level);
3390-
3391- if ( !ret )
3392- {
3393- g_warning ("Unable to get current brightness level");
3394- return;
3395- }
3396-
3397- dim_level = dim_level * backlight->priv->max_level / 100;
3398-
3399- /**
3400- * Only reduce if the current level is brighter than
3401- * the configured dim_level
3402- **/
3403- if (backlight->priv->last_level > dim_level)
3404- {
3405- XFPM_DEBUG ("Current brightness level before dimming : %li, new %li", backlight->priv->last_level, dim_level);
3406- backlight->priv->dimmed = xfpm_brightness_set_level (backlight->priv->brightness, dim_level);
3407- }
3408- }
3409-}
3410-
3411-static gboolean
3412-xfpm_backlight_destroy_popup (gpointer data)
3413-{
3414- XfpmBacklight *backlight;
3415-
3416- backlight = XFPM_BACKLIGHT (data);
3417-
3418- if ( backlight->priv->osd )
3419- {
3420- gtk_widget_destroy (backlight->priv->osd);
3421- backlight->priv->osd = NULL;
3422- }
3423-
3424- if ( backlight->priv->n )
3425- {
3426- g_object_unref (backlight->priv->n);
3427- backlight->priv->n = NULL;
3428- }
3429-
3430- return FALSE;
3431-}
3432-
3433-static void
3434-xfpm_backlight_composited_changed_cb (XfpmBacklight *backlight)
3435-{
3436- xfpm_backlight_destroy_popup (backlight);
3437- xfpm_backlight_create_popup (backlight);
3438-}
3439-
3440-static void
3441-xfpm_backlight_show_notification (XfpmBacklight *backlight, gfloat value)
3442-{
3443- gint i;
3444-
3445- static const char *display_icon_name[] =
3446- {
3447- "notification-display-brightness-off",
3448- "notification-display-brightness-low",
3449- "notification-display-brightness-medium",
3450- "notification-display-brightness-high",
3451- "notification-display-brightness-full",
3452- NULL
3453- };
3454-
3455- if ( backlight->priv->n == NULL )
3456- {
3457- backlight->priv->n = xfpm_notify_new_notification (backlight->priv->notify,
3458- " ",
3459- "",
3460- NULL,
3461- 0,
3462- XFPM_NOTIFY_NORMAL,
3463- NULL);
3464- }
3465-
3466- i = (gint)value / 25;
3467-
3468- if ( i > 4 || i < 0 )
3469- return;
3470-
3471- notify_notification_set_hint_int32 (backlight->priv->n,
3472- "value",
3473- value);
3474-
3475- notify_notification_set_hint_string (backlight->priv->n,
3476- "x-canonical-private-synchronous",
3477- "brightness");
3478-
3479- notify_notification_update (backlight->priv->n,
3480- " ",
3481- "",
3482- display_icon_name[i]);
3483-
3484- notify_notification_show (backlight->priv->n, NULL);
3485-}
3486-
3487-static void
3488-xfpm_backlight_create_popup (XfpmBacklight *backlight)
3489-{
3490- if ( backlight->priv->osd != NULL )
3491- return;
3492-
3493- backlight->priv->osd = gsd_media_keys_window_new ();
3494- gsd_media_keys_window_set_action_custom (GSD_MEDIA_KEYS_WINDOW (backlight->priv->osd),
3495- XFPM_DISPLAY_BRIGHTNESS_ICON,
3496- TRUE);
3497- gtk_window_set_position (GTK_WINDOW (backlight->priv->osd), GTK_WIN_POS_CENTER);
3498-
3499- g_signal_connect_swapped (backlight->priv->osd, "composited-changed",
3500- G_CALLBACK (xfpm_backlight_composited_changed_cb), backlight);
3501-
3502-}
3503-
3504-static void
3505-xfpm_backlight_show (XfpmBacklight *backlight, gint level)
3506-{
3507- gfloat value;
3508- gboolean sync_notify;
3509- gboolean show_popup;
3510-
3511- XFPM_DEBUG ("Level %u", level);
3512-
3513- g_object_get (G_OBJECT (backlight->priv->conf),
3514- SHOW_BRIGHTNESS_POPUP, &show_popup,
3515- NULL);
3516-
3517- if ( !show_popup )
3518- goto out;
3519-
3520- g_object_get (G_OBJECT (backlight->priv->notify),
3521- "sync", &sync_notify,
3522- NULL);
3523-
3524- value = (gfloat) 100 * level / backlight->priv->max_level;
3525-
3526- if ( !sync_notify ) /*Notification server doesn't support sync notifications*/
3527- {
3528- xfpm_backlight_create_popup (backlight);
3529- gsd_media_keys_window_set_volume_level (GSD_MEDIA_KEYS_WINDOW (backlight->priv->osd),
3530- round (value));
3531- if ( !GTK_WIDGET_VISIBLE (backlight->priv->osd))
3532- gtk_window_present (GTK_WINDOW (backlight->priv->osd));
3533- }
3534- else
3535- {
3536- xfpm_backlight_show_notification (backlight, value);
3537- }
3538-
3539- if ( backlight->priv->destroy_id != 0 )
3540- {
3541- g_source_remove (backlight->priv->destroy_id);
3542- backlight->priv->destroy_id = 0;
3543- }
3544-
3545-out:
3546- /* Release the memory after 60 seconds */
3547- backlight->priv->destroy_id = g_timeout_add_seconds (60, (GSourceFunc) xfpm_backlight_destroy_popup, backlight);
3548-}
3549-
3550-
3551-static void
3552-xfpm_backlight_alarm_timeout_cb (EggIdletime *idle, guint id, XfpmBacklight *backlight)
3553-{
3554- backlight->priv->block = FALSE;
3555-
3556- if ( id == TIMEOUT_BRIGHTNESS_ON_AC && !backlight->priv->on_battery)
3557- xfpm_backlight_dim_brightness (backlight);
3558- else if ( id == TIMEOUT_BRIGHTNESS_ON_BATTERY && backlight->priv->on_battery)
3559- xfpm_backlight_dim_brightness (backlight);
3560-}
3561-
3562-static void
3563-xfpm_backlight_reset_cb (EggIdletime *idle, XfpmBacklight *backlight)
3564-{
3565- if ( backlight->priv->dimmed)
3566- {
3567- if ( !backlight->priv->block)
3568- {
3569- XFPM_DEBUG ("Alarm reset, setting level to %li", backlight->priv->last_level);
3570- xfpm_brightness_set_level (backlight->priv->brightness, backlight->priv->last_level);
3571- }
3572- backlight->priv->dimmed = FALSE;
3573- }
3574-}
3575-
3576-static void
3577-xfpm_backlight_button_pressed_cb (XfpmButton *button, XfpmButtonKey type, XfpmBacklight *backlight)
3578-{
3579- glong level;
3580- gboolean ret = TRUE;
3581-
3582- gboolean enable_brightness, show_popup;
3583-
3584- g_object_get (G_OBJECT (backlight->priv->conf),
3585- ENABLE_BRIGHTNESS_CONTROL, &enable_brightness,
3586- SHOW_BRIGHTNESS_POPUP, &show_popup,
3587- NULL);
3588-
3589- if ( type == BUTTON_MON_BRIGHTNESS_UP )
3590- {
3591- backlight->priv->block = TRUE;
3592- if ( enable_brightness )
3593- ret = xfpm_brightness_up (backlight->priv->brightness, &level);
3594- if ( ret && show_popup)
3595- xfpm_backlight_show (backlight, level);
3596- }
3597- else if ( type == BUTTON_MON_BRIGHTNESS_DOWN )
3598- {
3599- backlight->priv->block = TRUE;
3600- if ( enable_brightness )
3601- ret = xfpm_brightness_down (backlight->priv->brightness, &level);
3602- if ( ret && show_popup)
3603- xfpm_backlight_show (backlight, level);
3604- }
3605-}
3606-
3607-static void
3608-xfpm_backlight_brightness_on_ac_settings_changed (XfpmBacklight *backlight)
3609-{
3610- guint timeout_on_ac;
3611-
3612- g_object_get (G_OBJECT (backlight->priv->conf),
3613- BRIGHTNESS_ON_AC, &timeout_on_ac,
3614- NULL);
3615-
3616- XFPM_DEBUG ("Alarm on ac timeout changed %u", timeout_on_ac);
3617-
3618- if ( timeout_on_ac == ALARM_DISABLED )
3619- {
3620- egg_idletime_alarm_remove (backlight->priv->idle, TIMEOUT_BRIGHTNESS_ON_AC );
3621- }
3622- else
3623- {
3624- egg_idletime_alarm_set (backlight->priv->idle, TIMEOUT_BRIGHTNESS_ON_AC, timeout_on_ac * 1000);
3625- }
3626-}
3627-
3628-static void
3629-xfpm_backlight_brightness_on_battery_settings_changed (XfpmBacklight *backlight)
3630-{
3631- guint timeout_on_battery ;
3632-
3633- g_object_get (G_OBJECT (backlight->priv->conf),
3634- BRIGHTNESS_ON_BATTERY, &timeout_on_battery,
3635- NULL);
3636-
3637- XFPM_DEBUG ("Alarm on battery timeout changed %u", timeout_on_battery);
3638-
3639- if ( timeout_on_battery == ALARM_DISABLED )
3640- {
3641- egg_idletime_alarm_remove (backlight->priv->idle, TIMEOUT_BRIGHTNESS_ON_BATTERY );
3642- }
3643- else
3644- {
3645- egg_idletime_alarm_set (backlight->priv->idle, TIMEOUT_BRIGHTNESS_ON_BATTERY, timeout_on_battery * 1000);
3646- }
3647-}
3648-
3649-
3650-static void
3651-xfpm_backlight_set_timeouts (XfpmBacklight *backlight)
3652-{
3653- xfpm_backlight_brightness_on_ac_settings_changed (backlight);
3654- xfpm_backlight_brightness_on_battery_settings_changed (backlight);
3655-}
3656-
3657-static void
3658-xfpm_backlight_on_battery_changed_cb (XfpmPower *power, gboolean on_battery, XfpmBacklight *backlight)
3659-{
3660- backlight->priv->on_battery = on_battery;
3661-}
3662-
3663-static void
3664-xfpm_backlight_class_init (XfpmBacklightClass *klass)
3665-{
3666- GObjectClass *object_class = G_OBJECT_CLASS (klass);
3667-
3668- object_class->finalize = xfpm_backlight_finalize;
3669-
3670- g_type_class_add_private (klass, sizeof (XfpmBacklightPrivate));
3671-}
3672-
3673-static void
3674-xfpm_backlight_init (XfpmBacklight *backlight)
3675-{
3676- backlight->priv = XFPM_BACKLIGHT_GET_PRIVATE (backlight);
3677-
3678- backlight->priv->brightness = xfpm_brightness_new ();
3679- backlight->priv->has_hw = xfpm_brightness_setup (backlight->priv->brightness);
3680-
3681- backlight->priv->osd = NULL;
3682- backlight->priv->notify = NULL;
3683- backlight->priv->idle = NULL;
3684- backlight->priv->conf = NULL;
3685- backlight->priv->button = NULL;
3686- backlight->priv->power = NULL;
3687- backlight->priv->dimmed = FALSE;
3688- backlight->priv->block = FALSE;
3689- backlight->priv->destroy_id = 0;
3690-
3691- if ( !backlight->priv->has_hw )
3692- {
3693- g_object_unref (backlight->priv->brightness);
3694- backlight->priv->brightness = NULL;
3695- }
3696- else
3697- {
3698- backlight->priv->idle = egg_idletime_new ();
3699- backlight->priv->conf = xfpm_xfconf_new ();
3700- backlight->priv->button = xfpm_button_new ();
3701- backlight->priv->power = xfpm_power_get ();
3702- backlight->priv->notify = xfpm_notify_new ();
3703- backlight->priv->max_level = xfpm_brightness_get_max_level (backlight->priv->brightness);
3704- g_signal_connect (backlight->priv->idle, "alarm-expired",
3705- G_CALLBACK (xfpm_backlight_alarm_timeout_cb), backlight);
3706-
3707- g_signal_connect (backlight->priv->idle, "reset",
3708- G_CALLBACK(xfpm_backlight_reset_cb), backlight);
3709-
3710- g_signal_connect (backlight->priv->button, "button-pressed",
3711- G_CALLBACK (xfpm_backlight_button_pressed_cb), backlight);
3712-
3713- g_signal_connect_swapped (backlight->priv->conf, "notify::" BRIGHTNESS_ON_AC,
3714- G_CALLBACK (xfpm_backlight_brightness_on_ac_settings_changed), backlight);
3715-
3716- g_signal_connect_swapped (backlight->priv->conf, "notify::" BRIGHTNESS_ON_BATTERY,
3717- G_CALLBACK (xfpm_backlight_brightness_on_battery_settings_changed), backlight);
3718-
3719- g_signal_connect (backlight->priv->power, "on-battery-changed",
3720- G_CALLBACK (xfpm_backlight_on_battery_changed_cb), backlight);
3721- g_object_get (G_OBJECT (backlight->priv->power),
3722- "on-battery", &backlight->priv->on_battery,
3723- NULL);
3724- xfpm_brightness_get_level (backlight->priv->brightness, &backlight->priv->last_level);
3725- xfpm_backlight_set_timeouts (backlight);
3726- }
3727-}
3728-
3729-static void
3730-xfpm_backlight_finalize (GObject *object)
3731-{
3732- XfpmBacklight *backlight;
3733-
3734- backlight = XFPM_BACKLIGHT (object);
3735-
3736- xfpm_backlight_destroy_popup (backlight);
3737-
3738- if ( backlight->priv->brightness )
3739- g_object_unref (backlight->priv->brightness);
3740-
3741- if ( backlight->priv->idle )
3742- g_object_unref (backlight->priv->idle);
3743-
3744- if ( backlight->priv->conf )
3745- g_object_unref (backlight->priv->conf);
3746-
3747- if ( backlight->priv->button )
3748- g_object_unref (backlight->priv->button);
3749-
3750- if ( backlight->priv->power )
3751- g_object_unref (backlight->priv->power);
3752-
3753- if ( backlight->priv->notify)
3754- g_object_unref (backlight->priv->notify);
3755-
3756- G_OBJECT_CLASS (xfpm_backlight_parent_class)->finalize (object);
3757-}
3758-
3759-XfpmBacklight *
3760-xfpm_backlight_new (void)
3761-{
3762- XfpmBacklight *backlight = NULL;
3763- backlight = g_object_new (XFPM_TYPE_BACKLIGHT, NULL);
3764- return backlight;
3765-}
3766-
3767-gboolean xfpm_backlight_has_hw (XfpmBacklight *backlight)
3768-{
3769- return backlight->priv->has_hw;
3770-}
3771
3772=== added file '.pc/01_Remove_custom_OSD_brightness_popup,_use_libnotify_instead.patch/src/xfpm-notify.c'
3773--- .pc/01_Remove_custom_OSD_brightness_popup,_use_libnotify_instead.patch/src/xfpm-notify.c 1970-01-01 00:00:00 +0000
3774+++ .pc/01_Remove_custom_OSD_brightness_popup,_use_libnotify_instead.patch/src/xfpm-notify.c 2014-01-22 05:17:49 +0000
3775@@ -0,0 +1,409 @@
3776+/*
3777+ * * Copyright (C) 2008-2011 Ali <aliov@xfce.org>
3778+ *
3779+ * Licensed under the GNU General Public License Version 2
3780+ *
3781+ * This program is free software; you can redistribute it and/or modify
3782+ * it under the terms of the GNU General Public License as published by
3783+ * the Free Software Foundation; either version 2 of the License, or
3784+ * (at your option) any later version.
3785+ *
3786+ * This program is distributed in the hope that it will be useful,
3787+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3788+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3789+ * GNU General Public License for more details.
3790+ *
3791+ * You should have received a copy of the GNU General Public License
3792+ * along with this program; if not, write to the Free Software
3793+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
3794+ */
3795+
3796+#ifdef HAVE_CONFIG_H
3797+#include <config.h>
3798+#endif
3799+
3800+#include <stdio.h>
3801+
3802+#ifdef HAVE_STDLIB_H
3803+#include <stdlib.h>
3804+#endif
3805+
3806+#ifdef HAVE_STRING_H
3807+#include <string.h>
3808+#endif
3809+
3810+#ifdef HAVE_ERRNO_H
3811+#include <errno.h>
3812+#endif
3813+
3814+#include <gtk/gtk.h>
3815+
3816+#include <libxfce4util/libxfce4util.h>
3817+
3818+#include <libnotify/notify.h>
3819+
3820+#include "xfpm-common.h"
3821+#include "xfpm-notify.h"
3822+#include "xfpm-dbus-monitor.h"
3823+
3824+static void xfpm_notify_finalize (GObject *object);
3825+
3826+static NotifyNotification * xfpm_notify_new_notification_internal (const gchar *title,
3827+ const gchar *message,
3828+ const gchar *icon_name,
3829+ guint timeout,
3830+ XfpmNotifyUrgency urgency,
3831+ GtkStatusIcon *icon) G_GNUC_MALLOC;
3832+
3833+#define XFPM_NOTIFY_GET_PRIVATE(o) \
3834+(G_TYPE_INSTANCE_GET_PRIVATE((o), XFPM_TYPE_NOTIFY, XfpmNotifyPrivate))
3835+
3836+struct XfpmNotifyPrivate
3837+{
3838+ XfpmDBusMonitor *monitor;
3839+
3840+ NotifyNotification *notification;
3841+ NotifyNotification *critical;
3842+
3843+ gulong critical_id;
3844+ gulong notify_id;
3845+
3846+ gboolean supports_actions;
3847+ gboolean supports_sync; /*For x-canonical-private-synchronous */
3848+};
3849+
3850+enum
3851+{
3852+ PROP_0,
3853+ PROP_ACTIONS,
3854+ PROP_SYNC
3855+};
3856+
3857+G_DEFINE_TYPE(XfpmNotify, xfpm_notify, G_TYPE_OBJECT)
3858+
3859+static void
3860+xfpm_notify_get_server_caps (XfpmNotify *notify)
3861+{
3862+ GList *caps = NULL;
3863+ notify->priv->supports_actions = FALSE;
3864+ notify->priv->supports_sync = FALSE;
3865+
3866+ caps = notify_get_server_caps ();
3867+
3868+ if (caps != NULL)
3869+ {
3870+ if (g_list_find_custom (caps, "x-canonical-private-synchronous", (GCompareFunc) g_strcmp0) != NULL)
3871+ notify->priv->supports_sync = TRUE;
3872+
3873+ if (g_list_find_custom (caps, "actions", (GCompareFunc) g_strcmp0) != NULL)
3874+ notify->priv->supports_actions = TRUE;
3875+
3876+ g_list_foreach(caps, (GFunc)g_free, NULL);
3877+ g_list_free(caps);
3878+ }
3879+}
3880+
3881+static void
3882+xfpm_notify_check_server (XfpmDBusMonitor *monitor,
3883+ gchar *service_name,
3884+ gboolean connected,
3885+ gboolean on_session,
3886+ XfpmNotify *notify)
3887+{
3888+ if ( !g_strcmp0 (service_name, "org.freedesktop.Notifications") && on_session && connected )
3889+ xfpm_notify_get_server_caps (notify);
3890+}
3891+
3892+static void xfpm_notify_get_property (GObject *object,
3893+ guint prop_id,
3894+ GValue *value,
3895+ GParamSpec *pspec)
3896+{
3897+ XfpmNotify *notify;
3898+
3899+ notify = XFPM_NOTIFY (object);
3900+
3901+ switch (prop_id)
3902+ {
3903+ case PROP_ACTIONS:
3904+ g_value_set_boolean (value, notify->priv->supports_actions);
3905+ break;
3906+ case PROP_SYNC:
3907+ g_value_set_boolean (value, notify->priv->supports_sync);
3908+ break;
3909+ default:
3910+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
3911+ break;
3912+ }
3913+}
3914+
3915+static void
3916+xfpm_notify_class_init (XfpmNotifyClass *klass)
3917+{
3918+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
3919+
3920+ object_class->finalize = xfpm_notify_finalize;
3921+ object_class->get_property = xfpm_notify_get_property;
3922+
3923+ g_object_class_install_property (object_class,
3924+ PROP_ACTIONS,
3925+ g_param_spec_boolean ("actions",
3926+ NULL, NULL,
3927+ FALSE,
3928+ G_PARAM_READABLE));
3929+
3930+ g_object_class_install_property (object_class,
3931+ PROP_SYNC,
3932+ g_param_spec_boolean ("sync",
3933+ NULL, NULL,
3934+ FALSE,
3935+ G_PARAM_READABLE));
3936+
3937+ g_type_class_add_private (klass, sizeof (XfpmNotifyPrivate));
3938+}
3939+
3940+static void
3941+xfpm_notify_init (XfpmNotify *notify)
3942+{
3943+ notify->priv = XFPM_NOTIFY_GET_PRIVATE (notify);
3944+
3945+ notify->priv->notification = NULL;
3946+ notify->priv->critical = NULL;
3947+
3948+ notify->priv->critical_id = 0;
3949+ notify->priv->notify_id = 0;
3950+
3951+ notify->priv->monitor = xfpm_dbus_monitor_new ();
3952+ xfpm_dbus_monitor_add_service (notify->priv->monitor, DBUS_BUS_SESSION, "org.freedesktop.Notifications");
3953+ g_signal_connect (notify->priv->monitor, "service-connection-changed",
3954+ G_CALLBACK (xfpm_notify_check_server), notify);
3955+
3956+ xfpm_notify_get_server_caps (notify);
3957+}
3958+
3959+static void
3960+xfpm_notify_finalize (GObject *object)
3961+{
3962+ XfpmNotify *notify;
3963+
3964+ notify = XFPM_NOTIFY (object);
3965+
3966+ xfpm_notify_close_normal (notify);
3967+ xfpm_notify_close_critical (notify);
3968+
3969+ G_OBJECT_CLASS (xfpm_notify_parent_class)->finalize(object);
3970+}
3971+
3972+static void
3973+xfpm_notify_set_notification_icon (NotifyNotification *n, const gchar *icon_name )
3974+{
3975+ GdkPixbuf *pix = xfpm_icon_load (icon_name, 48);
3976+
3977+ if ( pix )
3978+ {
3979+ notify_notification_set_icon_from_pixbuf (n,
3980+ pix);
3981+ g_object_unref ( G_OBJECT(pix));
3982+ }
3983+
3984+}
3985+
3986+static NotifyNotification *
3987+xfpm_notify_new_notification_internal (const gchar *title, const gchar *message,
3988+ const gchar *icon_name, guint timeout,
3989+ XfpmNotifyUrgency urgency, GtkStatusIcon *icon)
3990+{
3991+ NotifyNotification *n;
3992+
3993+#ifdef NOTIFY_CHECK_VERSION
3994+#if NOTIFY_CHECK_VERSION (0, 7, 0)
3995+ n = notify_notification_new (title, message, NULL);
3996+#else
3997+ n = notify_notification_new (title, message, NULL, NULL);
3998+#endif
3999+#else
4000+ n = notify_notification_new (title, message, NULL, NULL);
4001+#endif
4002+
4003+
4004+ if ( icon_name )
4005+ xfpm_notify_set_notification_icon (n, icon_name);
4006+
4007+#ifdef NOTIFY_CHECK_VERSION
4008+#if !NOTIFY_CHECK_VERSION (0, 7, 0)
4009+ if ( icon )
4010+ notify_notification_attach_to_status_icon (n, icon);
4011+#endif
4012+#else
4013+ if ( icon )
4014+ notify_notification_attach_to_status_icon (n, icon);
4015+#endif
4016+
4017+ notify_notification_set_urgency (n, (NotifyUrgency)urgency);
4018+
4019+ if ( timeout != 0)
4020+ notify_notification_set_timeout (n, timeout);
4021+
4022+ return n;
4023+}
4024+
4025+static void
4026+xfpm_notify_closed_cb (NotifyNotification *n, XfpmNotify *notify)
4027+{
4028+ notify->priv->notification = NULL;
4029+ g_object_unref (G_OBJECT (n));
4030+}
4031+
4032+static void
4033+xfpm_notify_close_critical_cb (NotifyNotification *n, XfpmNotify *notify)
4034+{
4035+ notify->priv->critical = NULL;
4036+ g_object_unref (G_OBJECT (n));
4037+}
4038+
4039+static gboolean
4040+xfpm_notify_show (NotifyNotification *n)
4041+{
4042+ notify_notification_show (n, NULL);
4043+ return FALSE;
4044+}
4045+
4046+static void
4047+xfpm_notify_close_notification (XfpmNotify *notify )
4048+{
4049+ if (notify->priv->notify_id != 0)
4050+ {
4051+ g_source_remove (notify->priv->notify_id);
4052+ notify->priv->notify_id = 0;
4053+ }
4054+
4055+ if ( notify->priv->notification )
4056+ {
4057+ if (!notify_notification_close (notify->priv->notification, NULL))
4058+ g_warning ("Failed to close notification\n");
4059+
4060+ g_object_unref (G_OBJECT(notify->priv->notification) );
4061+ notify->priv->notification = NULL;
4062+ }
4063+}
4064+
4065+XfpmNotify *
4066+xfpm_notify_new (void)
4067+{
4068+ static gpointer xfpm_notify_object = NULL;
4069+
4070+ if ( xfpm_notify_object != NULL )
4071+ {
4072+ g_object_ref (xfpm_notify_object);
4073+ }
4074+ else
4075+ {
4076+ xfpm_notify_object = g_object_new (XFPM_TYPE_NOTIFY, NULL);
4077+ g_object_add_weak_pointer (xfpm_notify_object, &xfpm_notify_object);
4078+ }
4079+ return XFPM_NOTIFY (xfpm_notify_object);
4080+}
4081+
4082+void xfpm_notify_show_notification (XfpmNotify *notify, const gchar *title,
4083+ const gchar *text, const gchar *icon_name,
4084+ gint timeout, gboolean simple,
4085+ XfpmNotifyUrgency urgency, GtkStatusIcon *icon)
4086+{
4087+ NotifyNotification *n;
4088+
4089+ if ( !simple )
4090+ xfpm_notify_close_notification (notify);
4091+
4092+ n = xfpm_notify_new_notification_internal (title,
4093+ text, icon_name,
4094+ timeout, urgency,
4095+ icon);
4096+
4097+ xfpm_notify_present_notification (notify, n, simple);
4098+}
4099+
4100+NotifyNotification *xfpm_notify_new_notification (XfpmNotify *notify,
4101+ const gchar *title,
4102+ const gchar *text,
4103+ const gchar *icon_name,
4104+ guint timeout,
4105+ XfpmNotifyUrgency urgency,
4106+ GtkStatusIcon *icon)
4107+{
4108+ NotifyNotification *n = xfpm_notify_new_notification_internal (title,
4109+ text, icon_name,
4110+ timeout, urgency,
4111+ icon);
4112+ return n;
4113+}
4114+
4115+void xfpm_notify_add_action_to_notification (XfpmNotify *notify, NotifyNotification *n,
4116+ const gchar *id, const gchar *action_label,
4117+ NotifyActionCallback callback, gpointer data)
4118+{
4119+ g_return_if_fail (XFPM_IS_NOTIFY(notify));
4120+
4121+ notify_notification_add_action (n, id, action_label,
4122+ (NotifyActionCallback)callback,
4123+ data, NULL);
4124+
4125+}
4126+
4127+void xfpm_notify_present_notification (XfpmNotify *notify, NotifyNotification *n, gboolean simple)
4128+{
4129+ g_return_if_fail (XFPM_IS_NOTIFY(notify));
4130+
4131+ if ( !simple )
4132+ xfpm_notify_close_notification (notify);
4133+
4134+ if ( !simple )
4135+ {
4136+ g_signal_connect (G_OBJECT(n),"closed",
4137+ G_CALLBACK(xfpm_notify_closed_cb), notify);
4138+ notify->priv->notification = n;
4139+ }
4140+
4141+ notify->priv->notify_id = g_idle_add ((GSourceFunc) xfpm_notify_show, n);
4142+}
4143+
4144+void xfpm_notify_critical (XfpmNotify *notify, NotifyNotification *n)
4145+{
4146+ g_return_if_fail (XFPM_IS_NOTIFY (notify));
4147+
4148+ xfpm_notify_close_critical (notify);
4149+
4150+ notify->priv->critical = n;
4151+
4152+ g_signal_connect (G_OBJECT (n), "closed",
4153+ G_CALLBACK (xfpm_notify_close_critical_cb), notify);
4154+
4155+ notify->priv->critical_id = g_idle_add ((GSourceFunc) xfpm_notify_show, n);
4156+}
4157+
4158+void xfpm_notify_close_critical (XfpmNotify *notify)
4159+{
4160+ g_return_if_fail (XFPM_IS_NOTIFY (notify));
4161+
4162+
4163+ if (notify->priv->critical_id != 0)
4164+ {
4165+ g_source_remove (notify->priv->critical_id);
4166+ notify->priv->critical_id = 0;
4167+ }
4168+
4169+ if ( notify->priv->critical )
4170+ {
4171+ if (!notify_notification_close (notify->priv->critical, NULL))
4172+ g_warning ("Failed to close notification\n");
4173+
4174+ g_object_unref (G_OBJECT(notify->priv->critical) );
4175+ notify->priv->critical = NULL;
4176+ }
4177+}
4178+
4179+void xfpm_notify_close_normal (XfpmNotify *notify)
4180+{
4181+ g_return_if_fail (XFPM_IS_NOTIFY (notify));
4182+
4183+ xfpm_notify_close_notification (notify);
4184+}
4185
4186=== removed file '.pc/01_Remove_custom_OSD_brightness_popup,_use_libnotify_instead.patch/src/xfpm-notify.c'
4187--- .pc/01_Remove_custom_OSD_brightness_popup,_use_libnotify_instead.patch/src/xfpm-notify.c 2013-05-22 00:46:08 +0000
4188+++ .pc/01_Remove_custom_OSD_brightness_popup,_use_libnotify_instead.patch/src/xfpm-notify.c 1970-01-01 00:00:00 +0000
4189@@ -1,409 +0,0 @@
4190-/*
4191- * * Copyright (C) 2008-2011 Ali <aliov@xfce.org>
4192- *
4193- * Licensed under the GNU General Public License Version 2
4194- *
4195- * This program is free software; you can redistribute it and/or modify
4196- * it under the terms of the GNU General Public License as published by
4197- * the Free Software Foundation; either version 2 of the License, or
4198- * (at your option) any later version.
4199- *
4200- * This program is distributed in the hope that it will be useful,
4201- * but WITHOUT ANY WARRANTY; without even the implied warranty of
4202- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4203- * GNU General Public License for more details.
4204- *
4205- * You should have received a copy of the GNU General Public License
4206- * along with this program; if not, write to the Free Software
4207- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
4208- */
4209-
4210-#ifdef HAVE_CONFIG_H
4211-#include <config.h>
4212-#endif
4213-
4214-#include <stdio.h>
4215-
4216-#ifdef HAVE_STDLIB_H
4217-#include <stdlib.h>
4218-#endif
4219-
4220-#ifdef HAVE_STRING_H
4221-#include <string.h>
4222-#endif
4223-
4224-#ifdef HAVE_ERRNO_H
4225-#include <errno.h>
4226-#endif
4227-
4228-#include <gtk/gtk.h>
4229-
4230-#include <libxfce4util/libxfce4util.h>
4231-
4232-#include <libnotify/notify.h>
4233-
4234-#include "xfpm-common.h"
4235-#include "xfpm-notify.h"
4236-#include "xfpm-dbus-monitor.h"
4237-
4238-static void xfpm_notify_finalize (GObject *object);
4239-
4240-static NotifyNotification * xfpm_notify_new_notification_internal (const gchar *title,
4241- const gchar *message,
4242- const gchar *icon_name,
4243- guint timeout,
4244- XfpmNotifyUrgency urgency,
4245- GtkStatusIcon *icon) G_GNUC_MALLOC;
4246-
4247-#define XFPM_NOTIFY_GET_PRIVATE(o) \
4248-(G_TYPE_INSTANCE_GET_PRIVATE((o), XFPM_TYPE_NOTIFY, XfpmNotifyPrivate))
4249-
4250-struct XfpmNotifyPrivate
4251-{
4252- XfpmDBusMonitor *monitor;
4253-
4254- NotifyNotification *notification;
4255- NotifyNotification *critical;
4256-
4257- gulong critical_id;
4258- gulong notify_id;
4259-
4260- gboolean supports_actions;
4261- gboolean supports_sync; /*For x-canonical-private-synchronous */
4262-};
4263-
4264-enum
4265-{
4266- PROP_0,
4267- PROP_ACTIONS,
4268- PROP_SYNC
4269-};
4270-
4271-G_DEFINE_TYPE(XfpmNotify, xfpm_notify, G_TYPE_OBJECT)
4272-
4273-static void
4274-xfpm_notify_get_server_caps (XfpmNotify *notify)
4275-{
4276- GList *caps = NULL;
4277- notify->priv->supports_actions = FALSE;
4278- notify->priv->supports_sync = FALSE;
4279-
4280- caps = notify_get_server_caps ();
4281-
4282- if (caps != NULL)
4283- {
4284- if (g_list_find_custom (caps, "x-canonical-private-synchronous", (GCompareFunc) g_strcmp0) != NULL)
4285- notify->priv->supports_sync = TRUE;
4286-
4287- if (g_list_find_custom (caps, "actions", (GCompareFunc) g_strcmp0) != NULL)
4288- notify->priv->supports_actions = TRUE;
4289-
4290- g_list_foreach(caps, (GFunc)g_free, NULL);
4291- g_list_free(caps);
4292- }
4293-}
4294-
4295-static void
4296-xfpm_notify_check_server (XfpmDBusMonitor *monitor,
4297- gchar *service_name,
4298- gboolean connected,
4299- gboolean on_session,
4300- XfpmNotify *notify)
4301-{
4302- if ( !g_strcmp0 (service_name, "org.freedesktop.Notifications") && on_session && connected )
4303- xfpm_notify_get_server_caps (notify);
4304-}
4305-
4306-static void xfpm_notify_get_property (GObject *object,
4307- guint prop_id,
4308- GValue *value,
4309- GParamSpec *pspec)
4310-{
4311- XfpmNotify *notify;
4312-
4313- notify = XFPM_NOTIFY (object);
4314-
4315- switch (prop_id)
4316- {
4317- case PROP_ACTIONS:
4318- g_value_set_boolean (value, notify->priv->supports_actions);
4319- break;
4320- case PROP_SYNC:
4321- g_value_set_boolean (value, notify->priv->supports_sync);
4322- break;
4323- default:
4324- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
4325- break;
4326- }
4327-}
4328-
4329-static void
4330-xfpm_notify_class_init (XfpmNotifyClass *klass)
4331-{
4332- GObjectClass *object_class = G_OBJECT_CLASS (klass);
4333-
4334- object_class->finalize = xfpm_notify_finalize;
4335- object_class->get_property = xfpm_notify_get_property;
4336-
4337- g_object_class_install_property (object_class,
4338- PROP_ACTIONS,
4339- g_param_spec_boolean ("actions",
4340- NULL, NULL,
4341- FALSE,
4342- G_PARAM_READABLE));
4343-
4344- g_object_class_install_property (object_class,
4345- PROP_SYNC,
4346- g_param_spec_boolean ("sync",
4347- NULL, NULL,
4348- FALSE,
4349- G_PARAM_READABLE));
4350-
4351- g_type_class_add_private (klass, sizeof (XfpmNotifyPrivate));
4352-}
4353-
4354-static void
4355-xfpm_notify_init (XfpmNotify *notify)
4356-{
4357- notify->priv = XFPM_NOTIFY_GET_PRIVATE (notify);
4358-
4359- notify->priv->notification = NULL;
4360- notify->priv->critical = NULL;
4361-
4362- notify->priv->critical_id = 0;
4363- notify->priv->notify_id = 0;
4364-
4365- notify->priv->monitor = xfpm_dbus_monitor_new ();
4366- xfpm_dbus_monitor_add_service (notify->priv->monitor, DBUS_BUS_SESSION, "org.freedesktop.Notifications");
4367- g_signal_connect (notify->priv->monitor, "service-connection-changed",
4368- G_CALLBACK (xfpm_notify_check_server), notify);
4369-
4370- xfpm_notify_get_server_caps (notify);
4371-}
4372-
4373-static void
4374-xfpm_notify_finalize (GObject *object)
4375-{
4376- XfpmNotify *notify;
4377-
4378- notify = XFPM_NOTIFY (object);
4379-
4380- xfpm_notify_close_normal (notify);
4381- xfpm_notify_close_critical (notify);
4382-
4383- G_OBJECT_CLASS (xfpm_notify_parent_class)->finalize(object);
4384-}
4385-
4386-static void
4387-xfpm_notify_set_notification_icon (NotifyNotification *n, const gchar *icon_name )
4388-{
4389- GdkPixbuf *pix = xfpm_icon_load (icon_name, 48);
4390-
4391- if ( pix )
4392- {
4393- notify_notification_set_icon_from_pixbuf (n,
4394- pix);
4395- g_object_unref ( G_OBJECT(pix));
4396- }
4397-
4398-}
4399-
4400-static NotifyNotification *
4401-xfpm_notify_new_notification_internal (const gchar *title, const gchar *message,
4402- const gchar *icon_name, guint timeout,
4403- XfpmNotifyUrgency urgency, GtkStatusIcon *icon)
4404-{
4405- NotifyNotification *n;
4406-
4407-#ifdef NOTIFY_CHECK_VERSION
4408-#if NOTIFY_CHECK_VERSION (0, 7, 0)
4409- n = notify_notification_new (title, message, NULL);
4410-#else
4411- n = notify_notification_new (title, message, NULL, NULL);
4412-#endif
4413-#else
4414- n = notify_notification_new (title, message, NULL, NULL);
4415-#endif
4416-
4417-
4418- if ( icon_name )
4419- xfpm_notify_set_notification_icon (n, icon_name);
4420-
4421-#ifdef NOTIFY_CHECK_VERSION
4422-#if !NOTIFY_CHECK_VERSION (0, 7, 0)
4423- if ( icon )
4424- notify_notification_attach_to_status_icon (n, icon);
4425-#endif
4426-#else
4427- if ( icon )
4428- notify_notification_attach_to_status_icon (n, icon);
4429-#endif
4430-
4431- notify_notification_set_urgency (n, (NotifyUrgency)urgency);
4432-
4433- if ( timeout != 0)
4434- notify_notification_set_timeout (n, timeout);
4435-
4436- return n;
4437-}
4438-
4439-static void
4440-xfpm_notify_closed_cb (NotifyNotification *n, XfpmNotify *notify)
4441-{
4442- notify->priv->notification = NULL;
4443- g_object_unref (G_OBJECT (n));
4444-}
4445-
4446-static void
4447-xfpm_notify_close_critical_cb (NotifyNotification *n, XfpmNotify *notify)
4448-{
4449- notify->priv->critical = NULL;
4450- g_object_unref (G_OBJECT (n));
4451-}
4452-
4453-static gboolean
4454-xfpm_notify_show (NotifyNotification *n)
4455-{
4456- notify_notification_show (n, NULL);
4457- return FALSE;
4458-}
4459-
4460-static void
4461-xfpm_notify_close_notification (XfpmNotify *notify )
4462-{
4463- if (notify->priv->notify_id != 0)
4464- {
4465- g_source_remove (notify->priv->notify_id);
4466- notify->priv->notify_id = 0;
4467- }
4468-
4469- if ( notify->priv->notification )
4470- {
4471- if (!notify_notification_close (notify->priv->notification, NULL))
4472- g_warning ("Failed to close notification\n");
4473-
4474- g_object_unref (G_OBJECT(notify->priv->notification) );
4475- notify->priv->notification = NULL;
4476- }
4477-}
4478-
4479-XfpmNotify *
4480-xfpm_notify_new (void)
4481-{
4482- static gpointer xfpm_notify_object = NULL;
4483-
4484- if ( xfpm_notify_object != NULL )
4485- {
4486- g_object_ref (xfpm_notify_object);
4487- }
4488- else
4489- {
4490- xfpm_notify_object = g_object_new (XFPM_TYPE_NOTIFY, NULL);
4491- g_object_add_weak_pointer (xfpm_notify_object, &xfpm_notify_object);
4492- }
4493- return XFPM_NOTIFY (xfpm_notify_object);
4494-}
4495-
4496-void xfpm_notify_show_notification (XfpmNotify *notify, const gchar *title,
4497- const gchar *text, const gchar *icon_name,
4498- gint timeout, gboolean simple,
4499- XfpmNotifyUrgency urgency, GtkStatusIcon *icon)
4500-{
4501- NotifyNotification *n;
4502-
4503- if ( !simple )
4504- xfpm_notify_close_notification (notify);
4505-
4506- n = xfpm_notify_new_notification_internal (title,
4507- text, icon_name,
4508- timeout, urgency,
4509- icon);
4510-
4511- xfpm_notify_present_notification (notify, n, simple);
4512-}
4513-
4514-NotifyNotification *xfpm_notify_new_notification (XfpmNotify *notify,
4515- const gchar *title,
4516- const gchar *text,
4517- const gchar *icon_name,
4518- guint timeout,
4519- XfpmNotifyUrgency urgency,
4520- GtkStatusIcon *icon)
4521-{
4522- NotifyNotification *n = xfpm_notify_new_notification_internal (title,
4523- text, icon_name,
4524- timeout, urgency,
4525- icon);
4526- return n;
4527-}
4528-
4529-void xfpm_notify_add_action_to_notification (XfpmNotify *notify, NotifyNotification *n,
4530- const gchar *id, const gchar *action_label,
4531- NotifyActionCallback callback, gpointer data)
4532-{
4533- g_return_if_fail (XFPM_IS_NOTIFY(notify));
4534-
4535- notify_notification_add_action (n, id, action_label,
4536- (NotifyActionCallback)callback,
4537- data, NULL);
4538-
4539-}
4540-
4541-void xfpm_notify_present_notification (XfpmNotify *notify, NotifyNotification *n, gboolean simple)
4542-{
4543- g_return_if_fail (XFPM_IS_NOTIFY(notify));
4544-
4545- if ( !simple )
4546- xfpm_notify_close_notification (notify);
4547-
4548- if ( !simple )
4549- {
4550- g_signal_connect (G_OBJECT(n),"closed",
4551- G_CALLBACK(xfpm_notify_closed_cb), notify);
4552- notify->priv->notification = n;
4553- }
4554-
4555- notify->priv->notify_id = g_idle_add ((GSourceFunc) xfpm_notify_show, n);
4556-}
4557-
4558-void xfpm_notify_critical (XfpmNotify *notify, NotifyNotification *n)
4559-{
4560- g_return_if_fail (XFPM_IS_NOTIFY (notify));
4561-
4562- xfpm_notify_close_critical (notify);
4563-
4564- notify->priv->critical = n;
4565-
4566- g_signal_connect (G_OBJECT (n), "closed",
4567- G_CALLBACK (xfpm_notify_close_critical_cb), notify);
4568-
4569- notify->priv->critical_id = g_idle_add ((GSourceFunc) xfpm_notify_show, n);
4570-}
4571-
4572-void xfpm_notify_close_critical (XfpmNotify *notify)
4573-{
4574- g_return_if_fail (XFPM_IS_NOTIFY (notify));
4575-
4576-
4577- if (notify->priv->critical_id != 0)
4578- {
4579- g_source_remove (notify->priv->critical_id);
4580- notify->priv->critical_id = 0;
4581- }
4582-
4583- if ( notify->priv->critical )
4584- {
4585- if (!notify_notification_close (notify->priv->critical, NULL))
4586- g_warning ("Failed to close notification\n");
4587-
4588- g_object_unref (G_OBJECT(notify->priv->critical) );
4589- notify->priv->critical = NULL;
4590- }
4591-}
4592-
4593-void xfpm_notify_close_normal (XfpmNotify *notify)
4594-{
4595- g_return_if_fail (XFPM_IS_NOTIFY (notify));
4596-
4597- xfpm_notify_close_notification (notify);
4598-}
4599
4600=== added directory '.pc/02_translations-fix-invalid-format-strings.patch'
4601=== removed directory '.pc/02_translations-fix-invalid-format-strings.patch'
4602=== added file '.pc/02_translations-fix-invalid-format-strings.patch/.timestamp'
4603=== added directory '.pc/02_translations-fix-invalid-format-strings.patch/po'
4604=== removed directory '.pc/02_translations-fix-invalid-format-strings.patch/po'
4605=== added file '.pc/02_translations-fix-invalid-format-strings.patch/po/en_GB.po'
4606--- .pc/02_translations-fix-invalid-format-strings.patch/po/en_GB.po 1970-01-01 00:00:00 +0000
4607+++ .pc/02_translations-fix-invalid-format-strings.patch/po/en_GB.po 2014-01-22 05:17:49 +0000
4608@@ -0,0 +1,1083 @@
4609+# en_GB translation for xfce4-power-manager.
4610+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
4611+# This file is distributed under the same license as the PACKAGE package.
4612+# Jeff Bailes <thepizzaking@gmail.com>, 2010.
4613+#
4614+msgid ""
4615+msgstr ""
4616+"Project-Id-Version: \n"
4617+"Report-Msgid-Bugs-To: \n"
4618+"POT-Creation-Date: 2012-04-22 22:51+0000\n"
4619+"PO-Revision-Date: 2010-12-24 14:21+1100\n"
4620+"Last-Translator: Jeff Bailes <thepizzaking@gmail.com>\n"
4621+"Language-Team: \n"
4622+"MIME-Version: 1.0\n"
4623+"Content-Type: text/plain; charset=UTF-8\n"
4624+"Content-Transfer-Encoding: 8bit\n"
4625+"Language: \n"
4626+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
4627+
4628+#: ../data/interfaces/xfpm-settings.ui.h:1
4629+msgid "<b>Actions</b>"
4630+msgstr "<b>Actions</b>"
4631+
4632+#: ../data/interfaces/xfpm-settings.ui.h:2
4633+msgid "<b>Advanced Options</b>"
4634+msgstr "<b>Advanced Options</b>"
4635+
4636+#: ../data/interfaces/xfpm-settings.ui.h:3
4637+msgid "<b>Brightness</b>"
4638+msgstr "<b>Brightness</b>"
4639+
4640+#: ../data/interfaces/xfpm-settings.ui.h:4
4641+msgid "<b>General Options</b>"
4642+msgstr "<b>General Options</b>"
4643+
4644+#: ../data/interfaces/xfpm-settings.ui.h:5
4645+msgid "<b>Monitor</b>"
4646+msgstr "<b>Monitor</b>"
4647+
4648+#: ../data/interfaces/xfpm-settings.ui.h:6
4649+msgid "Actions"
4650+msgstr "Actions"
4651+
4652+#: ../data/interfaces/xfpm-settings.ui.h:7
4653+msgid "Consider the computer on low power at:"
4654+msgstr "Consider the computer on low power at:"
4655+
4656+#. Hibernate menu option
4657+#: ../data/interfaces/xfpm-settings.ui.h:8 ../settings/xfpm-settings.c:820
4658+#: ../settings/xfpm-settings.c:888 ../settings/xfpm-settings.c:1037
4659+#: ../settings/xfpm-settings.c:1214 ../settings/xfpm-settings.c:1271
4660+#: ../settings/xfpm-settings.c:1323 ../src/xfpm-power.c:484
4661+#: ../src/xfpm-power.c:779
4662+msgid "Hibernate"
4663+msgstr "Hibernate"
4664+
4665+#: ../data/interfaces/xfpm-settings.ui.h:9
4666+msgid "Level:"
4667+msgstr "Level:"
4668+
4669+#: ../data/interfaces/xfpm-settings.ui.h:10
4670+msgid "Lock screen when going for suspend/hibernate"
4671+msgstr "Lock screen when going for suspend/hibernate"
4672+
4673+#: ../data/interfaces/xfpm-settings.ui.h:11 ../src/xfpm-power-common.c:132
4674+msgid "Monitor"
4675+msgstr "Monitor"
4676+
4677+#: ../data/interfaces/xfpm-settings.ui.h:12
4678+msgid "Monitor power management control"
4679+msgstr "Monitor power management control"
4680+
4681+#: ../data/interfaces/xfpm-settings.ui.h:13 ../settings/xfpm-settings.c:809
4682+#: ../settings/xfpm-settings.c:877 ../settings/xfpm-settings.c:1026
4683+#: ../settings/xfpm-settings.c:1203 ../settings/xfpm-settings.c:1260
4684+#: ../settings/xfpm-settings.c:1312
4685+msgid "Nothing"
4686+msgstr "Nothing"
4687+
4688+#: ../data/interfaces/xfpm-settings.ui.h:14
4689+msgid "Power manager settings"
4690+msgstr "Power manager settings"
4691+
4692+#: ../data/interfaces/xfpm-settings.ui.h:15
4693+msgid "Prefer power savings over performance"
4694+msgstr "Prefer power savings over performance"
4695+
4696+#: ../data/interfaces/xfpm-settings.ui.h:16
4697+msgid "Put display to sleep when computer is inactive for:"
4698+msgstr "Put display to sleep when computer is inactive for:"
4699+
4700+#: ../data/interfaces/xfpm-settings.ui.h:17
4701+msgid "Put the computer to sleep when inactive for:"
4702+msgstr "Put the computer to sleep when inactive for:"
4703+
4704+#: ../data/interfaces/xfpm-settings.ui.h:18
4705+msgid "Reduce screen brightness when computer is inactive for:"
4706+msgstr "Reduce screen brightness when computer is inactive for:"
4707+
4708+#: ../data/interfaces/xfpm-settings.ui.h:19
4709+msgid "Set computer inactivity sleep mode:"
4710+msgstr "Set computer inactivity sleep mode:"
4711+
4712+#: ../data/interfaces/xfpm-settings.ui.h:20
4713+msgid "Set monitor sleep mode:"
4714+msgstr "Set monitor sleep mode:"
4715+
4716+#: ../data/interfaces/xfpm-settings.ui.h:21
4717+msgid "Show notifications to notify about the battery state"
4718+msgstr "Show notifications to notify about the battery state"
4719+
4720+#: ../data/interfaces/xfpm-settings.ui.h:22
4721+msgid "Spin down hard disks"
4722+msgstr "Spin down hard disks"
4723+
4724+#: ../data/interfaces/xfpm-settings.ui.h:23
4725+msgid "Standby"
4726+msgstr "Standby"
4727+
4728+#. Suspend menu option
4729+#: ../data/interfaces/xfpm-settings.ui.h:24 ../settings/xfpm-settings.c:814
4730+#: ../settings/xfpm-settings.c:882 ../settings/xfpm-settings.c:1031
4731+#: ../settings/xfpm-settings.c:1208 ../settings/xfpm-settings.c:1265
4732+#: ../settings/xfpm-settings.c:1317 ../src/xfpm-power.c:499
4733+#: ../src/xfpm-power.c:792
4734+msgid "Suspend"
4735+msgstr "Suspend"
4736+
4737+#: ../data/interfaces/xfpm-settings.ui.h:25
4738+msgid "Switch off display when computer is inactive for:"
4739+msgstr "Switch off display when computer is inactive for:"
4740+
4741+#: ../data/interfaces/xfpm-settings.ui.h:26
4742+msgid "System tray icon: "
4743+msgstr "System tray icon: "
4744+
4745+#: ../data/interfaces/xfpm-settings.ui.h:27
4746+msgid "When battery power is critical:"
4747+msgstr "When battery power is critical:"
4748+
4749+#: ../data/interfaces/xfpm-settings.ui.h:28
4750+msgid "When hibernate button is pressed:"
4751+msgstr "When hibernate button is pressed:"
4752+
4753+#: ../data/interfaces/xfpm-settings.ui.h:29
4754+msgid "When laptop lid is closed:"
4755+msgstr "When laptop lid is closed:"
4756+
4757+#: ../data/interfaces/xfpm-settings.ui.h:30
4758+msgid "When power button is pressed:"
4759+msgstr "When power button is pressed:"
4760+
4761+#: ../data/interfaces/xfpm-settings.ui.h:31
4762+msgid "When sleep button is pressed:"
4763+msgstr "When sleep button is pressed:"
4764+
4765+#: ../data/interfaces/xfpm-settings.ui.h:32
4766+#: ../settings/xfpm-settings-main.c:121 ../src/xfpm-main.c:413
4767+msgid "Xfce Power Manager"
4768+msgstr "Xfce Power Manager"
4769+
4770+#: ../settings/xfpm-settings.c:567 ../settings/xfpm-settings.c:582
4771+#: ../settings/xfpm-settings.c:609
4772+msgid "Never"
4773+msgstr "Never"
4774+
4775+#: ../settings/xfpm-settings.c:570
4776+msgid "One minute"
4777+msgstr "One minute"
4778+
4779+#: ../settings/xfpm-settings.c:572 ../settings/xfpm-settings.c:584
4780+msgid "Minutes"
4781+msgstr "Minutes"
4782+
4783+#: ../settings/xfpm-settings.c:586 ../settings/xfpm-settings.c:593
4784+#: ../settings/xfpm-settings.c:594 ../settings/xfpm-settings.c:595
4785+msgid "One hour"
4786+msgstr "One hour"
4787+
4788+#: ../settings/xfpm-settings.c:594 ../settings/xfpm-settings.c:598
4789+msgid "one minute"
4790+msgstr "one minute"
4791+
4792+#: ../settings/xfpm-settings.c:595 ../settings/xfpm-settings.c:599
4793+msgid "minutes"
4794+msgstr "minutes"
4795+
4796+#: ../settings/xfpm-settings.c:597 ../settings/xfpm-settings.c:598
4797+#: ../settings/xfpm-settings.c:599
4798+msgid "hours"
4799+msgstr "hours"
4800+
4801+#: ../settings/xfpm-settings.c:611
4802+msgid "Seconds"
4803+msgstr "Seconds"
4804+
4805+#: ../settings/xfpm-settings.c:792 ../settings/xfpm-settings.c:990
4806+#: ../settings/xfpm-settings.c:1470
4807+msgid "Hibernate and suspend operations not supported"
4808+msgstr "Hibernate and suspend operations not supported"
4809+
4810+#: ../settings/xfpm-settings.c:797 ../settings/xfpm-settings.c:995
4811+#: ../settings/xfpm-settings.c:1475
4812+msgid "Hibernate and suspend operations not permitted"
4813+msgstr "Hibernate and suspend operations not permitted"
4814+
4815+#: ../settings/xfpm-settings.c:826 ../settings/xfpm-settings.c:1220
4816+#: ../src/xfpm-power.c:805
4817+msgid "Shutdown"
4818+msgstr "Shutdown"
4819+
4820+#: ../settings/xfpm-settings.c:830 ../settings/xfpm-settings.c:1224
4821+#: ../settings/xfpm-settings.c:1275 ../settings/xfpm-settings.c:1327
4822+msgid "Ask"
4823+msgstr "Ask"
4824+
4825+#: ../settings/xfpm-settings.c:892 ../settings/xfpm-settings.c:1041
4826+msgid "Lock screen"
4827+msgstr "Lock screen"
4828+
4829+#: ../settings/xfpm-settings.c:960 ../settings/xfpm-settings.c:1110
4830+msgid "Spinning down hard disks permission denied"
4831+msgstr "Spinning down hard disks permission denied"
4832+
4833+#: ../settings/xfpm-settings.c:1150
4834+msgid "Always show icon"
4835+msgstr "Always show icon"
4836+
4837+#: ../settings/xfpm-settings.c:1153
4838+msgid "When battery is present"
4839+msgstr "When battery is present"
4840+
4841+#: ../settings/xfpm-settings.c:1156
4842+msgid "When battery is charging or discharging"
4843+msgstr "When battery is charging or discharging"
4844+
4845+#: ../settings/xfpm-settings.c:1159
4846+msgid "Never show icon"
4847+msgstr "Never show icon"
4848+
4849+#: ../settings/xfpm-settings.c:1185
4850+msgid ""
4851+"Disable Display Power Management Signaling (DPMS), e.g don't attempt to "
4852+"switch off the display or put it in sleep mode."
4853+msgstr ""
4854+"Disable Display Power Management Signaling (DPMS), e.g don't attempt to "
4855+"switch off the display or put it in sleep mode."
4856+
4857+#: ../settings/xfpm-settings.c:1379
4858+msgid "Suspend operation not supported"
4859+msgstr "Suspend operation not supported"
4860+
4861+#: ../settings/xfpm-settings.c:1385
4862+msgid "Suspend operation not permitted"
4863+msgstr "Suspend operation not permitted"
4864+
4865+#: ../settings/xfpm-settings.c:1391
4866+msgid "Hibernate operation not supported"
4867+msgstr "Hibernate operation not supported"
4868+
4869+#: ../settings/xfpm-settings.c:1396
4870+msgid "Hibernate operation not permitted"
4871+msgstr "Hibernate operation not permitted"
4872+
4873+#: ../settings/xfpm-settings.c:1443
4874+msgid "When all the power sources of the computer reach this charge level"
4875+msgstr "When all the power sources of the computer reach this charge level"
4876+
4877+#: ../settings/xfpm-settings.c:1546 ../settings/xfpm-settings.c:1551
4878+msgid "General"
4879+msgstr "General"
4880+
4881+#: ../settings/xfpm-settings.c:1560 ../settings/xfpm-settings.c:1565
4882+msgid "On AC"
4883+msgstr "On AC"
4884+
4885+#: ../settings/xfpm-settings.c:1575 ../settings/xfpm-settings.c:1580
4886+msgid "On Battery"
4887+msgstr "On Battery"
4888+
4889+#: ../settings/xfpm-settings.c:1589 ../settings/xfpm-settings.c:1594
4890+msgid "Extended"
4891+msgstr "Extended"
4892+
4893+#: ../settings/xfpm-settings.c:1662
4894+msgid "Check your power manager installation"
4895+msgstr "Check your power manager installation"
4896+
4897+#: ../settings/xfpm-settings-main.c:78
4898+msgid "Settings manager socket"
4899+msgstr "Settings manager socket"
4900+
4901+#: ../settings/xfpm-settings-main.c:78
4902+msgid "SOCKET ID"
4903+msgstr "SOCKET ID"
4904+
4905+#: ../settings/xfpm-settings-main.c:89 ../src/xfpm-main.c:289
4906+#: ../src/xfpm-power-info.c:946
4907+#, c-format
4908+msgid "Type '%s --help' for usage."
4909+msgstr "Type '%s --help' for usage."
4910+
4911+#: ../settings/xfpm-settings-main.c:123
4912+msgid "Failed to load power manager configuration, using defaults"
4913+msgstr "Failed to load power manager configuration, using defaults"
4914+
4915+#: ../settings/xfpm-settings-main.c:148
4916+msgid "Unable to connect to Xfce Power Manager"
4917+msgstr "Unable to connect to Xfce Power Manager"
4918+
4919+#: ../settings/xfpm-settings-main.c:190 ../src/xfpm-main.c:329
4920+#, c-format
4921+msgid "Xfce power manager is not running"
4922+msgstr "Xfce power manager is not running"
4923+
4924+#: ../settings/xfpm-settings-main.c:195
4925+msgid "Run"
4926+msgstr "Run"
4927+
4928+#: ../settings/xfpm-settings-main.c:196
4929+msgid "Xfce4 Power Manager is not running, do you want to launch it now?"
4930+msgstr "Xfce4 Power Manager is not running, do you want to launch it now?"
4931+
4932+#: ../settings/xfce4-power-manager-settings.desktop.in.h:1
4933+#: ../src/xfpm-power.c:307 ../src/xfpm-power.c:595 ../src/xfpm-power.c:730
4934+#: ../src/xfpm-power.c:766 ../src/xfpm-power.c:935 ../src/xfpm-power.c:959
4935+#: ../src/xfpm-battery.c:351 ../src/xfce4-power-manager.desktop.in.h:1
4936+msgid "Power Manager"
4937+msgstr "Power Manager"
4938+
4939+#: ../settings/xfce4-power-manager-settings.desktop.in.h:2
4940+msgid "Settings for the Xfce Power Manager"
4941+msgstr "Settings for the Xfce Power Manager"
4942+
4943+#: ../common/xfpm-common.c:155
4944+msgid "translator-credits"
4945+msgstr "Jeff Bailes <thepizzaking@gmail.com>, 2010"
4946+
4947+#: ../src/xfpm-power.c:328
4948+msgid "_Hibernate"
4949+msgstr "_Hibernate"
4950+
4951+#: ../src/xfpm-power.c:329
4952+msgid ""
4953+"An application is currently disabling the automatic sleep. Doing this action "
4954+"now may damage the working state of this application."
4955+msgstr ""
4956+"An application is currently disabling the automatic sleep, doing this action "
4957+"now may damage the working state of this application, are you sure you want "
4958+"to hibernate the system?"
4959+
4960+#: ../src/xfpm-power.c:331
4961+msgid "Are you sure you want to hibernate the system?"
4962+msgstr "Are you sure you want to hibernate the system?"
4963+
4964+#: ../src/xfpm-power.c:426
4965+msgid "Quit"
4966+msgstr "Quit"
4967+
4968+#: ../src/xfpm-power.c:427
4969+msgid "All running instances of the power manager will exit"
4970+msgstr "All running instances of the power manager will exit"
4971+
4972+#: ../src/xfpm-power.c:429
4973+msgid "Quit the power manager?"
4974+msgstr "Quit the power manager?"
4975+
4976+#. Power information
4977+#: ../src/xfpm-power.c:534 ../src/xfpm-power-info.c:818
4978+msgid "Power Information"
4979+msgstr "Power Information"
4980+
4981+#. *
4982+#. * Power Mode
4983+#. *
4984+#. TRANSLATOR: Mode here is the power profile (presentation, power save,
4985+#. normal)
4986+#: ../src/xfpm-power.c:550
4987+msgid "Mode"
4988+msgstr "Mode"
4989+
4990+#. Normal
4991+#: ../src/xfpm-power.c:561
4992+msgid "Normal"
4993+msgstr "Normal"
4994+
4995+#. Normal
4996+#: ../src/xfpm-power.c:571
4997+msgid "Presentation"
4998+msgstr "Presentation"
4999+
5000+#: ../src/xfpm-power.c:693
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches

to all changes: