Merge lp:~philip.scott/wingpanel-indicator-sound/sensitive-startup into lp:~wingpanel-devs/wingpanel-indicator-sound/trunk

Proposed by Felipe Escoto
Status: Merged
Approved by: Corentin Noël
Approved revision: 65
Merged at revision: 64
Proposed branch: lp:~philip.scott/wingpanel-indicator-sound/sensitive-startup
Merge into: lp:~wingpanel-devs/wingpanel-indicator-sound/trunk
Diff against target: 76 lines (+2/-15)
2 files modified
src/Indicator.vala (+0/-15)
src/Widgets/Scale.vala (+2/-0)
To merge this branch: bzr merge lp:~philip.scott/wingpanel-indicator-sound/sensitive-startup
Reviewer Review Type Date Requested Status
Corentin Noël Approve
Review via email: mp+280755@code.launchpad.net

Commit message

Bind the slider and icon sensitivity to the global switch

Description of the change

Fixed slider always being insensitive on startup by binding the switch's active state to the sensitivity of the other objects.

Also removed code changing the other objects sensitivity from outside of the widget

To post a comment you must log in.
Revision history for this message
Corentin Noël (tintou) wrote :

Works pretty well here

review: Approve
65. By Felipe Escoto

Removed BIDIRECTIONAL flags from bindings

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Indicator.vala'
2--- src/Indicator.vala 2015-10-24 10:45:36 +0000
3+++ src/Indicator.vala 2015-12-16 18:36:23 +0000
4@@ -115,20 +115,13 @@
5 volume_scale.get_switch ().active = !volume_control.mute;
6 if (volume_control.mute) {
7 update_panel_icon (volume_control.volume.volume);
8- volume_scale.get_scale ().set_sensitive (false);
9 } else {
10 update_panel_icon (volume_control.volume.volume);
11- volume_scale.get_scale ().set_sensitive (true);
12 }
13 }
14
15 private void on_mic_mute_change () {
16 mic_scale.get_switch ().active = !volume_control.micMute;
17- if (volume_control.micMute) {
18- mic_scale.get_scale ().set_sensitive (false);
19- } else {
20- mic_scale.get_scale ().set_sensitive (true);
21- }
22 }
23
24 private void on_is_playing_change () {
25@@ -199,20 +192,16 @@
26 private void on_volume_switch_change () {
27 if (volume_scale.get_switch ().active) {
28 volume_control.set_mute (false);
29- volume_scale.get_image ().set_sensitive (true);
30 } else {
31 volume_control.set_mute (true);
32- volume_scale.get_image ().set_sensitive (false);
33 }
34 }
35
36 private void on_mic_switch_change () {
37 if (mic_scale.get_switch ().active) {
38 volume_control.set_mic_mute (false);
39- mic_scale.get_image ().set_sensitive (true);
40 } else {
41 volume_control.set_mic_mute (true);
42- mic_scale.get_image ().set_sensitive (false);
43 }
44 }
45
46@@ -297,8 +286,6 @@
47
48 volume_scale.margin_start = 6;
49 volume_scale.get_switch ().active = !volume_control.mute;
50- volume_scale.get_image ().set_sensitive (false);
51- volume_scale.get_scale ().set_sensitive (false);
52 volume_scale.get_switch ().notify["active"].connect (on_volume_switch_change);
53
54 volume_scale.get_scale ().value_changed.connect (() => {
55@@ -344,8 +331,6 @@
56
57 mic_scale.margin_start = 6;
58 mic_scale.get_switch ().active = !volume_control.micMute;
59- mic_scale.get_image ().set_sensitive (false);
60- mic_scale.get_scale ().set_sensitive (false);
61 mic_scale.get_switch ().notify["active"].connect (on_mic_switch_change);
62
63 mic_scale.get_scale ().value_changed.connect (() => {
64
65=== modified file 'src/Widgets/Scale.vala'
66--- src/Widgets/Scale.vala 2015-10-24 10:45:36 +0000
67+++ src/Widgets/Scale.vala 2015-12-16 18:36:23 +0000
68@@ -53,6 +53,8 @@
69 this.scroll_event.connect (on_scroll);
70 image_box.scroll_event.connect (on_scroll);
71 switch_widget.scroll_event.connect (on_scroll);
72+ switch_widget.bind_property ("active", scale_widget, "sensitive", BindingFlags.SYNC_CREATE);
73+ switch_widget.bind_property ("active", image, "sensitive", BindingFlags.SYNC_CREATE);
74 }
75
76 construct {

Subscribers

People subscribed via source and target branches

to all changes: