Commit e940b87f authored by Christian Neumair's avatar Christian Neumair Committed by Christian Neumair

Correctly sort files before operating on them. Fixes #308884.

2005-07-06  Christian Neumair  <chris@gnome-de.org>

	* libnautilus-private/nautilus-icon-container.c:
	(nautilus_icon_container_get_selection):
	* src/file-manager/fm-directory-view.c: (delete_selected_files):
	Correctly sort files before operating on them. Fixes #308884.

	* libnautilus-private/nautilus-dnd.c: (nautilus_drag_init):
	* libnautilus-private/nautilus-dnd.h:
	* libnautilus-private/nautilus-icon-dnd.c:
	(get_data_on_first_target_we_support), (nautilus_icon_dnd_init):
	* libnautilus-private/nautilus-tree-view-drag-dest.c:
	(nautilus_tree_view_drag_dest_new):
	* src/nautilus-spatial-window.c:
	(nautilus_spatial_window_instance_init):
	* src/file-manager/fm-list-model.c:
	(fm_list_model_multi_drag_data_get):
	Use GTK+ helpers for text D'n'D.

	* src/nautilus-shell-ui.xml:
	* src/nautilus-window-menus.c:
	Register control-+/- keys on keypad for zooming. Fixes #309018.

	* libnautilus-private/nautilus-file-operations.c:
	(new_file_transfer_callback):
	Fix template duplicate numbering. Fixes #307252.
