Browse Source

1998-12-01 Miguel de Icaza <miguel@nuclecu.unam.mx>

	* configure.in (slang_use_system_installed_lib): Define slang
	here, to avoid having this on LIBS.

1998-11-26  Herbert Valerio Riedel  <hvr@hvrlab.ml.org>
Miguel de Icaza 26 years ago
parent
commit
dabe341f88
6 changed files with 118 additions and 12 deletions
  1. 9 0
      gnome/ChangeLog
  2. 14 0
      gnome/gnome.TODO
  3. 87 2
      gnome/gscreen.c
  4. 1 0
      gnome/gtkdtree.c
  5. 4 1
      gnome/gtkdtree.h
  6. 3 9
      src/key.c

+ 9 - 0
gnome/ChangeLog

@@ -1,3 +1,12 @@
+1998-12-02  Miguel de Icaza  <miguel@nuclecu.unam.mx>
+
+	* gscreen.c (tree_drag_open_directory, panel_tree_drag_motion,
+	panel_tree_drag_leave): Drag and Drop support routines for the
+	tree to auto-expand the tree when the user stays still on top of a
+	directory.
+
+	* gtkdtree.c (gtk_dtree_load_path): Further speed increase
+
 1998-12-01  Federico Mena Quintero  <federico@nuclecu.unam.mx>
 
 	* glayout.c (file_menu): Use view_cmd and view_simple_cmd in the

+ 14 - 0
gnome/gnome.TODO

@@ -1,5 +1,11 @@
 New task list:
 
+	- Use notebook to hold CLIst/IconList on the main windown
+
+	- Put stuff inside a frame to make it look shrunken
+
+	- Menu option to toggle tree on/off.
+
 	- Make the tree faster (cache loaded directories)
 	
 	- Sync the tree to the panel view
@@ -12,6 +18,14 @@ New task list:
 
 	- Add to the gnome-panel mime-type support
 
+	- Drop the MC event handling off for the main window.
+
+Federico:
+
+	- Make the popup menus work on the desktop
+
+	- Root window stuff.
+
 Other features requested:
 
 	- Make the default action on drop configurable.

+ 87 - 2
gnome/gscreen.c

@@ -1703,6 +1703,81 @@ panel_chdir (GtkDTree *dtree, char *path, WPanel *panel)
 	do_panel_cd (panel, path, cd_exact);
 }
 
+/**
+ * tree_drag_open_directory:
+ *
+ * This routine is invoked in a delayed fashion if the user
+ * keeps the drag cursor still over the widget.
+ */
+static gint
+tree_drag_open_directory (gpointer data)
+{
+	WPanel *panel = data;
+	GtkCTreeNode *node;
+	int row, col;
+	int r;
+	
+	r = gtk_clist_get_selection_info (
+		GTK_CLIST (panel->tree),
+		GTK_DTREE (panel->tree)->drag_motion_x,
+		GTK_DTREE (panel->tree)->drag_motion_y,
+		&row, &col);
+
+	if (!r)
+		return FALSE;
+	
+	node = gtk_ctree_node_nth (GTK_CTREE (panel->tree), row);
+	if (!node)
+		return FALSE;
+
+	gtk_ctree_expand_recursive (GTK_CTREE (panel->tree), node);
+	return FALSE;
+}
+
+/** 
+ * panel_tree_drag_motion:
+ *
+ * This routine is invoked by GTK+ when an item is being dragged on
+ * top of our widget.  We setup a timed function that will open the
+ * Tree node
+ */
+static gboolean
+panel_tree_drag_motion (GtkWidget *widget, GdkDragContext *ctx, int x, int y, guint time, void *data)
+{
+	GtkDTree *dtree = GTK_DTREE (widget);
+	WPanel *panel = data;
+	int r, row, col;
+	
+        if (dtree->timer_id != -1)
+		gtk_timeout_remove (dtree->timer_id);
+
+	r = gtk_clist_get_selection_info (
+		GTK_CLIST (widget), x, y, &row, &col);
+
+	dtree->drag_motion_x = x;
+	dtree->drag_motion_y = y;
+	dtree->timer_id = gtk_timeout_add (500, tree_drag_open_directory, data);
+
+	return TRUE;
+}
+
+/**
+ * panel_tree_drag_leave:
+ *
+ * Invoked by GTK+ when the dragging cursor has abandoned our widget.
+ * We kill any pending timers.
+ */
+static void
+panel_tree_drag_leave (GtkWidget *widget, GdkDragContext *ctx, int x, int y, guint time, void *data)
+{
+	GtkDTree *dtree = GTK_DTREE (widget);
+	
+	if (dtree->timer_id == -1){
+		gtk_timeout_remove (dtree->timer_id);
+		dtree->timer_id = -1;
+	}
+}
+
 /** 
  * panel_create_tree_view:
  *
@@ -1721,10 +1796,20 @@ panel_create_tree_view (WPanel *panel)
 	gtk_drag_dest_set (GTK_WIDGET (tree), GTK_DEST_DEFAULT_ALL,
 			   drop_types, ELEMENTS (drop_types),
 			   GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK);
-	
+
+	/*
+	 * Drag and drop signals.
+	 */
+
+	/* Data has been dropped signal handler */
 	gtk_signal_connect (GTK_OBJECT (tree), "drag_data_received",
 			    GTK_SIGNAL_FUNC (panel_tree_drag_data_received), panel);
-			    
+
+	/* Mouse is being moved over ourselves */
+	gtk_signal_connect (GTK_OBJECT (tree), "drag_motion",
+			    GTK_SIGNAL_FUNC (panel_tree_drag_motion), panel);
+	gtk_signal_connect (GTK_OBJECT (tree), "drag_leave",
+			    GTK_SIGNAL_FUNC (panel_tree_drag_leave), panel);
 	return tree;
 }
 

+ 1 - 0
gnome/gtkdtree.c

@@ -482,6 +482,7 @@ static void
 gtk_dtree_init (GtkDTree *dtree)
 {
 	dtree->current_path = NULL;
+	dtree->timer_id = -1;
 }
 
 void

+ 4 - 1
gnome/gtkdtree.h

@@ -16,7 +16,10 @@ typedef struct {
 	char	     *requested_path;
 
 	int          visible;
-	int          expanding;
+
+	int          drag_motion_x;
+	int          drag_motion_y;
+	int          timer_id;
 	
 	GtkCTreeNode *root_node;	/* root node */
 	GtkCTreeNode *last_node;	/* last visited node */

+ 3 - 9
src/key.c

@@ -29,11 +29,8 @@
 #ifdef HAVE_UNISTD_H
 #   include <unistd.h>
 #endif
-#include <sys/types.h>		/* FD_ZERO et al */
-#ifndef SCO_FLAVOR
-	/* alex: sys/select.h defines struct timeval */
-#	include <sys/time.h>		/* struct timeval */
-#endif /* SCO_FLAVOR */
+#include <sys/types.h>
+#include <sys/time.h>
 #if HAVE_SYS_SELECT_H
 #   include <sys/select.h>
 #endif
@@ -62,10 +59,7 @@
 
 #include "x.h"
 
-/* "$Id$" */
-
-/* This macros were stolen from gpm 0.15 */
-#define GET_TIME(tv) (gettimeofday(&tv, (struct timezone *)NULL))
+#define GET_TIME(tv)    (gettimeofday(&tv, (struct timezone *)NULL))
 #define DIF_TIME(t1,t2) ((t2.tv_sec -t1.tv_sec) *1000+ \
 			 (t2.tv_usec-t1.tv_usec)/1000)