Merge lp:~xapantu/switchboard/fix-selection into lp:~elementary-pantheon/switchboard/switchboard

Proposed by xapantu
Status: Merged
Approved by: Raphael Isemann
Approved revision: 480
Merged at revision: 479
Proposed branch: lp:~xapantu/switchboard/fix-selection
Merge into: lp:~elementary-pantheon/switchboard/switchboard
Diff against target: 50 lines (+10/-12)
1 file modified
src/CategoryView.vala (+10/-12)
To merge this branch: bzr merge lp:~xapantu/switchboard/fix-selection
Reviewer Review Type Date Requested Status
Raphael Isemann (community) functionality, code-style Approve
Review via email: mp+229913@code.launchpad.net

Commit message

Fixed a bug: Long clicking plugs would enter the plug and then allow the plug to handle the signal too.

To post a comment you must log in.
480. By xapantu

Code style

Revision history for this message
Raphael Isemann (teemperor) wrote :

Works, no regressions with the other plugs. It also resolved the ugly fact that just holding a button enters a plug which wasn't fitting with the behaviour of a normal button for example.

review: Approve (functionality, code-style)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/CategoryView.vala'
2--- src/CategoryView.vala 2014-07-22 00:15:56 +0000
3+++ src/CategoryView.vala 2014-08-07 09:48:35 +0000
4@@ -140,7 +140,10 @@
5 category_plugs.set_pixbuf_column (Columns.ICON);
6 category_plugs.set_tooltip_column (Columns.DESCRIPTION);
7 category_plugs.set_hexpand (true);
8- category_plugs.selection_changed.connect (() => on_selection_changed (category_plugs, filtered));
9+ category_plugs.set_selection_mode (Gtk.SelectionMode.SINGLE);
10+ category_plugs.set_activate_on_single_click (true);
11+
12+ category_plugs.item_activated.connect (on_item_activated);
13 var cellrenderer = (Gtk.CellRendererText)category_plugs.get_cells ().nth_data (0);
14 cellrenderer.wrap_mode = Pango.WrapMode.WORD;
15 cellrenderer.ellipsize_set = true;
16@@ -292,22 +295,17 @@
17 system_iconview.set_columns (columns);
18 }
19
20- private void on_selection_changed (Gtk.IconView view, Gtk.TreeModelFilter store) {
21+ private void on_item_activated (Gtk.IconView view, Gtk.TreePath path) {
22 GLib.Value plug;
23 Gtk.TreeIter selected_plug;
24-
25- var selected = view.get_selected_items ();
26- var item = selected.nth_data (0);
27-
28- if (item == null)
29- return;
30-
31- store.get_iter (out selected_plug, item);
32+ var store = view.get_model ();
33+
34+ store.get_iter (out selected_plug, path);
35 store.get_value (selected_plug, Columns.PLUG, out plug);
36
37 plug_selected ((Switchboard.Plug) plug.get_object ());
38
39- view.unselect_path (item);
40+ view.unselect_path (path);
41 }
42
43 public static string? get_category_name (Switchboard.Plug.Category category) {
44@@ -325,4 +323,4 @@
45 return null;
46 }
47 }
48-}
49\ No newline at end of file
50+}

Subscribers

People subscribed via source and target branches

to all changes: