diff --git a/gnome/ChangeLog b/gnome/ChangeLog index 3533f9ea5..42b26d456 100644 --- a/gnome/ChangeLog +++ b/gnome/ChangeLog @@ -1,3 +1,18 @@ +Thu Mar 5 23:54:58 1998 Miguel de Icaza + + * gdesktop.c (drop_on_panel): New function; Used by the directory + icons and by regular panels to support drag targets; + + * gscreen.c (panel_drop_data_available): Performs the drop action + on a panel. It needs fixing, as the DropDataAvailabelEvent does + not provide any information as to where the drop actually + happened. + + (fixed_gtk_widget_dnd_drag_set, fixed_gtk_widget_dnd_drop_set): + Only set the main window of the clist to be the source/target of + the drag and drop code. The little square at the end did not make + much sense as a drop/drag spot. + Wed Mar 4 22:43:00 1998 Miguel de Icaza * gtools.c (query_dialog): Rewritten to use the MC dialog/widget code. diff --git a/gnome/gdesktop.c b/gnome/gdesktop.c index 514ef2b50..6a7caa0f5 100644 --- a/gnome/gdesktop.c +++ b/gnome/gdesktop.c @@ -132,11 +132,13 @@ get_operation (int x, int y) gtk_menu_append (GTK_MENU (menu), item); gtk_widget_show (item); +#if 0 + /* Not yet implemented the Link bits, so better to not show what we dont have */ item = gtk_menu_item_new_with_label (_("Link")); gtk_signal_connect (GTK_OBJECT (item), "activate", GTK_SIGNAL_FUNC(set_option), (void *) OPER_LINK); gtk_menu_append (GTK_MENU (menu), item); gtk_widget_show (item); - +#endif gtk_signal_connect (GTK_OBJECT (menu), "hide", GTK_SIGNAL_FUNC(option_menu_gone), 0); } @@ -222,6 +224,17 @@ perform_drop_manually (int operation, GdkEventDropDataAvailable *event, char *de char *p = event->data; int len; + switch (operation){ + case OPER_COPY: + create_op_win (OP_COPY, 0); + break; + + case OPER_MOVE: + create_op_win (OP_MOVE, 0); + break; + } + file_mask_defaults (); + do { char *tmpf; @@ -230,12 +243,9 @@ perform_drop_manually (int operation, GdkEventDropDataAvailable *event, char *de switch (operation){ case OPER_COPY: - create_op_win (OP_COPY, 0); - file_mask_defaults (); tmpf = concat_dir_and_file (dest, x_basename (p)); copy_file_file (p, tmpf, 1); free (tmpf); - destroy_op_win (); break; case OPER_MOVE: @@ -244,7 +254,6 @@ perform_drop_manually (int operation, GdkEventDropDataAvailable *event, char *de tmpf = concat_dir_and_file (dest, x_basename (p)); move_file_file (p, tmpf); free (tmpf); - destroy_op_win (); break; @@ -252,6 +261,25 @@ perform_drop_manually (int operation, GdkEventDropDataAvailable *event, char *de p += len; } while (count > 0); + destroy_op_win (); +} + +void +drop_on_panel (int requestor_id, char *dest) +{ + WPanel *source_panel; + int x, y; + + gdk_window_get_pointer (NULL, &x, &y, NULL); + operation = get_operation (x, y); + + source_panel = find_panel_owning_window_id (requestor_id); + + if (source_panel) + perform_drop_on_panel (source_panel, operation, dest); + else + perform_drop_manually (operation, event, dest); + return; } static void @@ -264,18 +292,7 @@ drop_cb (GtkWidget *widget, GdkEventDropDataAvailable *event, desktop_icon_t *di int operation; if (is_directory){ - WPanel *source_panel; - int x, y; - - gdk_window_get_pointer (NULL, &x, &y, NULL); - operation = get_operation (x, y); - - source_panel = find_panel_owning_window_id (event->requestor); - - if (source_panel) - perform_drop_on_panel (source_panel, operation, di->dentry->exec); - else - perform_drop_manually (operation, event, di->dentry->exec); + drop_on_panel (event->requestor, di->dentry->exec); return; } diff --git a/gnome/gdesktop.h b/gnome/gdesktop.h index 3563f7463..e4abc1ecd 100644 --- a/gnome/gdesktop.h +++ b/gnome/gdesktop.h @@ -1,3 +1,8 @@ #define MC_LIB_DESKTOP "mc.desktop" + +/* gtrans.c */ GtkWidget *create_transparent_text_window (char *file, char *text, int extra_events); GtkWidget *make_transparent_window (char *file); + +/* gdesktop.c */ +void drop_on_panel (int requestor_window_id, char *dest); diff --git a/gnome/gscreen.c b/gnome/gscreen.c index cdf0f6ecc..621f223b0 100644 --- a/gnome/gscreen.c +++ b/gnome/gscreen.c @@ -678,21 +678,29 @@ panel_drop_enter (GtkWidget *widget, GdkEvent *event) static void panel_drop_data_available (GtkWidget *widget, GdkEventDropDataAvailable *data, WPanel *panel) { - printf ("Drop data available!\n"); + /* Sigh, the DropDataAvailable does not provide the location where the drag + * happened, so for now, the only thing we can do is ask gdk to tell us + * where the pointer is, even if it bears little resemblance with the + * actual spot where the drop happened. + * + * FIXME: gtk+ needs fixing here. + */ + + drop_on_panel (data->requestor, panel->cwd); } /* Workaround for the CList that is not adding its clist-window to the DND windows */ static void fixed_gtk_widget_dnd_drop_set (GtkCList *clist, int drop_enable, char **drop_types, int count, int is_destructive) { - gtk_widget_dnd_drop_set (GTK_WIDGET (clist), drop_enable, drop_types, count, is_destructive); +/* gtk_widget_dnd_drop_set (GTK_WIDGET (clist), drop_enable, drop_types, count, is_destructive); */ gdk_window_dnd_drop_set (clist->clist_window, drop_enable, drop_types, count, is_destructive); } static void fixed_gtk_widget_dnd_drag_set (GtkCList *clist, int drag_enable, gchar **type_accept_list, int numtypes) { - gtk_widget_dnd_drag_set (GTK_WIDGET (clist), drag_enable, type_accept_list, numtypes); +/* gtk_widget_dnd_drag_set (GTK_WIDGET (clist), drag_enable, type_accept_list, numtypes); */ gdk_window_dnd_drag_set (clist->clist_window, drag_enable, type_accept_list, numtypes); } @@ -718,8 +726,10 @@ panel_realized (GtkWidget *file_list, WPanel *panel) if (drag_directory && drag_directory_ok){ gtk_widget_show (drag_directory_ok); gtk_widget_show (drag_directory); +#if 0 gdk_dnd_set_drag_shape (drag_directory->window, &hotspot, - drag_directory_ok->window, &hotspot); + drag_directory_ok->window, &hotspot); +#endif } /* DND: Drag setup */