Merge lp:~unity-team/unity/unity.fix-604505 into lp:unity

Proposed by Mirco Müller
Status: Merged
Approved by: Mirco Müller
Approved revision: no longer in the source branch.
Merged at revision: 506
Proposed branch: lp:~unity-team/unity/unity.fix-604505
Merge into: lp:unity
Diff against target: 144 lines (+94/-0)
3 files modified
.bzrignore (+1/-0)
unity-private/panel/panel-indicator-object-entry-view.vala (+74/-0)
unity-private/panel/panel-indicator-object-view.vala (+19/-0)
To merge this branch: bzr merge lp:~unity-team/unity/unity.fix-604505
Reviewer Review Type Date Requested Status
Jay Taoko (community) Approve
Review via email: mp+35532@code.launchpad.net

Description of the change

This branch fixes LP: #604505.

It makes insensitive labels/images render with less opacity and makes sure they can't be accessed by mouse-clicks or keyboard-navigation.

The only test-case used to verify is the Room-menu of empathy, like mentioned in the bug. There's a glitch of the insensitive menu being reactive (for mouse-clicks) when empathy starts up, although it's rendered being inactive. That's due to the constructor setting it to true. Not sure how to work around it without breaking something.

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

Approved

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '.bzrignore'
2--- .bzrignore 2010-08-26 17:04:48 +0000
3+++ .bzrignore 2010-09-15 13:41:49 +0000
4@@ -355,3 +355,4 @@
5 unity/unity-layered-bin.c
6 unity-private/places/places-default-renderer-tiles.c
7 unity-private/places/places-button.c
8+unity-private/panel/panel-divider.c
9
10=== modified file 'unity-private/panel/panel-indicator-object-entry-view.vala'
11--- unity-private/panel/panel-indicator-object-entry-view.vala 2010-08-21 13:27:15 +0000
12+++ unity-private/panel/panel-indicator-object-entry-view.vala 2010-09-15 13:41:49 +0000
13@@ -34,6 +34,8 @@
14 private float last_width = 0;
15 private float last_height = 0;
16
17+ public bool skip;
18+
19 public IndicatorObjectEntryView (Indicator.ObjectEntry _entry)
20 {
21 Object (entry:_entry,
22@@ -66,6 +68,8 @@
23 bg.opacity = 0;
24 bg.show ();
25
26+ skip = false;
27+
28 if (entry.image is Gtk.Image)
29 {
30 image = new Ctk.Image (22);
31@@ -97,6 +101,41 @@
32 image.hide ();
33 }
34
35+ if ((entry.image.get_flags () & Gtk.WidgetFlags.SENSITIVE) != 0)
36+ {
37+ this.reactive = true;
38+ this.skip = false;
39+ image.opacity = 255;
40+ }
41+ else
42+ {
43+ this.reactive = false;
44+ this.skip = true;
45+ image.opacity = 64;
46+ }
47+
48+ entry.image.notify["sensitive"].connect (() =>
49+ {
50+ if ((entry.image.get_flags () & Gtk.WidgetFlags.SENSITIVE) != 0)
51+ {
52+ this.reactive = true;
53+ this.skip = false;
54+ image.animate (Clutter.AnimationMode.EASE_OUT_QUAD,
55+ 200,
56+ "opacity",
57+ 255);
58+ }
59+ else
60+ {
61+ this.reactive = false;
62+ this.skip = true;
63+ image.animate (Clutter.AnimationMode.EASE_OUT_QUAD,
64+ 200,
65+ "opacity",
66+ 64);
67+ }
68+ });
69+
70 entry.image.notify["visible"].connect (() =>
71 {
72 if (entry.image != null)
73@@ -170,6 +209,41 @@
74 text.hide ();
75 }
76
77+ if ((entry.label.get_flags () & Gtk.WidgetFlags.SENSITIVE) != 0)
78+ {
79+ this.reactive = true;
80+ this.skip = false;
81+ text.opacity = 255;
82+ }
83+ else
84+ {
85+ this.reactive = false;
86+ this.skip = true;
87+ text.opacity = 64;
88+ }
89+
90+ entry.label.notify["sensitive"].connect (() =>
91+ {
92+ if ((entry.label.get_flags () & Gtk.WidgetFlags.SENSITIVE) != 0)
93+ {
94+ this.reactive = true;
95+ this.skip = false;
96+ text.animate (Clutter.AnimationMode.EASE_OUT_QUAD,
97+ 200,
98+ "opacity",
99+ 255);
100+ }
101+ else
102+ {
103+ this.reactive = false;
104+ this.skip = true;
105+ text.animate (Clutter.AnimationMode.EASE_OUT_QUAD,
106+ 200,
107+ "opacity",
108+ 64);
109+ }
110+ });
111+
112 entry.label.notify["visible"].connect (() =>
113 {
114 if (entry.label != null)
115
116=== modified file 'unity-private/panel/panel-indicator-object-view.vala'
117--- unity-private/panel/panel-indicator-object-view.vala 2010-08-21 12:48:10 +0000
118+++ unity-private/panel/panel-indicator-object-view.vala 2010-09-15 13:41:49 +0000
119@@ -114,6 +114,25 @@
120 }
121
122 IndicatorObjectEntryView next_object_entry_view = this.indicator_entry_array.get (pos);
123+ if (next_object_entry_view.skip)
124+ {
125+ if (type == Gtk.MenuDirectionType.PARENT)
126+ {
127+ if (pos == 0)
128+ next_object_entry_view = this.indicator_entry_array.get (this.indicator_entry_array.size - 1);
129+ else
130+ next_object_entry_view = this.indicator_entry_array.get (pos-1);
131+
132+ }
133+ else if (type == Gtk.MenuDirectionType.CHILD)
134+ {
135+ if (pos == this.indicator_entry_array.size - 1)
136+ next_object_entry_view = this.indicator_entry_array.get (0);
137+ else
138+ next_object_entry_view = this.indicator_entry_array.get (pos+1);
139+ }
140+ }
141+
142 next_object_entry_view.show_menu ();
143 /* Signal to be picked up by IndicatorBar */
144 //this.menu_moved (type);