Slingshot App Launcher

Merge lp:~jeremywootten/slingshot/fix-1213321 into lp:slingshot

Proposed by Jeremy Wootten on 2013-08-26
Status: Merged
Approved by: David Gomes on 2013-09-30
Approved revision: 381
Merged at revision: 386
Proposed branch: lp:~jeremywootten/slingshot/fix-1213321
Merge into: lp:slingshot
Diff against target: 377 lines (+60/-49) 3 files modified
To merge this branch: bzr merge lp:~jeremywootten/slingshot/fix-1213321
Reviewer Review Type Date Requested Status
if (community) Needs Fixing on 2013-10-01
David Gomes 2013-08-26 Approve on 2013-09-30
elementary Pantheon team 2013-08-26 Pending
Review via email: mp+182058@code.launchpad.net

Commit Message

Prevents infinite loop in key_press_event handling when an input manager (ibus) is active, which appears to be due to a bug in either Gtk3 or ibus, by using an event box and custom handler rather than overriding the default handler.

Two other minor changes:
1) prevent some critical error messages when apps have no keywords.
2) prevent critical error message due to empty_cat_label not being created.

Fixes bug #1213321.

Description of the Change

Prevents infinite loop in key_press_event handling when an input manager (ibus) is active, which appears to be due to a bug in either Gtk3 or ibus, by using an event box and custom handler rather than overriding the default handler.

Two other minor changes:
1) prevent some critical error messages when apps have no keywords.
2) prevent critical error message due to empty_cat_label not being created.

To post a comment you must log in.

I see old code is commented out but there's no explanation why. The revision control system already takes care of storing old code, so this is not needed.

I'd very much prefer the code comments to explain why this new code is needed.

David Gomes (davidgomes) wrote :

Very much agree with Shnatsel here. Only in rare occasions does code need to be commented, and this doesn't seem like one of those.

Besides, I approve of using the EventBox and the code style.

Jeremy Wootten (jeremywootten) wrote :

The reason I left the old code in was in case you wanted to revert to the
old method if and when the Gtk/ibus bug is fixed, but I can take it out. I
will also put in some comments as you suggest.

thanks for the review

On 26 August 2013 14:06, David Gomes <email address hidden> wrote:

> Very much agree with Shnatsel here. Only in rare occasions does code need
> to be commented, and this doesn't seem like one of those.
>
> Besides, I approve of using the EventBox and the code style.
> --
>
> https://code.launchpad.net/~jeremywootten/slingshot/fix-1213321/+merge/182058
> You are the owner of lp:~jeremywootten/slingshot/fix-1213321.
>

--
Jeremy Wootten
GPG Key ID CB585BCD
Key Fingerprint 37C0 3C2A A6D4 E45B BA7C 4328 2DF2 1882 CB58 5BCD

377. By Jeremy Wootten on 2013-08-26

remove old code, add comment

David Gomes (davidgomes) wrote :
review: Needs Fixing
Jeremy Wootten (jeremywootten) wrote :

OK, but the Elementary coding style guide says that comments should be
indented along with the code. Your example is only indented by one space.
 Is that intentional?

On 30 August 2013 09:15, David Gomes <email address hidden> wrote:

> Review: Needs Fixing
>
> https://gist.github.com/davidgomes/97279fe877acf8421fe9
>
> Try that please.
> --
>
> https://code.launchpad.net/~jeremywootten/slingshot/fix-1213321/+merge/182058
> You are the owner of lp:~jeremywootten/slingshot/fix-1213321.
>

--
Jeremy Wootten
GPG Key ID CB585BCD
Key Fingerprint 37C0 3C2A A6D4 E45B BA7C 4328 2DF2 1882 CB58 5BCD

David Gomes (davidgomes) wrote :

It should be the current level of indentation + 2 spaces I believe.

Jeremy Wootten (jeremywootten) wrote :

OK, so is this correct in this case (8 + 2 spaces indentation of comment
text)?

.
.
.
        }

        /*
          Overriding the default handler results in infinite loop of error
messages
          when an input method is in use (Gtk3 bug?). Key press events are
          captured by an Event Box and passed to this function instead.
          Events not dealt with here are propagated to the searchbar by the
          usual mechanism.
        */
        public bool on_key_press (Gdk.EventKey event) {
.
.
.
.

On 30 August 2013 19:02, David Gomes <email address hidden> wrote:

> It should be the current level of indentation + 2 spaces I believe.
> --
>
> https://code.launchpad.net/~jeremywootten/slingshot/fix-1213321/+merge/182058
> You are the owner of lp:~jeremywootten/slingshot/fix-1213321.
>

--
Jeremy Wootten
GPG Key ID CB585BCD
Key Fingerprint 37C0 3C2A A6D4 E45B BA7C 4328 2DF2 1882 CB58 5BCD

David Gomes (davidgomes) wrote :

+ /*Overriding the default handler results in infinite loop of error messages
+ * when an input method is in use (Gtk3 bug?). Key press events are
+ * captured by an Event Box and passed to this function instead.
+ * Events not dealt with here are propagated to the searchbar by the
+ * usual mechanism.
+ */

+ /*
+ * Overriding the default handler results in infinite loop of error messages
+ * when an input method is in use (Gtk3 bug?). Key press events are
+ * captured by an Event Box and passed to this function instead.
+
+ * Events not dealt with here are propagated to the searchbar by the
+ * usual mechanism.
+ */

I'd prefer that and then I approve. Besides, I don't want this merged without testing (both on people experiencing the bug and people who don't use ibus and never experienced the bug).

review: Needs Fixing
Jeremy Wootten (jeremywootten) wrote :

Did you want asterisks on each line? Your original suggestion did not have
them but this one does.

I agree that thorough testing by others first is advisable.

On 4 September 2013 13:27, David Gomes <email address hidden> wrote:

> Review: Needs Fixing
>
> + /*Overriding the default handler results in infinite loop of error
> messages
> + * when an input method is in use (Gtk3 bug?). Key press events are
> + * captured by an Event Box and passed to this function instead.
> + * Events not dealt with here are propagated to the searchbar by the
> + * usual mechanism.
> + */
>
> + /*
> + * Overriding the default handler results in infinite loop of error
> messages
> + * when an input method is in use (Gtk3 bug?). Key press events are
> + * captured by an Event Box and passed to this function instead.
> +
> + * Events not dealt with here are propagated to the searchbar by the
> + * usual mechanism.
> + */
>
> I'd prefer that and then I approve. Besides, I don't want this merged
> without testing (both on people experiencing the bug and people who don't
> use ibus and never experienced the bug).
> --
>
> https://code.launchpad.net/~jeremywootten/slingshot/fix-1213321/+merge/182058
> You are the owner of lp:~jeremywootten/slingshot/fix-1213321.
>

--
Jeremy Wootten
GPG Key ID CB585BCD
Key Fingerprint 37C0 3C2A A6D4 E45B BA7C 4328 2DF2 1882 CB58 5BCD

David Gomes (davidgomes) wrote :

Oh, shit I don't, I'm dumb sometimes:

+ /*
+ Overriding the default handler results in infinite loop of error messages
+ when an input method is in use (Gtk3 bug?). Key press events are
+ captured by an Event Box and passed to this function instead.
+
+ Events not dealt with here are propagated to the searchbar by the
+ usual mechanism.
+ */

David Gomes (davidgomes) wrote :

+ /*
+ Overriding the default handler results in infinite loop of error messages
+ when an input method is in use (Gtk3 bug?). Key press events are
+ captured by an Event Box and passed to this function instead.
+
+ Events not dealt with here are propagated to the searchbar by the
+ usual mechanism.
+ */

David Gomes (davidgomes) wrote :

Launchpad is dumb - http://pastie.org/8298305 that's what I want.

378. By Jeremy Wootten on 2013-09-06

reformat comment

379. By Jeremy Wootten on 2013-09-06

Merge changes from trunk revision 378

Jeremy Wootten (jeremywootten) wrote :

OK, done. I have also merged changes from trunk up to revision 378 and
resolved conflicts

On 4 September 2013 19:47, David Gomes <email address hidden> wrote:

> Launchpad is dumb - http://pastie.org/8298305 that's what I want.
> --
>
> https://code.launchpad.net/~jeremywootten/slingshot/fix-1213321/+merge/182058
> You are the owner of lp:~jeremywootten/slingshot/fix-1213321.
>

--
Jeremy Wootten
GPG Key ID CB585BCD
Key Fingerprint 37C0 3C2A A6D4 E45B BA7C 4328 2DF2 1882 CB58 5BCD

David Gomes (davidgomes) wrote :

I approve of the code now, but I believe this needs testing.

review: Approve

I'll be running this version daily. I don't use iBus, so I'll look out for regressions.

This still needs verification from an iBus user. To test this fix, run:
sudo apt-get install elementary-testing-scripts
elementary-test-merge https://code.launchpad.net/~jeremywootten/slingshot/fix-1213321/+merge/182058

David Gomes (davidgomes) wrote :

It still doesn't fix focus 100% of times on Ubuntu 13.10, I think ibus is still ruining it.

Anyway, a branch got merged in this afternoon that makes it so that the Escape key hides slingshot if the search bar is empty, but clears the search bar if there's text on the search bar.

I branched trunk (lp:slingshot) and the bzr merged this branch and it breaks that new functionality.

review: Needs Fixing

iBus is not the only thing that causes focus issues. There seems to be a race condition or something as well. There was a branch floating around that fixed it.

Also, I haven't spotted any regressions against the current bzr trunk.

David Gomes (davidgomes) wrote :

So if you merge this with the latest trunk you can use Escape to hide Slingshot?

Jeremy Wootten (jeremywootten) wrote :

This branch was only intended to allow text entry into the search bar when
ibus was running. It was not intended to address the focus issues which, I
think, were pre-existing and not necessarily related to ibus. I have been
advised to keep branches "atomic".

I'll merge trunk and make sure this branch is compatible with the new
functionality.

On 10 September 2013 18:56, David Gomes <email address hidden> wrote:

> Review: Needs Fixing
>
> It still doesn't fix focus 100% of times on Ubuntu 13.10, I think ibus is
> still ruining it.
>
> Anyway, a branch got merged in this afternoon that makes it so that the
> Escape key hides slingshot if the search bar is empty, but clears the
> search bar if there's text on the search bar.
>
> I branched trunk (lp:slingshot) and the bzr merged this branch and it
> breaks that new functionality.
> --
>
> https://code.launchpad.net/~jeremywootten/slingshot/fix-1213321/+merge/182058
> You are the owner of lp:~jeremywootten/slingshot/fix-1213321.
>

--
Jeremy Wootten
GPG Key ID CB585BCD
Key Fingerprint 37C0 3C2A A6D4 E45B BA7C 4328 2DF2 1882 CB58 5BCD

380. By Jeremy Wootten on 2013-09-10

Merge from trung up to revision 382

381. By Jeremy Wootten on 2013-09-10

Make recent changes in trunk compatible with this branch

Jeremy Wootten (jeremywootten) wrote :

I have now made the latest changes in trunk compatible with this branch
(only one line required changing). The "Escape" function did not require
changing but the "Shift-Ctrl-V" function did. Changes to the "on_key_press"
function in SlingshotView.vala in trunk could be incompatible with this
branch. In this branch "return base.key_press_event (event);" is not used
in the switch - it is replaced with "break;"

On 10 September 2013 19:37, David Gomes <email address hidden> wrote:

> So if you merge this with the latest trunk you can use Escape to hide
> Slingshot?
> --
>
> https://code.launchpad.net/~jeremywootten/slingshot/fix-1213321/+merge/182058
> You are the owner of lp:~jeremywootten/slingshot/fix-1213321.
>

--
Jeremy Wootten
GPG Key ID CB585BCD
Key Fingerprint 37C0 3C2A A6D4 E45B BA7C 4328 2DF2 1882 CB58 5BCD

Jeremy Wootten (jeremywootten) wrote :

Hello David

Your review of this branch is still "Needs Fixing" - I am not sure what the
outstanding problem is?

On 10 September 2013 19:37, David Gomes <email address hidden> wrote:

> So if you merge this with the latest trunk you can use Escape to hide
> Slingshot?
> --
>
> https://code.launchpad.net/~jeremywootten/slingshot/fix-1213321/+merge/182058
> You are the owner of lp:~jeremywootten/slingshot/fix-1213321.
>

--
Jeremy Wootten
GPG Key ID CB585BCD
Key Fingerprint 37C0 3C2A A6D4 E45B BA7C 4328 2DF2 1882 CB58 5BCD

David Gomes (davidgomes) :
review: Approve
if (ifshuaishuai) wrote :

hi,I tested this fix, and i found out it doesn't response to ENTER key, cause public bool on_key_press (Gdk.EventKey event) will never be called when only ENTER pressed

review: Needs Fixing
Jeremy Wootten (jeremywootten) wrote :

You are right! I always selected the application with the mouse so did not
notice this. I will look into this.

On 1 October 2013 08:43, if <email address hidden> wrote:

> Review: Needs Fixing
>
> hi,I tested this fix, and i found out it doesn't response to ENTER key,
> cause public bool on_key_press (Gdk.EventKey event) will never be called
> when only ENTER pressed
> --
>
> https://code.launchpad.net/~jeremywootten/slingshot/fix-1213321/+merge/182058
> You are the owner of lp:~jeremywootten/slingshot/fix-1213321.
>

--
Jeremy Wootten
GPG Key ID CB585BCD
Key Fingerprint 37C0 3C2A A6D4 E45B BA7C 4328 2DF2 1882 CB58 5BCD

if (ifshuaishuai) wrote :

what i did for fixing this, I'm not familiar with vala, is keep the code
handles the KP_Enter remains in the
public override bool key_press_event (Gdk.EventKey event)
{

// only deal with KP_Enter

}
and other code is exactly you fixed. I know it is bad fix, but that seems
work fine.

2013/10/2 Jeremy Wootten <email address hidden>

> You are right! I always selected the application with the mouse so did not
> notice this. I will look into this.
>
>
> On 1 October 2013 08:43, if <email address hidden> wrote:
>
> > Review: Needs Fixing
> >
> > hi,I tested this fix, and i found out it doesn't response to ENTER key,
> > cause public bool on_key_press (Gdk.EventKey event) will never be called
> > when only ENTER pressed
> > --
> >
> >
> https://code.launchpad.net/~jeremywootten/slingshot/fix-1213321/+merge/182058
> > You are the owner of lp:~jeremywootten/slingshot/fix-1213321.
> >
>
>
>
> --
> Jeremy Wootten
> GPG Key ID CB585BCD
> Key Fingerprint 37C0 3C2A A6D4 E45B BA7C 4328 2DF2 1882 CB58 5BCD
>
>
> https://code.launchpad.net/~jeremywootten/slingshot/fix-1213321/+merge/182058
> You are reviewing the proposed merge of
> lp:~jeremywootten/slingshot/fix-1213321 into lp:slingshot.
>

Jeremy Wootten (jeremywootten) wrote :

Thanks for this. I have uploaded a different fix already - I dealt with
the Enter key-press by connecting to the activate signal of the searchbar
instead. I am waiting to see whether anyone finds a flaw in this approach
and will bear your alternative solution in mind.

best regards

On 7 October 2013 19:36, if <email address hidden> wrote:

> what i did for fixing this, I'm not familiar with vala, is keep the code
> handles the KP_Enter remains in the
> public override bool key_press_event (Gdk.EventKey event)
> {
>
> // only deal with KP_Enter
>
> }
> and other code is exactly you fixed. I know it is bad fix, but that seems
> work fine.
>
>
> 2013/10/2 Jeremy Wootten <email address hidden>
>
> > You are right! I always selected the application with the mouse so did
> not
> > notice this. I will look into this.
> >
> >
> > On 1 October 2013 08:43, if <email address hidden> wrote:
> >
> > > Review: Needs Fixing
> > >
> > > hi,I tested this fix, and i found out it doesn't response to ENTER key,
> > > cause public bool on_key_press (Gdk.EventKey event) will never be
> called
> > > when only ENTER pressed
> > > --
> > >
> > >
> >
> https://code.launchpad.net/~jeremywootten/slingshot/fix-1213321/+merge/182058
> > > You are the owner of lp:~jeremywootten/slingshot/fix-1213321.
> > >
> >
> >
> >
> > --
> > Jeremy Wootten
> > GPG Key ID CB585BCD
> > Key Fingerprint 37C0 3C2A A6D4 E45B BA7C 4328 2DF2 1882 CB58 5BCD
> >
> >
> >
> https://code.launchpad.net/~jeremywootten/slingshot/fix-1213321/+merge/182058
> > You are reviewing the proposed merge of
> > lp:~jeremywootten/slingshot/fix-1213321 into lp:slingshot.
> >
>
> --
>
> https://code.launchpad.net/~jeremywootten/slingshot/fix-1213321/+merge/182058
> You are the owner of lp:~jeremywootten/slingshot/fix-1213321.
>

--
Jeremy Wootten
GPG Key ID CB585BCD
Key Fingerprint 37C0 3C2A A6D4 E45B BA7C 4328 2DF2 1882 CB58 5BCD

Preview Diff

1=== modified file 'src/Backend/AppSystem.vala'
2--- src/Backend/AppSystem.vala 2013-06-12 21:40:32 +0000
3+++ src/Backend/AppSystem.vala 2013-09-10 20:47:16 +0000
4@@ -77,9 +77,9 @@
5 }
6
7 }
8-
9+
10 private void update_popularity () {
11-
12+
13 foreach (ArrayList<App> category in apps.values)
14 foreach (App app in category)
15 app.popularity = rl_service.get_app_popularity (app.desktop_id);
16@@ -199,7 +199,7 @@
17 * more priority to app.name
18 **/
19 string[] sorted_apps_execs = {};
20-
21+
22 foreach (ArrayList<App> category in apps.values) {
23 foreach (App app in category) {
24 if (!(app.exec in sorted_apps_execs)) {
25@@ -219,7 +219,7 @@
26 } else if (search in app.generic_name.down ()) {
27 app.relevancy = app.generic_name.length / search.length - app.popularity;
28 filtered.add (app);
29- } else {
30+ } else if (app.keywords != null) {
31 app.relevancy = 0;
32 foreach (string keyword in app.keywords) {
33 foreach (string search_word in search.split (" ")) {
34
35=== modified file 'src/SlingshotView.vala'
36--- src/SlingshotView.vala 2013-09-10 15:01:45 +0000
37+++ src/SlingshotView.vala 2013-09-10 20:47:16 +0000
38@@ -52,6 +52,7 @@
39 public Gtk.Grid bottom;
40 public Gtk.Grid container;
41 public Gtk.Box content_area;
42+ private Gtk.EventBox event_box;
43
44 public AppSystem app_system;
45 private ArrayList<TreeDirectory> categories;
46@@ -215,9 +216,11 @@
47 container.attach (Utils.set_padding (center, 0, 12, 12, 12), 0, 1, 1, 1);
48 container.attach (Utils.set_padding (bottom, 0, 24, 12, 24), 0, 2, 1, 1);
49
50+ event_box = new Gtk.EventBox ();
51+ event_box.add (container);
52 // Add the container to the dialog's content area
53 content_area = get_content_area () as Box;
54- content_area.pack_start (container);
55+ content_area.pack_start (event_box);
56
57 if (Slingshot.settings.use_category)
58 set_modality (Modality.CATEGORY_VIEW);
59@@ -236,6 +239,7 @@
60
61 //view_manager.draw.connect (this.draw_background);
62
63+ event_box.key_press_event.connect (on_key_press);
64 searchbar.text_changed_pause.connect ((text) => this.search (text));
65 searchbar.grab_focus ();
66
67@@ -246,7 +250,7 @@
68 populate_grid_view ();
69
70 page_switcher.active_changed.connect (() => {
71-
72+
73 move_page (page_switcher.active - page_switcher.old_active);
74 searchbar.grab_focus (); //avoid focus is not on current page
75 });
76@@ -284,7 +288,7 @@
77 private void reposition (bool show=true) {
78
79 debug("Repositioning");
80-
81+
82 Gdk.Rectangle monitor_dimensions, app_launcher_pos;
83 screen.get_monitor_geometry (this.screen.get_primary_monitor(), out monitor_dimensions);
84 app_launcher_pos = Gdk.Rectangle () { x = monitor_dimensions.x,
85@@ -306,8 +310,15 @@
86 }
87 }
88
89- public override bool key_press_event (Gdk.EventKey event) {
90+ /*
91+ Overriding the default handler results in infinite loop of error messages
92+ when an input method is in use (Gtk3 bug?). Key press events are
93+ captured by an Event Box and passed to this function instead.
94
95+ Events not dealt with here are propagated to the searchbar by the
96+ usual mechanism.
97+ */
98+ public bool on_key_press (Gdk.EventKey event) {
99 var key = Gdk.keyval_name (event.keyval).replace ("KP_", "");
100
101 event.state &= (Gdk.ModifierType.SHIFT_MASK |
102@@ -347,7 +358,7 @@
103 case "Alt_L":
104 case "Alt_R":
105 break;
106-
107+
108 case "0":
109 case "1":
110 case "2":
111@@ -357,12 +368,12 @@
112 case "6":
113 case "7":
114 case "8":
115- case "9":
116+ case "9":
117 int page = int.parse (key) - 1;
118-
119- if (event.state != Gdk.ModifierType.MOD1_MASK)
120- return base.key_press_event (event);
121-
122+
123+ if (event.state != Gdk.ModifierType.MOD1_MASK)
124+ return false;
125+
126 if (modality == Modality.NORMAL_VIEW) {
127 if (page < 0 || page == 8)
128 page_switcher.set_active (grid_view.get_n_pages () - 1);
129@@ -374,7 +385,7 @@
130 else
131 category_view.switcher.set_active (page);
132 } else {
133- return base.key_press_event (event);
134+ return false;
135 }
136 searchbar.grab_focus ();
137 break;
138@@ -392,7 +403,7 @@
139 new_focus.grab_focus ();
140 }
141 break;
142-
143+
144 case "Left":
145 if (modality == Modality.NORMAL_VIEW) {
146 if (event.state == Gdk.ModifierType.SHIFT_MASK) // Shift + Left
147@@ -406,9 +417,9 @@
148 category_move_focus (-1, 0);
149 }
150 } else
151- return base.key_press_event (event);
152+ return false;
153 break;
154-
155+
156 case "Right":
157 if (modality == Modality.NORMAL_VIEW) {
158 if (event.state == Gdk.ModifierType.SHIFT_MASK) // Shift + Right
159@@ -423,10 +434,10 @@
160 else //the user has already selected an AppEntry
161 category_move_focus (+1, 0);
162 } else {
163- return base.key_press_event (event);
164+ return false;
165 }
166 break;
167-
168+
169 case "Up":
170 if (modality == Modality.NORMAL_VIEW) {
171 normal_move_focus (0, -1);
172@@ -492,17 +503,17 @@
173 if (event.state == Gdk.ModifierType.SHIFT_MASK) { // Shift + Delete
174 searchbar.text = "";
175 } else if (searchbar.has_focus) {
176- return base.key_press_event (event);
177+ return false;
178 } else {
179 searchbar.grab_focus ();
180 searchbar.move_cursor (Gtk.MovementStep.BUFFER_ENDS, 0, false);
181- return base.key_press_event (event);
182+ return false;
183 }
184 break;
185-
186+
187 case "Home":
188 if (searchbar.text.size () > 0) {
189- return base.key_press_event (event);
190+ return false;
191 }
192
193 if (modality == Modality.NORMAL_VIEW) {
194@@ -512,10 +523,10 @@
195 top_left_focus ();
196 }
197 break;
198-
199+
200 case "End":
201 if (searchbar.text.size () > 0) {
202- return base.key_press_event (event);
203+ return false;
204 }
205
206 if (modality == Modality.NORMAL_VIEW) {
207@@ -531,15 +542,14 @@
208 if ((event.state & (Gdk.ModifierType.CONTROL_MASK | Gdk.ModifierType.SHIFT_MASK)) != 0) {
209 searchbar.paste_clipboard ();
210 }
211-
212- return base.key_press_event (event);
213+ break;
214
215 default:
216 if (!searchbar.has_focus) {
217 searchbar.grab_focus ();
218 searchbar.move_cursor (Gtk.MovementStep.BUFFER_ENDS, 0, false);
219 }
220- return base.key_press_event (event);
221+ return false;
222
223 }
224
225@@ -595,19 +605,19 @@
226 Wnck.Screen.get_default ().force_update ();
227 if (w != null)
228 w.activate (Gdk.x11_get_server_time (this.get_window ()));
229- }
230+ }
231
232 private void move_page (int step) {
233-
234+
235 debug ("Moving: step = " + step.to_string ());
236-
237+
238 if (step == 0)
239 return;
240 if (step < 0 && current_position >= 0) //Left border
241 return;
242 if (step > 0 && (-current_position) >= ((grid_view.get_n_pages () - 1) * grid_view.get_page_columns () * 130)) //Right border
243 return;
244-
245+
246 int count = 0;
247 int increment = -step * 130 * columns / 10;
248 Timeout.add (30 / columns, () => {
249@@ -617,12 +627,12 @@
250 view_manager.move (grid_view, current_position, 0);
251 return false;
252 }
253-
254+
255 current_position += increment;
256 view_manager.move (grid_view, current_position, 0);
257 count++;
258 return true;
259-
260+
261 }, Priority.DEFAULT_IDLE);
262 }
263
264@@ -723,13 +733,13 @@
265 search_view_position = 0;
266 view_manager.move (search_view, 0, search_view_position);
267 search_view.hide_all ();
268-
269+
270 var filtered = yield app_system.search_results (stripped);
271
272 foreach (App app in filtered) {
273 search_view.show_app (app);
274 }
275-
276+
277 search_view.add_command (text);
278
279 }
280@@ -749,7 +759,7 @@
281 grid_view.append (app_entry);
282 app_entry.show_all ();
283 }
284-
285+
286 view_manager.move (grid_view, 0, 0);
287 current_position = 0;
288
289
290=== modified file 'src/Widgets/CategoryView.vala'
291--- src/Widgets/CategoryView.vala 2013-02-22 17:17:35 +0000
292+++ src/Widgets/CategoryView.vala 2013-09-10 20:47:16 +0000
293@@ -64,6 +64,7 @@
294
295 app_view = new Widgets.Grid (view.rows, view.columns - 1);
296 layout.put (app_view, 0, 0);
297+ empty_cat_label = new Gtk.Label ("");
298 layout.put (empty_cat_label, view.columns*130, view.rows * 130 / 2);
299 layout.set_hexpand (true);
300 layout.set_vexpand (true);
301@@ -133,7 +134,7 @@
302 });
303
304 app_view.new_page.connect ((page) => {
305-
306+
307 if (switcher.size == 0)
308 switcher.append ("1");
309 switcher.append (page);
310@@ -151,7 +152,7 @@
311 move_page (switcher.active - switcher.old_active);
312 view.searchbar.grab_focus (); // this is because otherwise focus isn't the current page
313 });
314-
315+
316 category_switcher.selected = 0; //Must be after everything else
317 }
318
319@@ -168,11 +169,11 @@
320
321 switcher.clear_children ();
322 app_view.clear ();
323-
324+
325 layout.move (empty_cat_label, view.columns*130, view.rows*130 / 2);
326 foreach (App app in view.apps[category])
327- add_app (app);
328-
329+ add_app (app);
330+
331 switcher.set_active (0);
332
333 layout.move (app_view, 0, 0);
334@@ -181,16 +182,16 @@
335 }
336
337 public void move_page (int step) {
338-
339+
340 debug ("Moving: step = " + step.to_string ());
341-
342+
343 if (step == 0)
344 return;
345 if (step < 0 && current_position >= 0) //Left border
346 return;
347 if (step > 0 && (-current_position) >= ((app_view.get_n_pages () - 1) * app_view.get_page_columns () * 130)) //Right border
348 return;
349-
350+
351 int count = 0;
352 int increment = -step*130*(view.columns-1)/10;
353 Timeout.add (30/(view.columns-1), () => {
354@@ -200,12 +201,12 @@
355 layout.move (app_view, current_position, 0);
356 return false;
357 }
358-
359+
360 current_position += increment;
361 layout.move (app_view, current_position, 0);
362 count++;
363 return true;
364-
365+
366 }, Priority.DEFAULT_IDLE);
367 }
368
369@@ -220,7 +221,7 @@
370 }
371 else
372 page_switcher.hide ();
373-
374+
375 view.searchbar.grab_focus ();
376
377 }

Subscribers

People subscribed via source and target branches