Merge lp:~xapantu/switchboard-plug-power/fix-brightness-scale-on-debian into lp:~elementary-apps/switchboard-plug-power/trunk

Proposed by xapantu
Status: Merged
Approved by: Cody Garver
Approved revision: 250
Merged at revision: 251
Proposed branch: lp:~xapantu/switchboard-plug-power/fix-brightness-scale-on-debian
Merge into: lp:~elementary-apps/switchboard-plug-power/trunk
Diff against target: 86 lines (+22/-5)
3 files modified
debian/control (+2/-1)
src/CMakeLists.txt (+8/-1)
src/Plug.vala (+12/-3)
To merge this branch: bzr merge lp:~xapantu/switchboard-plug-power/fix-brightness-scale-on-debian
Reviewer Review Type Date Requested Status
kay van der Zander (community) Approve
gandalfn (community) Approve
elementary Apps team Pending
Review via email: mp+268470@code.launchpad.net

Commit message

Update to the new GSD API with conditional compilation

Description of the change

This patch enable Brightness dbus API, to set brightness scale.

On debian Jessie g-s-d is at version 3.14. Works for Archlinux too.

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

works perfectly on debian, just needs a new build deps on gnome-settings-daemon-dev

review: Approve
Revision history for this message
kay van der Zander (kay20) wrote :

i have tested the branch on freya and i doubt you have test it on freya.
with gnome-settings-daemon-dev installed it doesn't compile with g-s-d version 3.8.x

"kay@kay-N55SF:~/Documents/elementary/test/fix-brightness-scale-on-debian/build$ cmake .. -DCMAKE_INSTALL_PREFIX=/usr
-- The C compiler identification is GNU 4.8.4
-- The CXX compiler identification is GNU 4.8.4
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.26")
-- checking for modules 'gthread-2.0;gtk+-3.0;switchboard-2.0;granite;gnome-settings-daemon'
-- found gthread-2.0, version 2.42.2
-- found gtk+-3.0, version 3.14.15
-- found switchboard-2.0, version 2.0
-- found granite, version 0.3.0
-- found gnome-settings-daemon, version 3.8.6.1
-- Found Vala: /usr/bin/valac
-- checking for a minimum Vala version of 0.22.0
-- found Vala, version 0.28.1
-- Configuring done
-- Generating done
-- Build files have been written to: /home/kay/Documents/elementary/test/fix-brightness-scale-on-debian/build
kay@kay-N55SF:~/Documents/elementary/test/fix-brightness-scale-on-debian/build$ make
Scanning dependencies of target i18n
[ 16%] messages.”
[ 16%] Built target i18n
[ 33%] Generating Plug.c;ActionComboBox.c;TimeoutComboBox.c;/home/kay/Documents/elementary/test/fix-brightness-scale-on-debian/build/src/config.c
Unknown option --defined=OLD_GSD
Run '/usr/bin/valac --help' to see a full list of available command line options.
make[2]: *** [src/pantheon-power_valac.stamp] Error 1
make[1]: *** [src/CMakeFiles/pantheon-power.dir/all] Error 2
make: *** [all] Error 2"

