From 9c81ea49fd5da61062e5bfff855879d809c6c6b5 Mon Sep 17 00:00:00 2001 From: Miguel de Icaza Date: Mon, 25 Jan 1999 16:50:38 +0000 Subject: [PATCH] 1999-01-25 Federico Mena Quintero * 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 * Makefile.am (libvfs_la_SOURCES): Added utilvfs.h. * Make-mc.in (VFSHDRS): Likewise. --- gnome/ChangeLog | 15 +++++++++++++++ gnome/gdesktop.c | 4 ++-- gnome/gdnd.c | 29 +++++++++++++++++++---------- gnome/gscreen.c | 12 +----------- vfs/ChangeLog | 5 +++++ vfs/Make-mc.in | 1 + vfs/Makefile.am | 1 + 7 files changed, 44 insertions(+), 23 deletions(-) diff --git a/gnome/ChangeLog b/gnome/ChangeLog index 612179321..71ea6210d 100644 --- a/gnome/ChangeLog +++ b/gnome/ChangeLog @@ -1,3 +1,18 @@ +1999-01-25 Federico Mena Quintero + + * 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 * gtkdtree.c (gtk_dtree_load_path): Keep track of when we are diff --git a/gnome/gdesktop.c b/gnome/gdesktop.c index 4dd1290e7..f96a1229b 100644 --- a/gnome/gdesktop.c +++ b/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: diff --git a/gnome/gdnd.c b/gnome/gdnd.c index 52933d754..88609ef39 100644 --- a/gnome/gdnd.c +++ b/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); diff --git a/gnome/gscreen.c b/gnome/gscreen.c index 8ff1198e3..85cbe1a09 100644 --- a/gnome/gscreen.c +++ b/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: * diff --git a/vfs/ChangeLog b/vfs/ChangeLog index c524d00ad..04fa0c6fe 100644 --- a/vfs/ChangeLog +++ b/vfs/ChangeLog @@ -1,3 +1,8 @@ +1999-01-25 Federico Mena Quintero + + * Makefile.am (libvfs_la_SOURCES): Added utilvfs.h. + * Make-mc.in (VFSHDRS): Likewise. + 1999-01-21 Federico Mena Quintero * utilvfs.c (append_path_sep): Fixed, it was broken for paths diff --git a/vfs/Make-mc.in b/vfs/Make-mc.in index 3265663e3..099731951 100644 --- a/vfs/Make-mc.in +++ b/vfs/Make-mc.in @@ -62,6 +62,7 @@ VFSHDRS = \ names.h \ tar.h \ tcputil.h \ + utilvfs.h \ vfs.h \ xdirentry.h diff --git a/vfs/Makefile.am b/vfs/Makefile.am index 64c3f0a4f..d10e4b428 100644 --- a/vfs/Makefile.am +++ b/vfs/Makefile.am @@ -40,6 +40,7 @@ libvfs_la_SOURCES = \ tcputil.c \ undelfs.c \ utilvfs.c \ + utilvfs.h \ vfs.c \ container.h \ extfs.h \