aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2004-05-01 01:52:19 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2004-05-01 01:52:19 +0800
commit4713ff66ff81a9da50324081d74a8edd6d402952 (patch)
tree1391e14a81cdb2b9f88c95ca3bfb5a7e3e76b889
parent58b88863a9f79924b8305ac5ad90bf993b9595d6 (diff)
downloadgsoc2013-evolution-4713ff66ff81a9da50324081d74a8edd6d402952.tar
gsoc2013-evolution-4713ff66ff81a9da50324081d74a8edd6d402952.tar.gz
gsoc2013-evolution-4713ff66ff81a9da50324081d74a8edd6d402952.tar.bz2
gsoc2013-evolution-4713ff66ff81a9da50324081d74a8edd6d402952.tar.lz
gsoc2013-evolution-4713ff66ff81a9da50324081d74a8edd6d402952.tar.xz
gsoc2013-evolution-4713ff66ff81a9da50324081d74a8edd6d402952.tar.zst
gsoc2013-evolution-4713ff66ff81a9da50324081d74a8edd6d402952.zip
If the row the cursor is hovering over has children and is not expanded
2004-04-30 Jeffrey Stedfast <fejj@ximian.com> * em-folder-tree.c (tree_drag_motion): If the row the cursor is hovering over has children and is not expanded already, setup a timer to auto-expand it if the user hovers there long enough. (tree_autoexpand): Callback to expand the row. (tree_drag_leave): Disconnect the timer. (tree_drag_drop): Same. (em_folder_tree_destroy): Same. svn path=/trunk/; revision=25718
-rw-r--r--mail/ChangeLog10
-rw-r--r--mail/em-folder-tree.c68
2 files changed, 78 insertions, 0 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index bbb3bb1fcd..823be6a2bd 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,13 @@
+2004-04-30 Jeffrey Stedfast <fejj@ximian.com>
+
+ * em-folder-tree.c (tree_drag_motion): If the row the cursor is
+ hovering over has children and is not expanded already, setup a
+ timer to auto-expand it if the user hovers there long enough.
+ (tree_autoexpand): Callback to expand the row.
+ (tree_drag_leave): Disconnect the timer.
+ (tree_drag_drop): Same.
+ (em_folder_tree_destroy): Same.
+
2004-04-30 Enver ALTIN <enver.altin@frontsite.com.tr>
* evolution-mail.schemas.in.in: Fixed a type-o.
diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c
index 56d457a725..714329327e 100644
--- a/mail/em-folder-tree.c
+++ b/mail/em-folder-tree.c
@@ -88,6 +88,8 @@ struct _EMFolderTreePrivate {
guint save_state_id;
guint autoscroll_id;
+ guint autoexpand_id;
+ GtkTreeRowReference *autoexpand_row;
guint loading_row_id;
guint loaded_row_id;
@@ -400,6 +402,14 @@ em_folder_tree_destroy (GtkObject *obj)
priv->autoscroll_id = 0;
}
+ if (priv->autoexpand_id != 0) {
+ gtk_tree_row_reference_free (priv->autoexpand_row);
+ priv->autoexpand_row = NULL;
+
+ g_source_remove (priv->autoexpand_id);
+ priv->autoexpand_id = 0;
+ }
+
priv->treeview = NULL;
priv->model = NULL;
@@ -1286,6 +1296,14 @@ tree_drag_drop (GtkWidget *widget, GdkDragContext *context, int x, int y, guint
priv->autoscroll_id = 0;
}
+ if (priv->autoexpand_id != 0) {
+ gtk_tree_row_reference_free (priv->autoexpand_row);
+ priv->autoexpand_row = NULL;
+
+ g_source_remove (priv->autoexpand_id);
+ priv->autoexpand_id = 0;
+ }
+
if (!gtk_tree_view_get_path_at_pos (priv->treeview, x, y, &path, &column, &cell_x, &cell_y))
return FALSE;
@@ -1320,6 +1338,14 @@ tree_drag_leave (GtkWidget *widget, GdkDragContext *context, guint time, EMFolde
priv->autoscroll_id = 0;
}
+ if (priv->autoexpand_id != 0) {
+ gtk_tree_row_reference_free (priv->autoexpand_row);
+ priv->autoexpand_row = NULL;
+
+ g_source_remove (priv->autoexpand_id);
+ priv->autoexpand_id = 0;
+ }
+
gtk_tree_view_set_drag_dest_row(emft->priv->treeview, NULL, GTK_TREE_VIEW_DROP_BEFORE);
}
@@ -1362,12 +1388,26 @@ tree_autoscroll (EMFolderTree *emft)
}
static gboolean
+tree_autoexpand (EMFolderTree *emft)
+{
+ struct _EMFolderTreePrivate *priv = emft->priv;
+ GtkTreePath *path;
+
+ path = gtk_tree_row_reference_get_path (priv->autoexpand_row);
+ gtk_tree_view_expand_row (priv->treeview, path, FALSE);
+ gtk_tree_path_free (path);
+
+ return TRUE;
+}
+
+static gboolean
tree_drag_motion (GtkWidget *widget, GdkDragContext *context, int x, int y, guint time, EMFolderTree *emft)
{
struct _EMFolderTreePrivate *priv = emft->priv;
GtkTreeViewDropPosition pos;
GdkDragAction action = 0;
GtkTreePath *path;
+ GtkTreeIter iter;
GdkAtom target;
int i;
@@ -1377,6 +1417,34 @@ tree_drag_motion (GtkWidget *widget, GdkDragContext *context, int x, int y, guin
if (priv->autoscroll_id == 0)
priv->autoscroll_id = g_timeout_add (150, (GSourceFunc) tree_autoscroll, emft);
+ gtk_tree_model_get_iter (priv->model, &iter, path);
+
+ if (gtk_tree_model_iter_has_child (priv->model, &iter) && !gtk_tree_view_row_expanded (priv->treeview, path)) {
+ if (priv->autoexpand_id != 0) {
+ GtkTreePath *autoexpand_path;
+
+ autoexpand_path = gtk_tree_row_reference_get_path (priv->autoexpand_row);
+ if (gtk_tree_path_compare (autoexpand_path, path) != 0) {
+ /* row changed, restart timer */
+ gtk_tree_row_reference_free (priv->autoexpand_row);
+ priv->autoexpand_row = gtk_tree_row_reference_new (priv->model, path);
+ g_source_remove (priv->autoexpand_id);
+ priv->autoexpand_id = g_timeout_add (600, (GSourceFunc) tree_autoexpand, emft);
+ }
+
+ gtk_tree_path_free (autoexpand_path);
+ } else {
+ priv->autoexpand_id = g_timeout_add (600, (GSourceFunc) tree_autoexpand, emft);
+ priv->autoexpand_row = gtk_tree_row_reference_new (priv->model, path);
+ }
+ } else if (priv->autoexpand_id != 0) {
+ gtk_tree_row_reference_free (priv->autoexpand_row);
+ priv->autoexpand_row = NULL;
+
+ g_source_remove (priv->autoexpand_id);
+ priv->autoexpand_id = 0;
+ }
+
target = emft_drop_target(emft, context, path);
if (target != GDK_NONE) {
for (i=0; i<NUM_DROP_TYPES; i++) {