aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--shell/ChangeLog15
-rw-r--r--shell/e-storage-set-view.c32
2 files changed, 40 insertions, 7 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog
index bb2c7c8f4d..167f5a3189 100644
--- a/shell/ChangeLog
+++ b/shell/ChangeLog
@@ -1,5 +1,20 @@
2000-05-15 Ettore Perazzoli <ettore@helixcode.com>
+ * e-storage-set-view.c: New members `dragged_row_path',
+ `selected_row_path_before_click' in `EStorageSetViewPrivate'.
+ (init): Initialize them to NULL.
+ (motion_notify_event): Set `dragged_row_path' from
+ `selected_row_path'.
+ (button_press_event): Initialize `selected_row_path_before_click'
+ from `selected_row_path'.
+ (button_release_event): Set `selected_row_path_before_click' to
+ NULL.
+ (drag_end): Restore the current selection from
+ `selected_row_path_before_click'; then set both `dragged_row_path'
+ to NULL.
+
+2000-05-15 Ettore Perazzoli <ettore@helixcode.com>
+
* e-storage-set-view.c: New members `in_drag' and `drag_button' in
`EStorageSetViewPrivate'. New static variables `drag_types',
`num_drag_types', `target_list'.
diff --git a/shell/e-storage-set-view.c b/shell/e-storage-set-view.c
index 8bcb59abda..0c0761996b 100644
--- a/shell/e-storage-set-view.c
+++ b/shell/e-storage-set-view.c
@@ -46,6 +46,12 @@ struct _EStorageSetViewPrivate {
/* Path of the row selected by the latest "tree_select_row" signal. */
const char *selected_row_path;
+ /* Path of the row currently being dragged. */
+ const char *dragged_row_path;
+
+ /* Path of the row that was selected before the latest click. */
+ const char *selected_row_path_before_click;
+
/* Whether we are currently performing a drag from this view. */
int in_drag : 1;
@@ -127,11 +133,13 @@ button_press_event (GtkWidget *widget,
EStorageSetView *storage_set_view;
EStorageSetViewPrivate *priv;
- (* GTK_WIDGET_CLASS (parent_class)->button_press_event) (widget, event);
-
storage_set_view = E_STORAGE_SET_VIEW (widget);
priv = storage_set_view->priv;
+ priv->selected_row_path_before_click = priv->selected_row_path;
+
+ (* GTK_WIDGET_CLASS (parent_class)->button_press_event) (widget, event);
+
if (priv->in_drag)
return FALSE;
@@ -170,6 +178,7 @@ motion_notify_event (GtkWidget *widget,
return FALSE;
priv->in_drag = TRUE;
+ priv->dragged_row_path = priv->selected_row_path;
gtk_drag_begin (widget, target_list, GDK_ACTION_MOVE,
priv->drag_button, (GdkEvent *) event);
@@ -199,6 +208,8 @@ button_release_event (GtkWidget *widget,
priv->selected_row_path = NULL;
}
+ priv->selected_row_path_before_click = NULL;
+
return TRUE;
}
@@ -212,8 +223,13 @@ drag_end (GtkWidget *widget,
storage_set_view = E_STORAGE_SET_VIEW (widget);
priv = storage_set_view->priv;
+ if (priv->dragged_row_path != NULL)
+ e_storage_set_view_set_current_folder (storage_set_view,
+ priv->selected_row_path_before_click);
+
priv->in_drag = FALSE;
priv->drag_button = 0;
+ priv->dragged_row_path = NULL;
}
static void
@@ -373,11 +389,13 @@ init (EStorageSetView *storage_set_view)
priv = g_new (EStorageSetViewPrivate, 1);
- priv->storage_set = NULL;
- priv->ctree_node_to_path = g_hash_table_new (g_direct_hash, g_direct_equal);
- priv->path_to_ctree_node = g_hash_table_new (g_str_hash, g_str_equal);
- priv->selected_row_path = NULL;
- priv->in_drag = FALSE;
+ priv->storage_set = NULL;
+ priv->ctree_node_to_path = g_hash_table_new (g_direct_hash, g_direct_equal);
+ priv->path_to_ctree_node = g_hash_table_new (g_str_hash, g_str_equal);
+ priv->selected_row_path = NULL;
+ priv->dragged_row_path = NULL;
+ priv->selected_row_path_before_click = NULL;
+ priv->in_drag = FALSE;
storage_set_view->priv = priv;
}