line 41 comment contradicts the cmakelists file (i know you didn't touch it but update it than)
is it >=3.10 or >=3.14

good that you used the current code style it wouldn't look good if you used the new code style.

review: Needs Fixing (not compilable)
Revision history for this message
kay van der Zander (kay20) wrote :

it compiles on debian jessie 8.1

Revision history for this message
gandalfn (gandalfn) wrote :

> i have tested the branch on freya and i doubt you have test it on freya.
> with gnome-settings-daemon-dev installed it doesn't compile with g-s-d version
> 3.8.x
>
> "kay@kay-N55SF:~/Documents/elementary/test/fix-brightness-scale-on-
> debian/build$ cmake .. -DCMAKE_INSTALL_PREFIX=/usr
> -- The C compiler identification is GNU 4.8.4
> -- The CXX compiler identification is GNU 4.8.4
> -- Check for working C compiler: /usr/bin/cc
> -- Check for working C compiler: /usr/bin/cc -- works
> -- Detecting C compiler ABI info
> -- Detecting C compiler ABI info - done
> -- Check for working CXX compiler: /usr/bin/c++
> -- Check for working CXX compiler: /usr/bin/c++ -- works
> -- Detecting CXX compiler ABI info
> -- Detecting CXX compiler ABI info - done
> -- Found PkgConfig: /usr/bin/pkg-config (found version "0.26")
> -- checking for modules 'gthread-2.0;gtk+-3.0;switchboard-2.0;granite;gnome-
> settings-daemon'
> -- found gthread-2.0, version 2.42.2
> -- found gtk+-3.0, version 3.14.15
> -- found switchboard-2.0, version 2.0
> -- found granite, version 0.3.0
> -- found gnome-settings-daemon, version 3.8.6.1
> -- Found Vala: /usr/bin/valac
> -- checking for a minimum Vala version of 0.22.0
> -- found Vala, version 0.28.1
> -- Configuring done
> -- Generating done
> -- Build files have been written to: /home/kay/Documents/elementary/test/fix-
> brightness-scale-on-debian/build
> kay@kay-N55SF:~/Documents/elementary/test/fix-brightness-scale-on-
> debian/build$ make
> Scanning dependencies of target i18n
> [ 16%] messages.”
> [ 16%] Built target i18n
> [ 33%] Generating
> Plug.c;ActionComboBox.c;TimeoutComboBox.c;/home/kay/Documents/elementary/test
> /fix-brightness-scale-on-debian/build/src/config.c
> Unknown option --defined=OLD_GSD
> Run '/usr/bin/valac --help' to see a full list of available command line
> options.
> make[2]: *** [src/pantheon-power_valac.stamp] Error 1
> make[1]: *** [src/CMakeFiles/pantheon-power.dir/all] Error 2
> make: *** [all] Error 2"
>
>
> line 41 comment contradicts the cmakelists file (i know you didn't touch it
> but update it than)
> is it >=3.10 or >=3.14
>
> good that you used the current code style it wouldn't look good if you used
> the new code style.

To build package a new build-deps under gnome-settings-daemon-dev is needed

Revision history for this message
kay van der Zander (kay20) wrote :

The else case provided in the CmakeLists.txt is not working. It is made that it should work with older and newer packages of g-s-d, it still needs fixing.
Otherwise you could remove the old code if there is not intention to have backward compatibility.
But there must be backward compatibility at this point.

Revision history for this message
xapantu (xapantu) wrote :

Yes I couldn't test it with a so old version of GSD. I made a typo, I just updated the patch, it should work now.

I did not test in GSD 3.10, I assume the one who wrote that comment was right.

Revision history for this message
kay van der Zander (kay20) wrote :

oke it works. please repull from trunk to avoid revision problems

250. By xapantu

Update to the new gsd api with conditional compilation

Revision history for this message
kay van der Zander (kay20) wrote :

meets the requirements.
tested on freya 3.0 and debian 8.1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/control'
2--- debian/control 2015-03-04 09:11:56 +0000
3+++ debian/control 2015-08-20 10:55:21 +0000
4@@ -6,7 +6,8 @@
5 debhelper (>= 9),
6 libgranite-dev,
7 libswitchboard-2.0-dev,
8- valac (>= 0.22)
9+ valac (>= 0.22),
10+ gnome-settings-daemon-dev
11 Standards-Version: 3.9.2
12 Homepage: https://launchpad.net/switchboard-plug-power
13
14
15=== modified file 'src/CMakeLists.txt'
16--- src/CMakeLists.txt 2014-12-04 15:05:06 +0000
17+++ src/CMakeLists.txt 2015-08-20 10:55:21 +0000
18@@ -1,7 +1,13 @@
19 find_package (PkgConfig)
20
21 # Add all your dependencies to the list below
22-pkg_check_modules (DEPS REQUIRED gthread-2.0 gtk+-3.0 switchboard-2.0 granite)
23+pkg_check_modules (DEPS REQUIRED gthread-2.0 gtk+-3.0 switchboard-2.0 granite gnome-settings-daemon)
24+
25+if(${DEPS_gnome-settings-daemon_VERSION} VERSION_GREATER 3.10 OR ${DEPS_gnome-settings-daemon_VERSION} VERSION_EQUAL 3.10)
26+ set(VALA_DEFINED_VAR "")
27+else()
28+ set(VALA_DEFINED_VAR "--define=OLD_GSD")
29+endif()
30
31 add_definitions (${DEPS_CFLAGS})
32 link_directories (${DEPS_LIBRARY_DIRS})
33@@ -23,6 +29,7 @@
34 granite
35 OPTIONS
36 --thread
37+ ${VALA_DEFINED_VAR}
38 )
39
40 add_library (${CMAKE_PROJECT_NAME} MODULE ${VALA_C})
41
42=== modified file 'src/Plug.vala'
43--- src/Plug.vala 2015-08-19 17:44:41 +0000
44+++ src/Plug.vala 2015-08-20 10:55:21 +0000
45@@ -4,12 +4,14 @@
46 Gtk.Box stack_container;
47
48 [DBus (name = "org.gnome.SettingsDaemon.Power.Screen")]
49-
50 interface PowerSettings : GLib.Object {
51+#if OLD_GSD
52 public abstract uint GetPercentage () throws IOError;
53 public abstract uint SetPercentage (uint percentage) throws IOError;
54+#else
55 // use the Brightness property after updateing g-s-d to 3.10 or above
56- // public abstract int Brightness {get; set; }
57+ public abstract int Brightness {get; set; }
58+#endif
59 }
60
61 [DBus (name = "org.freedesktop.UPower")]
62@@ -151,7 +153,11 @@
63 }
64
65 if (show_brightness) {
66+#if OLD_GSD
67 scale.set_value (screen.GetPercentage ());
68+#else
69+ scale.set_value (screen.Brightness);
70+#endif
71 } else {
72 warning ("No battery found, hiding brightness settings");
73 }
74@@ -171,8 +177,11 @@
75 scale.value_changed.connect (() => {
76 var val = (int) scale.get_value ();
77 try {
78- // screen.Brightness = val;
79+#if OLD_GSD
80 screen.SetPercentage (val);
81+#else
82+ screen.Brightness = val;
83+#endif
84 } catch (IOError ioe) {
85 // ignore, because if we have GetPercentage, we have SetPercentage
86 // otherwise the scale won't be visible to change

Subscribers

People subscribed via source and target branches

to all changes: