[geary] Minor ConversationListView code cleanup.
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary] Minor ConversationListView code cleanup.
- Date: Thu, 20 Oct 2016 01:05:16 +0000 (UTC)
commit 0e5df2c9be0b3ee25b8c0fc49b2cc4779f1d9b1e
Author: Michael James Gratton <mike vee net>
Date: Thu Oct 20 12:04:49 2016 +1100
Minor ConversationListView code cleanup.
* src/client/conversation-list/conversation-list-view.vala
(ConversationListView): Don't use ::get_all_selected_paths() to
determine if the selection is empty, just count the selected rows
instead. Also, use Gdk.EVENT_PROPAGATE constants for clarity.
.../conversation-list/conversation-list-view.vala | 34 ++++++++-----------
1 files changed, 14 insertions(+), 20 deletions(-)
---
diff --git a/src/client/conversation-list/conversation-list-view.vala
b/src/client/conversation-list/conversation-list-view.vala
index c336910..355681e 100644
--- a/src/client/conversation-list/conversation-list-view.vala
+++ b/src/client/conversation-list/conversation-list-view.vala
@@ -353,10 +353,6 @@ public class ConversationListView : Gtk.TreeView {
Gtk.TreeModel model;
return get_selection().get_selected_rows(out model);
}
-
- private Gtk.TreePath? get_selected_path() {
- return get_all_selected_paths().nth_data(0);
- }
private void on_selection_changed() {
if (this.selection_changed_id != 0)
@@ -506,25 +502,23 @@ public class ConversationListView : Gtk.TreeView {
ConversationListCellRenderer.set_hover_selected(hover);
queue_draw();
}
-
+
private bool on_motion_notify_event(Gdk.EventMotion event) {
- if (get_selected_path() == null)
- return false;
-
- Gtk.TreePath? path = null;
- int cell_x, cell_y;
- get_path_at_pos((int) event.x, (int) event.y, out path, null, out cell_x, out cell_y);
-
- set_hover_selected(path != null && get_selection().path_is_selected(path));
-
- return false;
+ if (get_selection().count_selected_rows() > 0) {
+ Gtk.TreePath? path = null;
+ int cell_x, cell_y;
+ get_path_at_pos((int) event.x, (int) event.y, out path, null, out cell_x, out cell_y);
+
+ set_hover_selected(path != null && get_selection().path_is_selected(path));
+ }
+ return Gdk.EVENT_PROPAGATE;
}
-
+
private bool on_leave_notify_event() {
- if (get_selected_path() != null)
+ if (get_selection().count_selected_rows() > 0) {
set_hover_selected(false);
-
- return false;
+ }
+ return Gdk.EVENT_PROPAGATE;
+
}
}
-
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]