Merge lp:~unity-team/unity/njpatel-fixes-2010-09-14 into lp:unity

Proposed by Neil J. Patel
Status: Merged
Approved by: Mirco Müller
Approved revision: no longer in the source branch.
Merged at revision: 503
Proposed branch: lp:~unity-team/unity/njpatel-fixes-2010-09-14
Merge into: lp:unity
Diff against target: 276 lines (+100/-12)
9 files modified
unity-private/places/places-default-renderer-group.vala (+1/-1)
unity-private/places/places-default-renderer.vala (+25/-0)
unity-private/places/places-folder-browser-renderer.vala (+16/-5)
unity-private/places/places-place-home-renderer.vala (+5/-0)
unity-private/places/places-place-search-bar.vala (+2/-2)
unity-private/places/places-place-search-sections-bar.vala (+8/-1)
unity-private/places/places-place.vala (+3/-3)
unity-private/places/places-view.vala (+38/-0)
unity/unity-place-renderer.vala (+2/-0)
To merge this branch: bzr merge lp:~unity-team/unity/njpatel-fixes-2010-09-14
Reviewer Review Type Date Requested Status
Mirco Müller (community) Approve
Review via email: mp+35417@code.launchpad.net

Description of the change

Bugs linked

To post a comment you must log in.
Revision history for this message
Mirco Müller (macslow) wrote :

Looking good, compiled, runs... approved.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'unity-private/places/places-default-renderer-group.vala'
2--- unity-private/places/places-default-renderer-group.vala 2010-09-09 09:03:46 +0000
3+++ unity-private/places/places-default-renderer-group.vala 2010-09-14 15:01:01 +0000
4@@ -64,7 +64,7 @@
5 private MoreResultsButton? more_results_button;
6
7 /* Some caching to speed up lookups */
8- private uint n_results = 0;
9+ public uint n_results = 0;
10 private bool dirty = false;
11
12 private bool allow_expand = true;
13
14=== modified file 'unity-private/places/places-default-renderer.vala'
15--- unity-private/places/places-default-renderer.vala 2010-09-03 11:15:21 +0000
16+++ unity-private/places/places-default-renderer.vala 2010-09-14 15:01:01 +0000
17@@ -341,6 +341,31 @@
18
19 }
20
21+ private void activate_default ()
22+ {
23+ var children = box.get_children ();
24+ foreach (Clutter.Actor child in children)
25+ {
26+ DefaultRendererGroup group = child as DefaultRendererGroup;
27+
28+ if (group.n_results > 0)
29+ {
30+ unowned Dee.ModelIter iter = results_model.get_first_iter ();
31+ while (!results_model.is_last (iter))
32+ {
33+ if (results_model.get_uint (iter, 2) == group.group_id)
34+ {
35+ activated (results_model.get_string (iter, 0),
36+ results_model.get_string (iter, 3));
37+ break;
38+ }
39+ iter = results_model.next (iter);
40+ }
41+ break;
42+ }
43+ }
44+ }
45+
46 private void on_group_added (Dee.Model model, Dee.ModelIter iter)
47 {
48 string renderer = model.get_string (iter, 0);
49
50=== modified file 'unity-private/places/places-folder-browser-renderer.vala'
51--- unity-private/places/places-folder-browser-renderer.vala 2010-07-28 22:48:11 +0000
52+++ unity-private/places/places-folder-browser-renderer.vala 2010-09-14 15:01:01 +0000
53@@ -26,6 +26,7 @@
54
55 private Ctk.VBox box;
56 private Dee.Model results_model;
57+ private DefaultRendererGroup group;
58
59 public FolderBrowserRenderer ()
60 {
61@@ -51,14 +52,24 @@
62 {
63 results_model = results;
64
65- var group = new DefaultRendererGroup (0,
66- "UnityFolderGroupRenderer",
67- "__you_cant_see_me__",
68- "gtk-apply",
69- results);
70+ group = new DefaultRendererGroup (0,
71+ "UnityFolderGroupRenderer",
72+ "__you_cant_see_me__",
73+ "gtk-apply",
74+ results);
75
76 group.activated.connect ((u, m) => { activated (u, m); } );
77 box.pack (group, false, true);
78 }
79+
80+ public void activate_default ()
81+ {
82+ if (group.n_results > 0)
83+ {
84+ unowned Dee.ModelIter iter = results_model.get_first_iter ();
85+ activated (results_model.get_string (iter, 0),
86+ results_model.get_string (iter, 3));
87+ }
88+ }
89 }
90 }
91
92=== modified file 'unity-private/places/places-place-home-renderer.vala'
93--- unity-private/places/places-place-home-renderer.vala 2010-09-02 19:19:10 +0000
94+++ unity-private/places/places-place-home-renderer.vala 2010-09-14 15:01:01 +0000
95@@ -128,6 +128,11 @@
96
97 }
98
99+ public void activate_default ()
100+ {
101+
102+ }
103+
104 /*
105 * Private Methods
106 */
107
108=== modified file 'unity-private/places/places-place-search-bar.vala'
109--- unity-private/places/places-place-search-bar.vala 2010-08-26 06:57:58 +0000
110+++ unity-private/places/places-place-search-bar.vala 2010-09-14 15:01:01 +0000
111@@ -30,8 +30,8 @@
112 private PlaceSearchBarBackground bg;
113
114 private PlaceSearchNavigation navigation;
115- private PlaceSearchEntry entry;
116- private PlaceSearchSectionsBar sections;
117+ public PlaceSearchEntry entry;
118+ public PlaceSearchSectionsBar sections;
119
120 public PlaceSearchBar ()
121 {
122
123=== modified file 'unity-private/places/places-place-search-sections-bar.vala'
124--- unity-private/places/places-place-search-sections-bar.vala 2010-08-26 07:52:44 +0000
125+++ unity-private/places/places-place-search-sections-bar.vala 2010-09-14 15:01:01 +0000
126@@ -47,6 +47,7 @@
127
128 private PlaceEntry? active_entry = null;
129 private Section? active_section = null;
130+ public uint active_section_n = 0;
131 private CairoCanvas bg;
132
133 private unowned Dee.Model? sections_model = null;
134@@ -81,7 +82,10 @@
135 unowned Section? section = list.nth_data<unowned Clutter.Actor>(section_id) as Section;
136
137 if (section is Section)
138- on_section_clicked_real (section);
139+ {
140+ on_section_clicked_real (section);
141+ active_section_n = section_id;
142+ }
143 }
144
145 public void set_active_entry (PlaceEntry entry)
146@@ -190,6 +194,7 @@
147 active_section = section;
148 section.active = true;
149 active_entry.set_active_section (0);
150+ active_section_n = 0;
151 }
152
153 sort_children ((CompareFunc)sort_sections);
154@@ -222,6 +227,7 @@
155 {
156 active_section = get_section_for_iter (model.get_first_iter ());
157 active_entry.set_active_section (0);
158+ active_section_n = 0;
159 }
160 section.start_destroy ();
161 }
162@@ -234,6 +240,7 @@
163 active_section.active = true;
164 var pos = active_section.model.get_position (active_section.iter);
165 active_entry.set_active_section (pos);
166+ active_section_n = pos;
167
168 bg.update ();
169 }
170
171=== modified file 'unity-private/places/places-place.vala'
172--- unity-private/places/places-place.vala 2010-09-14 12:00:51 +0000
173+++ unity-private/places/places-place.vala 2010-09-14 15:01:01 +0000
174@@ -253,8 +253,7 @@
175 }
176 }
177
178- /* Private Methods */
179- private async void activate_fallback (string uri)
180+ public static async void activate_fallback (string uri)
181 {
182 if (uri.has_prefix ("application://"))
183 {
184@@ -298,7 +297,8 @@
185 warning ("Unable to launch: %s\n", eee.message);
186 }
187 }
188-
189+
190+ /* Private Methods */
191 private void on_service_entry_added (dynamic DBus.Object dbus_object,
192 ValueArray info)
193 {
194
195=== modified file 'unity-private/places/places-view.vala'
196--- unity-private/places/places-view.vala 2010-09-02 19:19:10 +0000
197+++ unity-private/places/places-view.vala 2010-09-14 15:01:01 +0000
198@@ -47,6 +47,8 @@
199 construct
200 {
201 about_to_show ();
202+
203+ shell.get_stage ().captured_event.connect (on_stage_event_captured);
204 }
205
206 public void about_to_show ()
207@@ -71,6 +73,11 @@
208 search_bar = new PlaceSearchBar ();
209 content_box.pack (search_bar, false, true);
210 search_bar.show ();
211+ search_bar.entry.text.captured_event.connect (on_stage_event_captured);
212+ search_bar.entry.text.activatable = true;
213+ search_bar.entry.text.activate.connect (() => {
214+ renderer.activate_default ();
215+ });
216
217 layered_bin = new LayeredBin ();
218 content_box.pack (layered_bin, true, true);
219@@ -176,6 +183,13 @@
220
221 private void on_result_activated (string uri, string mimetype)
222 {
223+ if (active_entry.parent is Place == false)
224+ {
225+ Place.activate_fallback.begin (uri);
226+ global_shell.hide_unity ();
227+ return;
228+ }
229+
230 ActivationStatus result = active_entry.parent.activate (uri, mimetype);
231
232 switch (result)
233@@ -192,6 +206,30 @@
234 break;
235 }
236 }
237+
238+ private bool on_stage_event_captured (Clutter.Event event)
239+ {
240+ if (event.type == Clutter.EventType.KEY_PRESS)
241+ {
242+ var ev = event.key;
243+
244+ if (ev.keyval == 0xff1b) /* Escape */
245+ {
246+ /* Try and do a context pop */
247+ if (search_bar.sections.active_section_n != 0)
248+ {
249+ search_bar.sections.set_active_section (0);
250+ }
251+ else
252+ {
253+ shell.hide_unity ();
254+ }
255+ return true;
256+ }
257+ }
258+
259+ return false;
260+ }
261 }
262 }
263
264
265=== modified file 'unity/unity-place-renderer.vala'
266--- unity/unity-place-renderer.vala 2010-07-28 22:48:11 +0000
267+++ unity/unity-place-renderer.vala 2010-09-14 15:01:01 +0000
268@@ -30,6 +30,8 @@
269 Dee.Model results,
270 Gee.HashMap<string, string> hints);
271
272+ public abstract void activate_default ();
273+
274 public signal void activated (string uri, string mimetype);
275 }
276 }