Browse Source

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

	* gscreen.c (panel_tree_drag_data_received): Perform drag and drop
	operations on the Tree.
Miguel de Icaza 26 years ago
parent
commit
414df0f7b7
7 changed files with 63 additions and 28 deletions
  1. 5 0
      gnome/ChangeLog
  2. 23 21
      gnome/Makefile.in
  3. 16 2
      gnome/gscreen.c
  4. 7 3
      gnome/gtkdtree.c
  5. 3 0
      gnome/gtkdtree.h
  6. 4 0
      idl/FileManager.idl
  7. 5 2
      src/main.c

+ 5 - 0
gnome/ChangeLog

@@ -1,3 +1,8 @@
+1998-12-02  Miguel de Icaza  <miguel@nuclecu.unam.mx>
+
+	* gscreen.c (panel_tree_drag_data_received): Perform drag and drop
+	operations on the Tree.
+
 1998-12-02  Federico Mena Quintero  <federico@nuclecu.unam.mx>
 
 	* gdesktop.c (setup_desktop_dnd): New function to set up drops

+ 23 - 21
gnome/Makefile.in

@@ -16,11 +16,21 @@ INSTALL = @INSTALL@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_DATA = @INSTALL_DATA@
 
+PIXMAPS =			\
+	dev.xpm			\
+	link.xpm		\
+	directory.xpm		\
+	listing-list.xpm	\
+	listing-iconic.xpm	\
+	dir-close.xpm		\
+	dir-open.xpm
+
 GNOMESRCS = 		\
 	gblist.c	\
 	gcache.c	\
 	gcliplabel.c	\
 	gcmd.c		\
+	gcorba.c	\
 	gdesktop-icon.c	\
 	gdesktop.c 	\
 	gdnd.c		\
@@ -79,8 +89,6 @@ ICONS = 			\
 # These objects from ../src do not depend on HAVE_X / HAVE_GNOME??
 #
 LOBJS = mad.o
-# popt.o poptconfig.o \
-#	popthelp.o poptparse.o findme.o
 
 #
 # These objects from ../src do depend on HAVE_GNOME
@@ -93,7 +101,15 @@ OOBJS = dlg.o screen.o widget.o wtools.o info.o boxes.o \
 	@XCURSES@ @REGEX_O@ complete.o command.o \
 	option.o cmd.o utilunix.o xslint.o filegui.o filenot.o 
 
-OBJS = $(LOBJS) $(OOBJS) \
+CORBAOBJS = 			\
+	main-corba.o		\
+	gcorba.o		\
+	FileManager-impl.o	\
+	FileManager-skels.o
+
+OBJS = 			\
+	$(LOBJS) 	\
+	$(OOBJS) 	\
 	gblist.o	\
 	gcache.o	\
 	gcliplabel.o	\
@@ -123,32 +139,18 @@ OBJS = $(LOBJS) $(OOBJS) \
 NORMALOBJS =		\
 	main.o
 
-CORBAOBJS = 		\
-	main-corba.o
-
-
-#
-# Distribution variables
-#
-
-PIXMAPS =			\
-	dev.xpm			\
-	link.xpm		\
-	directory.xpm		\
-	listing-list.xpm	\
-	listing-iconic.xpm	\
-	dir-close.xpm		\
-	dir-open.xpm
-
 CORBA_GENERATED =		\
 	FileManager.h		\
 	FileManager-stubs.c	\
 	FileManager-skels.c	\
 	FileManager-common.c
 
-CORBA_SOURCES = FileManager-impl.c
+CORBA_SOURCES = 		\
+	gcorba.c		\
+	FileManager-impl.c
 
 $(CORBA_GENERATED): $(rootdir)/idl/FileManager.idl
+	orbit-idl `gnome-config --cflags idl` $(rootdir)/idl/FileManager.idl
 
 FileManager-impl.c: FileManager.h
 

+ 16 - 2
gnome/gscreen.c

@@ -835,8 +835,22 @@ panel_tree_drag_data_received (GtkWidget          *widget,
 			       WPanel              *panel)
 {
 	GtkDTree *dtree = GTK_DTREE (widget);
+	GtkCTreeNode *node;
+	int row, col;
+	char *path;
+	
+	if (!gtk_clist_get_selection_info (GTK_CLIST (dtree), x, y, &row, &col))
+		return;
 
-	printf ("Drop received on tree\n");
+	node = gtk_ctree_node_nth (GTK_CTREE (dtree), row);
+	if (!node)
+		return;
+	gtk_ctree_expand_recursive (GTK_CTREE (dtree), node);
+	path = gtk_dtree_get_row_path (dtree, node, 0);
+
+	gdnd_drop_on_directory (context, selection_data, path);
+		
+	g_free (path);
 }
 
 #ifdef OLD_DND
@@ -1753,7 +1767,7 @@ panel_tree_drag_motion (GtkWidget *widget, GdkDragContext *ctx, int x, int y, gu
 
 	dtree->drag_motion_x = x;
 	dtree->drag_motion_y = y;
-	dtree->timer_id = gtk_timeout_add (500, tree_drag_open_directory, data);
+	dtree->timer_id = gtk_timeout_add (200, tree_drag_open_directory, data);
 
 	return TRUE;
 }

+ 7 - 3
gnome/gtkdtree.c

@@ -36,18 +36,22 @@ enum {
 
 static guint gtk_dtree_signals [LAST_SIGNAL] = { 0 };
 
-static char *
-gtk_dtree_get_row_path (GtkCTree *ctree, GtkCTreeNode *row, gint column)
+char *
+gtk_dtree_get_row_path (GtkDTree *dtree, GtkCTreeNode *row, gint column)
 {
 	char *node_text, *path;
 
+	g_return_val_if_fail (dtree != NULL, NULL);
+	g_return_val_if_fail (GTK_IS_DTREE (dtree), NULL);
+	g_return_val_if_fail (row != NULL, NULL);
+	
 	path = g_strdup ("");
 	do {
 		char *new_path;
 		int val;
 		
 		val = gtk_ctree_node_get_pixtext (
-			ctree, row, column,
+			GTK_CTREE (dtree), row, column,
 			&node_text, NULL, NULL, NULL);
 
 		if (!val)

+ 3 - 0
gnome/gtkdtree.h

@@ -48,5 +48,8 @@ void       gtk_dtree_remove_dir_by_name (GtkDTree *dtree,
 					 char *directory);
 gboolean   gtk_dtree_select_dir         (GtkDTree *dtree,
 					 char *directory);
+char      *gtk_dtree_get_row_path       (GtkDTree *ctree,
+					 GtkCTreeNode *row,
+					 gint column);
 
 #endif

+ 4 - 0
idl/FileManager.idl

@@ -5,6 +5,10 @@ module GNOME {
 
 	};
 
+	exception POSIX_ERROR {};
+
 	interface FileManager {
+		void chdir (in string dir)
+			raises (POSIX_ERROR);
 	};
 };

+ 5 - 2
src/main.c

@@ -81,6 +81,7 @@
 
 #ifdef HAVE_CORBA
 #    include <libgnorba/gnorba.h>
+#    include "gcorba.h"
 #endif
 
 /* Program include files */
@@ -2667,8 +2668,10 @@ handle_args (int argc, char *argv [])
 
     CORBA_exception_init (&ev);
 
-    gnome_CORBA_init_with_popt_table (
-	    "gmc", VERSION, &argc, argv, argument_table, 0, &ctx, 0, &ev);
+    orb = gnome_CORBA_init_with_popt_table (
+	    "gmc", VERSION, &argc, argv, argument_table, 0, &ctx, GNORBA_INIT_SERVER_FUNC, &ev);
+
+    corba_register_server ();
 #else
     gnome_init_with_popt_table ("gmc", VERSION, argc, argv, argument_table, 0, &ctx);
 #endif