aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/misc/e-attachment-view.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2010-05-20 10:01:49 +0800
committerMatthew Barnes <mbarnes@redhat.com>2010-05-20 10:01:49 +0800
commitc8b4228f3d2db7f0bd866f16ed48b800256d3187 (patch)
tree4c8a71c50963bcd32627d46fe26f063108facc7f /widgets/misc/e-attachment-view.c
parenta53abe730b9e0d491ae92586862336b226d297bf (diff)
downloadgsoc2013-evolution-c8b4228f3d2db7f0bd866f16ed48b800256d3187.tar
gsoc2013-evolution-c8b4228f3d2db7f0bd866f16ed48b800256d3187.tar.gz
gsoc2013-evolution-c8b4228f3d2db7f0bd866f16ed48b800256d3187.tar.bz2
gsoc2013-evolution-c8b4228f3d2db7f0bd866f16ed48b800256d3187.tar.lz
gsoc2013-evolution-c8b4228f3d2db7f0bd866f16ed48b800256d3187.tar.xz
gsoc2013-evolution-c8b4228f3d2db7f0bd866f16ed48b800256d3187.tar.zst
gsoc2013-evolution-c8b4228f3d2db7f0bd866f16ed48b800256d3187.zip
Improve attachment bar selection behavior.
Some improvements made while investigating bug #608855. This does not solve the bug however, and in fact I now believe the bug is actually a GTK+ issue after reproducing the bug in gtk-demo. These improvements restore multiple selections via Ctrl+Click and Shift+Click, and also reduces the frequency that we synchronize the selection between Icon View and Tree View.
Diffstat (limited to 'widgets/misc/e-attachment-view.c')
-rw-r--r--widgets/misc/e-attachment-view.c38
1 files changed, 18 insertions, 20 deletions
diff --git a/widgets/misc/e-attachment-view.c b/widgets/misc/e-attachment-view.c
index 3b90941d85..2247809d5f 100644
--- a/widgets/misc/e-attachment-view.c
+++ b/widgets/misc/e-attachment-view.c
@@ -1075,29 +1075,13 @@ e_attachment_view_button_press_event (EAttachmentView *view,
{
GtkTreePath *path;
gboolean editable;
- gboolean item_clicked;
+ gboolean handled = FALSE;
g_return_val_if_fail (E_IS_ATTACHMENT_VIEW (view), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
editable = e_attachment_view_get_editable (view);
-
- /* If the user clicked on a selected item, retain the current
- * selection. If the user clicked on an unselected item, select
- * the clicked item only. If the user did not click on an item,
- * clear the current selection. */
path = e_attachment_view_get_path_at_pos (view, event->x, event->y);
- if (path != NULL) {
- if (!e_attachment_view_path_is_selected (view, path)) {
- e_attachment_view_unselect_all (view);
- e_attachment_view_select_path (view, path);
- }
- gtk_tree_path_free (path);
- item_clicked = TRUE;
- } else {
- e_attachment_view_unselect_all (view);
- item_clicked = FALSE;
- }
/* Cancel drag and drop if there are no selected items,
* or if any of the selected items are loading or saving. */
@@ -1118,17 +1102,31 @@ e_attachment_view_button_press_event (EAttachmentView *view,
}
if (event->button == 3 && event->type == GDK_BUTTON_PRESS) {
+ /* If the user clicked on a selected item, retain the
+ * current selection. If the user clicked on an unselected
+ * item, select the clicked item only. If the user did not
+ * click on an item, clear the current selection. */
+ if (path == NULL)
+ e_attachment_view_unselect_all (view);
+ else if (!e_attachment_view_path_is_selected (view, path)) {
+ e_attachment_view_unselect_all (view);
+ e_attachment_view_select_path (view, path);
+ }
+
/* Non-editable attachment views should only show a
* popup menu when right-clicking on an attachment,
* but editable views can show the menu any time. */
- if (item_clicked || editable) {
+ if (path != NULL || editable) {
e_attachment_view_show_popup_menu (
view, event, NULL, NULL);
- return TRUE;
+ handled = TRUE;
}
}
- return FALSE;
+ if (path != NULL)
+ gtk_tree_path_free (path);
+
+ return handled;
}
gboolean