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
=== modified file 'src/CategoryView.vala'
--- src/CategoryView.vala 2014-07-22 00:15:56 +0000
+++ src/CategoryView.vala 2014-08-07 09:48:35 +0000
@@ -140,7 +140,10 @@
140 category_plugs.set_pixbuf_column (Columns.ICON);140 category_plugs.set_pixbuf_column (Columns.ICON);
141 category_plugs.set_tooltip_column (Columns.DESCRIPTION);141 category_plugs.set_tooltip_column (Columns.DESCRIPTION);
142 category_plugs.set_hexpand (true);142 category_plugs.set_hexpand (true);
143 category_plugs.selection_changed.connect (() => on_selection_changed (category_plugs, filtered));143 category_plugs.set_selection_mode (Gtk.SelectionMode.SINGLE);
144 category_plugs.set_activate_on_single_click (true);
145
146 category_plugs.item_activated.connect (on_item_activated);
144 var cellrenderer = (Gtk.CellRendererText)category_plugs.get_cells ().nth_data (0);147 var cellrenderer = (Gtk.CellRendererText)category_plugs.get_cells ().nth_data (0);
145 cellrenderer.wrap_mode = Pango.WrapMode.WORD;148 cellrenderer.wrap_mode = Pango.WrapMode.WORD;
146 cellrenderer.ellipsize_set = true;149 cellrenderer.ellipsize_set = true;
@@ -292,22 +295,17 @@
292 system_iconview.set_columns (columns);295 system_iconview.set_columns (columns);
293 }296 }
294297
295 private void on_selection_changed (Gtk.IconView view, Gtk.TreeModelFilter store) {298 private void on_item_activated (Gtk.IconView view, Gtk.TreePath path) {
296 GLib.Value plug;299 GLib.Value plug;
297 Gtk.TreeIter selected_plug;300 Gtk.TreeIter selected_plug;
298301 var store = view.get_model ();
299 var selected = view.get_selected_items ();302
300 var item = selected.nth_data (0);303 store.get_iter (out selected_plug, path);
301
302 if (item == null)
303 return;
304
305 store.get_iter (out selected_plug, item);
306 store.get_value (selected_plug, Columns.PLUG, out plug);304 store.get_value (selected_plug, Columns.PLUG, out plug);
307305
308 plug_selected ((Switchboard.Plug) plug.get_object ());306 plug_selected ((Switchboard.Plug) plug.get_object ());
309307
310 view.unselect_path (item);308 view.unselect_path (path);
311 }309 }
312310
313 public static string? get_category_name (Switchboard.Plug.Category category) {311 public static string? get_category_name (Switchboard.Plug.Category category) {
@@ -325,4 +323,4 @@
325 return null;323 return null;
326 }324 }
327 }325 }
328}
329\ No newline at end of file326\ No newline at end of file
327}

Subscribers

People subscribed via source and target branches

to all changes: