Browse Source

1999-01-25 Federico Mena Quintero <federico@nuclecu.unam.mx>

	* gdnd.c (get_action): Sensitize the menu items based on the
	allowed actions in the drag context.
	(actions): Add some underlined accelerators for the action menu.

	* gdesktop.c (icon_drag_motion): Use S_ISDIR() in addition to
	fe->f.link_to_dir.

	* gscreen.c (panel_file_list_scrolled): Removed this function, as
	it was not used for anything useful.

	* gdnd.c (gdnd_drop_on_directory): Duh.  Use context->action, not
	context->suggested_action.

1999-01-25  Federico Mena Quintero  <federico@nuclecu.unam.mx>

	* Makefile.am (libvfs_la_SOURCES): Added utilvfs.h.
	* Make-mc.in (VFSHDRS): Likewise.
Miguel de Icaza 26 years ago
parent
commit
9c81ea49fd
7 changed files with 44 additions and 23 deletions
  1. 15 0
      gnome/ChangeLog
  2. 2 2
      gnome/gdesktop.c
  3. 19 10
      gnome/gdnd.c
  4. 1 11
      gnome/gscreen.c
  5. 5 0
      vfs/ChangeLog
  6. 1 0
      vfs/Make-mc.in
  7. 1 0
      vfs/Makefile.am

+ 15 - 0
gnome/ChangeLog

@@ -1,3 +1,18 @@
+1999-01-25  Federico Mena Quintero  <federico@nuclecu.unam.mx>
+
+	* gdnd.c (get_action): Sensitize the menu items based on the
+	allowed actions in the drag context.
+	(actions): Add some underlined accelerators for the action menu.
+
+	* gdesktop.c (icon_drag_motion): Use S_ISDIR() in addition to
+	fe->f.link_to_dir.
+
+	* gscreen.c (panel_file_list_scrolled): Removed this function, as
+	it was not used for anything useful.
+
+	* gdnd.c (gdnd_drop_on_directory): Duh.  Use context->action, not
+	context->suggested_action.
+
 1999-01-24  Miguel de Icaza  <miguel@nuclecu.unam.mx>
 
 	* gtkdtree.c (gtk_dtree_load_path): Keep track of when we are

+ 2 - 2
gnome/gdesktop.c

@@ -1147,7 +1147,7 @@ icon_drag_motion (GtkWidget *widget, GdkDragContext *context, gint x, gint y, gu
 	    && (context->actions & GDK_ACTION_MOVE))
 		action = GDK_ACTION_MOVE;
 	else if (gdnd_drag_context_has_target (context, TARGET_URI_LIST)) {
-		if (fe->f.link_to_dir)
+		if (S_ISDIR (fe->buf.st_mode) || fe->f.link_to_dir)
 			action = context->suggested_action;
 		else if (is_exe (fe->buf.st_mode)
 			 && if_link_is_exe (fe)
@@ -1344,7 +1344,7 @@ icon_drag_data_received (GtkWidget *widget, GdkDragContext *context, gint x, gin
 			drop_desktop_icons (context, data, x + dii->x, y + dii->y);
 		else
 			printf ("FIXME: what do drop?\n"); /* FIXME */
-			
+
 		break;
 
 	case TARGET_URI_LIST:

+ 19 - 10
gnome/gdnd.c

@@ -46,9 +46,9 @@ gdnd_init (void)
 
 /* The menu of DnD actions */
 static GnomeUIInfo actions[] = {
-	GNOMEUIINFO_ITEM_NONE (N_("Move here"), NULL, NULL),
-	GNOMEUIINFO_ITEM_NONE (N_("Copy here"), NULL, NULL),
-	GNOMEUIINFO_ITEM_NONE (N_("Link here"), NULL, NULL),
+	GNOMEUIINFO_ITEM_NONE (N_("_Move here"), NULL, NULL),
+	GNOMEUIINFO_ITEM_NONE (N_("_Copy here"), NULL, NULL),
+	GNOMEUIINFO_ITEM_NONE (N_("_Link here"), NULL, NULL),
 	GNOMEUIINFO_SEPARATOR,
 	GNOMEUIINFO_ITEM_NONE (N_("Cancel drag"), NULL, NULL),
 	GNOMEUIINFO_END
@@ -56,13 +56,22 @@ static GnomeUIInfo actions[] = {
 
 /* Pops up a menu of actions to perform on dropped files */
 static GdkDragAction
-get_action (void)
+get_action (GdkDragContext *context)
 {
 	GtkWidget *menu;
 	int a;
 	GdkDragAction action;
 
+	/* Create the menu and set the sensitivity of the items based on the
+	 * allowed actions.
+	 */
+
 	menu = gnome_popup_menu_new (actions);
+
+	gtk_widget_set_sensitive (actions[0].widget, (context->actions & GDK_ACTION_MOVE) != 0);
+	gtk_widget_set_sensitive (actions[1].widget, (context->actions & GDK_ACTION_COPY) != 0);
+	gtk_widget_set_sensitive (actions[2].widget, (context->actions & GDK_ACTION_LINK) != 0);
+
 	a = gnome_popup_menu_do_popup_modal (menu, NULL, NULL, NULL, NULL);
 
 	switch (a) {
@@ -285,29 +294,29 @@ gdnd_drop_on_directory (GdkDragContext *context, GtkSelectionData *selection_dat
 	WPanel *source_panel;
 	GList *names;
 
-	if (context->suggested_action == GDK_ACTION_ASK) {
-		action = get_action ();
+	if (context->action == GDK_ACTION_ASK) {
+		action = get_action (context);
 
 		if (action == GDK_ACTION_ASK)
 			return FALSE;
 		
 	} else
-		action = context->suggested_action;
+		action = context->action;
 
 	/* If we are dragging from a file panel, we can display a nicer status display */
 	source_panel = find_panel_owning_window (context);
 
 	/* Check if the user did not drag the information to the same directory */
-	if (source_panel){
+	if (source_panel) {
 		if (strcmp (source_panel->cwd, destdir) == 0)
 			return FALSE;
 	}
-	
+
 	/* Symlinks do not use file.c */
 
 	if (source_panel && action != GDK_ACTION_LINK)
 		perform_action_on_panel (source_panel, action, destdir,
-					 context->suggested_action == GDK_ACTION_ASK);
+					 context->action == GDK_ACTION_ASK);
 	else {
 		names = gnome_uri_list_extract_uris (selection_data->data);
 

+ 1 - 11
gnome/gscreen.c

@@ -619,15 +619,6 @@ panel_setup_drag_motion (WPanel *panel, int x, int y, desirable_fn desirable, sc
 	return FALSE;
 }
 
-static void
-panel_file_list_scrolled (GtkAdjustment *adj, WPanel *panel)
-{
-	if (!GTK_IS_ADJUSTMENT (adj)) {
-		fprintf (stderr, "file_list_is_scrolled is called and there are not enough boats!\n");
-		exit (1);
-	}
-}
-
 static void
 panel_configure_file_list (WPanel *panel, GtkWidget *sw, GtkWidget *file_list)
 {
@@ -661,8 +652,6 @@ panel_configure_file_list (WPanel *panel, GtkWidget *sw, GtkWidget *file_list)
 
 	/* Configure the scrolbars */
 	adjustment = GTK_OBJECT (gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (sw)));
-	gtk_signal_connect_after (adjustment, "value_changed",
-				  GTK_SIGNAL_FUNC (panel_file_list_scrolled), panel);
 }
 
 /*
@@ -1118,6 +1107,7 @@ panel_icon_list_scroll (gpointer data)
 
 	return TRUE;
 }
+
 /**
  * panel_icon_list_drag_motion:
  *

+ 5 - 0
vfs/ChangeLog

@@ -1,3 +1,8 @@
+1999-01-25  Federico Mena Quintero  <federico@nuclecu.unam.mx>
+
+	* Makefile.am (libvfs_la_SOURCES): Added utilvfs.h.
+	* Make-mc.in (VFSHDRS): Likewise.
+
 1999-01-21  Federico Mena Quintero  <federico@nuclecu.unam.mx>
 
 	* utilvfs.c (append_path_sep): Fixed, it was broken for paths

+ 1 - 0
vfs/Make-mc.in

@@ -62,6 +62,7 @@ VFSHDRS = 			\
 	names.h 		\
 	tar.h 			\
 	tcputil.h 		\
+	utilvfs.h		\
 	vfs.h			\
 	xdirentry.h
 

+ 1 - 0
vfs/Makefile.am

@@ -40,6 +40,7 @@ libvfs_la_SOURCES = \
 	tcputil.c		\
 	undelfs.c 		\
 	utilvfs.c		\
+	utilvfs.h		\
 	vfs.c			\
 	container.h 		\
 	extfs.h 		\