parent fdecd6e0
2005-07-06 Christian Neumair <chris@gnome-de.org>
* libnautilus-private/nautilus-icon-container.c:
(nautilus_icon_container_get_selection):
* src/file-manager/fm-directory-view.c: (delete_selected_files):
Correctly sort files before operating on them. Fixes #308884.
* libnautilus-private/nautilus-dnd.c: (nautilus_drag_init):
* libnautilus-private/nautilus-dnd.h:
* libnautilus-private/nautilus-icon-dnd.c:
(get_data_on_first_target_we_support), (nautilus_icon_dnd_init):
* libnautilus-private/nautilus-tree-view-drag-dest.c:
(nautilus_tree_view_drag_dest_new):
* src/nautilus-spatial-window.c:
(nautilus_spatial_window_instance_init):
* src/file-manager/fm-list-model.c:
(fm_list_model_multi_drag_data_get):
Use GTK+ helpers for text D'n'D.
* src/nautilus-shell-ui.xml:
* src/nautilus-window-menus.c:
Register control-+/- keys on keypad for zooming. Fixes #309018.
* libnautilus-private/nautilus-file-operations.c:
(new_file_transfer_callback):
Fix template duplicate numbering. Fixes #307252.
2005-07-06 Alexander Larsson <alexl@redhat.com>
* libnautilus-private/nautilus-icon-canvas-item.c:
......
......@@ -70,11 +70,17 @@
void
nautilus_drag_init (NautilusDragInfo *drag_info,
const GtkTargetEntry *drag_types,
int drag_type_count)
int drag_type_count,
gboolean add_text_targets)
{
drag_info->target_list = gtk_target_list_new (drag_types,
drag_type_count);
if (add_text_targets) {
gtk_target_list_add_text_targets (drag_info->target_list,
NAUTILUS_ICON_DND_TEXT);
}
drag_info->drop_occured = FALSE;
drag_info->need_to_destroy = FALSE;
}
......
......@@ -32,7 +32,6 @@
/* Drag & Drop target names. */
#define NAUTILUS_ICON_DND_GNOME_ICON_LIST_TYPE "x-special/gnome-icon-list"
#define NAUTILUS_ICON_DND_URI_LIST_TYPE "text/uri-list"
#define NAUTILUS_ICON_DND_TEXT_TYPE "UTF8_STRING"
#define NAUTILUS_ICON_DND_URL_TYPE "_NETSCAPE_URL"
#define NAUTILUS_ICON_DND_COLOR_TYPE "application/x-color"
#define NAUTILUS_ICON_DND_BGIMAGE_TYPE "property/bgimage"
......@@ -107,7 +106,8 @@ typedef void (* NautilusDragEachSelectedItemIterator) (NautilusDragEachSelecte
void nautilus_drag_init (NautilusDragInfo *drag_info,
const GtkTargetEntry *drag_types,
int drag_type_count);
int drag_type_count,
gboolean add_text_targets);
void nautilus_drag_finalize (NautilusDragInfo *drag_info);
NautilusDragSelectionItem *nautilus_drag_selection_item_new (void);
void nautilus_drag_destroy_selection_list (GList *selection_list);
......
......@@ -2285,6 +2285,7 @@ new_file_transfer_callback (GnomeVFSAsyncHandle *handle,
{
NewFileTransferState *state;
char *temp_string;
char **temp_strings;
char *uri;
state = (NewFileTransferState *) data;
......@@ -2325,10 +2326,20 @@ new_file_transfer_callback (GnomeVFSAsyncHandle *handle,
progress_info->duplicate_name,
progress_info->duplicate_count);
} else {
progress_info->duplicate_name = g_strdup_printf
("%s%%20%d",
progress_info->duplicate_name,
progress_info->duplicate_count);
temp_strings = g_strsplit (temp_string, ".", 2);
if (temp_strings[1] != NULL) {
progress_info->duplicate_name = g_strdup_printf
("%s%%20%d.%s",
temp_strings[0],
progress_info->duplicate_count,
temp_strings[1]);
} else {
progress_info->duplicate_name = g_strdup_printf
("%s%%20%d",
progress_info->duplicate_name,
progress_info->duplicate_count);
}
g_strfreev (temp_strings);
}
g_free (temp_string);
return GNOME_VFS_XFER_ERROR_ACTION_SKIP;
......
......@@ -5414,7 +5414,7 @@ nautilus_icon_container_get_selection (NautilusIconContainer *container)
}
}
return list;
return g_list_reverse (list);
}
/* Returns an array of GdkPoints of locations of the icons. */
......
......@@ -65,14 +65,12 @@ static const GtkTargetEntry drag_types [] = {
{ NAUTILUS_ICON_DND_GNOME_ICON_LIST_TYPE, 0, NAUTILUS_ICON_DND_GNOME_ICON_LIST },
{ NAUTILUS_ICON_DND_URI_LIST_TYPE, 0, NAUTILUS_ICON_DND_URI_LIST },
{ NAUTILUS_ICON_DND_URL_TYPE, 0, NAUTILUS_ICON_DND_URL },
{ NAUTILUS_ICON_DND_TEXT_TYPE, 0, NAUTILUS_ICON_DND_TEXT }
};
static const GtkTargetEntry drop_types [] = {
{ NAUTILUS_ICON_DND_GNOME_ICON_LIST_TYPE, 0, NAUTILUS_ICON_DND_GNOME_ICON_LIST },
{ NAUTILUS_ICON_DND_URI_LIST_TYPE, 0, NAUTILUS_ICON_DND_URI_LIST },
{ NAUTILUS_ICON_DND_URL_TYPE, 0, NAUTILUS_ICON_DND_URL },
{ NAUTILUS_ICON_DND_TEXT_TYPE, 0, NAUTILUS_ICON_DND_TEXT },
{ NAUTILUS_ICON_DND_COLOR_TYPE, 0, NAUTILUS_ICON_DND_COLOR },
{ NAUTILUS_ICON_DND_BGIMAGE_TYPE, 0, NAUTILUS_ICON_DND_BGIMAGE },
{ NAUTILUS_ICON_DND_KEYWORD_TYPE, 0, NAUTILUS_ICON_DND_KEYWORD },
......@@ -376,12 +374,16 @@ get_data_on_first_target_we_support (GtkWidget *widget, GdkDragContext *context,
GList *target;
GtkTargetList *list;
if (drop_types_list == NULL)
if (drop_types_list == NULL) {
drop_types_list = gtk_target_list_new (drop_types,
G_N_ELEMENTS (drop_types) - 1);
if (drop_types_list_root == NULL)
gtk_target_list_add_text_targets (drop_types_list, NAUTILUS_ICON_DND_TEXT);
}
if (drop_types_list_root == NULL) {
drop_types_list_root = gtk_target_list_new (drop_types,
G_N_ELEMENTS (drop_types));
gtk_target_list_add_text_targets (drop_types_list_root, NAUTILUS_ICON_DND_TEXT);
}
if (nautilus_icon_container_get_is_desktop (NAUTILUS_ICON_CONTAINER (widget))) {
list = drop_types_list_root;
......@@ -1696,6 +1698,7 @@ void
nautilus_icon_dnd_init (NautilusIconContainer *container,
GdkBitmap *stipple)
{
GtkTargetList *targets;
int n_elements;
g_return_if_fail (container != NULL);
......@@ -1704,7 +1707,7 @@ nautilus_icon_dnd_init (NautilusIconContainer *container,
container->details->dnd_info = g_new0 (NautilusIconDndInfo, 1);
nautilus_drag_init (&container->details->dnd_info->drag_info,
drag_types, G_N_ELEMENTS (drag_types));
drag_types, G_N_ELEMENTS (drag_types), TRUE);
/* Set up the widget as a drag destination.
* (But not a source, as drags starting from this widget will be
......@@ -1720,6 +1723,9 @@ nautilus_icon_dnd_init (NautilusIconContainer *container,
drop_types, n_elements,
GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK | GDK_ACTION_ASK);
targets = gtk_drag_dest_get_target_list (GTK_WIDGET (container));
gtk_target_list_add_text_targets (targets, NAUTILUS_ICON_DND_TEXT);
/* Messages for outgoing drag. */
g_signal_connect (container, "drag_data_get",
G_CALLBACK (drag_data_get_callback), NULL);
......
......@@ -82,7 +82,6 @@ static const GtkTargetEntry drag_types [] = {
{ NAUTILUS_ICON_DND_GNOME_ICON_LIST_TYPE, 0, NAUTILUS_ICON_DND_GNOME_ICON_LIST },
{ NAUTILUS_ICON_DND_URI_LIST_TYPE, 0, NAUTILUS_ICON_DND_URI_LIST },
{ NAUTILUS_ICON_DND_URL_TYPE, 0, NAUTILUS_ICON_DND_URL },
{ NAUTILUS_ICON_DND_TEXT_TYPE, 0, NAUTILUS_ICON_DND_TEXT }
/* FIXME: Should handle emblems once the list view supports them */
};
......@@ -853,6 +852,7 @@ NautilusTreeViewDragDest *
nautilus_tree_view_drag_dest_new (GtkTreeView *tree_view)
{
NautilusTreeViewDragDest *dest;
GtkTargetList *targets;
dest = g_object_new (NAUTILUS_TYPE_TREE_VIEW_DRAG_DEST, NULL);
......@@ -862,8 +862,11 @@ nautilus_tree_view_drag_dest_new (GtkTreeView *tree_view)
gtk_drag_dest_set (GTK_WIDGET (tree_view),
0, drag_types, G_N_ELEMENTS (drag_types),
GDK_ACTION_MOVE | GDK_ACTION_COPY | GDK_ACTION_LINK | GDK_ACTION_ASK);
GDK_ACTION_MOVE | GDK_ACTION_COPY | GDK_ACTION_LINK | GDK_ACTION_ASK);
targets = gtk_drag_dest_get_target_list (GTK_WIDGET (tree_view));
gtk_target_list_add_text_targets (targets, NAUTILUS_ICON_DND_TEXT);
g_signal_connect_object (tree_view,
"drag_motion",
G_CALLBACK (drag_motion_callback),
......
......@@ -895,7 +895,8 @@ delete_selected_files (FMDirectoryView *view)
file_uris = g_list_prepend (file_uris,
nautilus_file_get_uri ((NautilusFile *) node->data));
}
file_uris = g_list_reverse (file_uris);
if (confirm_delete_directly (view,
file_uris)) {
nautilus_file_operations_delete (file_uris, GTK_WIDGET (view));
......
......@@ -97,7 +97,6 @@ static const GtkTargetEntry drag_types [] = {
{ NAUTILUS_ICON_DND_GNOME_ICON_LIST_TYPE, 0, NAUTILUS_ICON_DND_GNOME_ICON_LIST },
{ NAUTILUS_ICON_DND_URI_LIST_TYPE, 0, NAUTILUS_ICON_DND_URI_LIST },
{ NAUTILUS_ICON_DND_URL_TYPE, 0, NAUTILUS_ICON_DND_URL },
{ NAUTILUS_ICON_DND_TEXT_TYPE, 0, NAUTILUS_ICON_DND_TEXT }
};
static GtkTargetList *drag_target_list = NULL;
......@@ -766,7 +765,8 @@ fm_list_model_multi_drag_data_get (EggTreeMultiDragSource *drag_source,
if (!drag_target_list) {
drag_target_list = gtk_target_list_new
(drag_types, G_N_ELEMENTS (drag_types));
gtk_target_list_add_text_targets (
drag_target_list, NAUTILUS_ICON_DND_TEXT);
}
if (gtk_target_list_find (drag_target_list,
......
<ui>
<accelerator action="ZoomInAccel"/>
<accelerator action="ZoomInAccel2"/>
<accelerator action="ZoomOutAccel"/>
<menubar name="MenuBar">
<menu action="File">
<placeholder name="New Items Placeholder"/>
......
......@@ -105,7 +105,6 @@ static const GtkTargetEntry location_button_drag_types[] = {
{ NAUTILUS_ICON_DND_GNOME_ICON_LIST_TYPE, 0, NAUTILUS_ICON_DND_GNOME_ICON_LIST },
{ NAUTILUS_ICON_DND_URI_LIST_TYPE, 0, NAUTILUS_ICON_DND_URI_LIST },
{ NAUTILUS_ICON_DND_URL_TYPE, 0, NAUTILUS_ICON_DND_URL },
{ NAUTILUS_ICON_DND_TEXT_TYPE, 0, NAUTILUS_ICON_DND_TEXT }
};
GNOME_CLASS_BOILERPLATE (NautilusSpatialWindow, nautilus_spatial_window,
......@@ -787,6 +786,7 @@ nautilus_spatial_window_instance_init (NautilusSpatialWindow *window)
GtkWidget *hbox;
GtkActionGroup *action_group;
GtkUIManager *ui_manager;
GtkTargetList *targets;
const char *ui;
window->details = g_new0 (NautilusSpatialWindowDetails, 1);
......@@ -846,7 +846,10 @@ nautilus_spatial_window_instance_init (NautilusSpatialWindow *window)
"drag_data_get",
G_CALLBACK (location_button_drag_data_get_callback),
window);
targets = gtk_drag_source_get_target_list (window->details->location_button);
gtk_target_list_add_text_targets (targets, NAUTILUS_ICON_DND_TEXT);
gtk_widget_set_sensitive (window->details->location_button, FALSE);
g_signal_connect (window->details->location_button,
"clicked",
......
......@@ -641,10 +641,18 @@ static const GtkActionEntry main_entries[] = {
"ZoomInAccel", "<control>equal", /* label, accelerator */
NULL, /* tooltip */
G_CALLBACK (action_zoom_in_callback) },
{ "ZoomInAccel2", NULL, /* name, stock id */
"ZoomInAccel2", "<control>KP_Add", /* label, accelerator */
NULL, /* tooltip */
G_CALLBACK (action_zoom_in_callback) },
{ "Zoom Out", GTK_STOCK_ZOOM_OUT, /* name, stock id */
N_("Zoom _Out"), "<control>minus", /* label, accelerator */
N_("Show the contents in less detail"), /* tooltip */
G_CALLBACK (action_zoom_out_callback) },
{ "ZoomOutAccel", NULL, /* name, stock id */
"ZoomOutAccel", "<control>KP_Subtract", /* label, accelerator */
NULL, /* tooltip */
G_CALLBACK (action_zoom_out_callback) },
{ "Zoom Normal", GTK_STOCK_ZOOM_100, /* name, stock id */
N_("Normal Si_ze"), "<control>0", /* label, accelerator */
N_("Show the contents at the normal size"), /* tooltip */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment