Merge lp:~tintou/switchboard-plug-power/native-naming into lp:~elementary-apps/switchboard-plug-power/trunk

Proposed by Corentin Noël
Status: Merged
Approved by: Danielle Foré
Approved revision: 411
Merged at revision: 411
Proposed branch: lp:~tintou/switchboard-plug-power/native-naming
Merge into: lp:~elementary-apps/switchboard-plug-power/trunk
Diff against target: 135 lines (+23/-28)
4 files modified
src/Battery.vala (+2/-2)
src/Interfaces.vala (+14/-19)
src/Plug.vala (+3/-3)
src/PowerSupply.vala (+4/-4)
To merge this branch: bzr merge lp:~tintou/switchboard-plug-power/native-naming
Reviewer Review Type Date Requested Status
elementary Apps team Pending
Review via email: mp+319786@code.launchpad.net

Commit message

Use lower_case naming convention in DBus

To post a comment you must log in.
411. By Corentin Noël

Use lower_case naming convention

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Battery.vala'
2--- src/Battery.vala 2016-07-04 02:25:39 +0000
3+++ src/Battery.vala 2017-03-14 10:24:13 +0000
4@@ -33,7 +33,7 @@
5 public bool check_present () {
6 bool present = false;
7 if (laptop) {
8- if (upower.OnBattery || upower_device.IsPresent) {
9+ if (upower.on_battery || upower_device.is_present) {
10 present = true;
11 }
12 }
13@@ -44,7 +44,7 @@
14 private string get_dbus_path (Upower upow) {
15 string path = "";
16 try {
17- ObjectPath[] devs = upow.EnumerateDevices();
18+ ObjectPath[] devs = upow.enumerate_devices();
19 for (int i = 0; i < devs.length; i++) {
20 if (devs[i].contains ("BAT0")) {
21 path = devs[i].to_string();
22
23=== modified file 'src/Interfaces.vala'
24--- src/Interfaces.vala 2017-03-14 09:46:39 +0000
25+++ src/Interfaces.vala 2017-03-14 10:24:13 +0000
26@@ -24,36 +24,31 @@
27 [DBus (name = "org.gnome.SettingsDaemon.Power.Screen")]
28 interface PowerSettings : GLib.Object {
29 #if OLD_GSD
30- public abstract uint GetPercentage () throws IOError;
31- public abstract uint SetPercentage (uint percentage) throws IOError;
32+ public abstract uint get_percentage () throws IOError;
33+ public abstract uint set_percentage (uint percentage) throws IOError;
34 #else
35 // use the Brightness property after updateing g-s-d to 3.10 or above
36- public abstract int Brightness {get; set; }
37+ public abstract int brightness {get; set; }
38 #endif
39 }
40
41 [DBus (name = "org.freedesktop.UPower.Device")]
42 interface UpowerDevice : Object {
43- public signal void Changed ();
44- public abstract void Refresh () throws IOError;
45- public abstract bool Online { owned get; }
46- public abstract bool PowerSupply { owned get; }
47- public abstract bool IsPresent { owned get; }
48- public abstract uint Type { owned get; }
49+ public signal void changed ();
50+ public abstract void refresh () throws IOError;
51+ public abstract bool online { owned get; }
52+ public abstract bool power_supply { owned get; }
53+ public abstract bool is_present { owned get; }
54+ [DBus (name = "Type")]
55+ public abstract uint device_type { owned get; }
56 }
57
58
59 [DBus (name = "org.freedesktop.UPower")]
60 interface Upower : Object {
61- public signal void Changed ();
62- public abstract bool OnBattery { owned get; }
63- public abstract bool LowOnBattery { owned get; }
64- public abstract ObjectPath[] EnumerateDevices () throws IOError;
65- }
66-
67- [DBus (name = "org.freedesktop.DBus.Properties")]
68- public interface UpowerProperties : Object {
69- public abstract Variant Get (string interface, string propname) throws IOError;
70- public abstract void Set (string interface, string propname, Variant value) throws IOError;
71+ public signal void changed ();
72+ public abstract bool on_battery { owned get; }
73+ public abstract bool low_on_battery { owned get; }
74+ public abstract ObjectPath[] enumerate_devices () throws IOError;
75 }
76 }
77
78=== modified file 'src/Plug.vala'
79--- src/Plug.vala 2016-12-14 19:07:02 +0000
80+++ src/Plug.vala 2017-03-14 10:24:13 +0000
81@@ -238,7 +238,7 @@
82 scale.hexpand = true;
83 scale.width_request = 480;
84
85- scale.set_value (screen.Brightness);
86+ scale.set_value (screen.brightness);
87
88 scale.value_changed.connect (on_scale_value_changed);
89 (screen as DBusProxy).g_properties_changed.connect (on_screen_properties_changed);
90@@ -306,14 +306,14 @@
91 private void on_scale_value_changed () {
92 var val = (int) scale.get_value ();
93 (screen as DBusProxy).g_properties_changed.disconnect (on_screen_properties_changed);
94- screen.Brightness = val;
95+ screen.brightness = val;
96 (screen as DBusProxy).g_properties_changed.connect (on_screen_properties_changed);
97 }
98
99 private void on_screen_properties_changed (Variant changed_properties, string[] invalidated_properties) {
100 var changed_brightness = changed_properties.lookup_value("Brightness", new VariantType("i"));
101 if (changed_brightness != null) {
102- var val = screen.Brightness;
103+ var val = screen.brightness;
104 scale.value_changed.disconnect (on_scale_value_changed);
105 scale.set_value (val);
106 scale.value_changed.connect (on_scale_value_changed);
107
108=== modified file 'src/PowerSupply.vala'
109--- src/PowerSupply.vala 2016-07-04 02:25:39 +0000
110+++ src/PowerSupply.vala 2017-03-14 10:24:13 +0000
111@@ -35,9 +35,9 @@
112 }
113
114 try {
115- upower_device.Refresh ();
116+ upower_device.refresh ();
117
118- if (upower_device.Online && upower_device.PowerSupply) {
119+ if (upower_device.online && upower_device.power_supply) {
120 present = true;
121 }
122 } catch (Error e) {
123@@ -60,10 +60,10 @@
124
125 private void get_upower_ac_device (Upower upow) {
126 try {
127- ObjectPath[] devs = upow.EnumerateDevices ();
128+ ObjectPath[] devs = upow.enumerate_devices ();
129 for (int i = 0; i < devs.length; i++) {
130 UpowerDevice dev = Bus.get_proxy_sync (BusType.SYSTEM, DBUS_UPOWER_NAME, devs[i], DBusProxyFlags.GET_INVALIDATED_PROPERTIES);
131- if (dev.Type == LINE_POWER_TYPE) {
132+ if (dev.device_type == LINE_POWER_TYPE) {
133 upower_device = dev;
134 return;
135 }

Subscribers

People subscribed via source and target branches

to all changes: