[gthumb] Improved insertion of files in catalogs
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gthumb] Improved insertion of files in catalogs
- Date: Mon, 4 Jul 2011 19:17:30 +0000 (UTC)
commit 815c3edfab2c937438ddcc657fde5b0739cd97c0
Author: Paolo Bacchilega <paobac src gnome org>
Date: Mon Jul 4 21:17:00 2011 +0200
Improved insertion of files in catalogs
* when using the paste command the files are inserted after the last selected
file;
* when using drag&drop the files are inserted in the current position as
when moving files inside a catalog.
[bug #371697]
extensions/catalogs/callbacks.c | 3 +-
extensions/catalogs/gth-file-source-catalogs.c | 26 ++++++++++++----
extensions/change_date/gth-change-date-task.c | 5 ++-
extensions/file_manager/actions.c | 18 ++++++++++-
extensions/file_manager/callbacks.c | 17 +++++++---
extensions/file_manager/gth-copy-task.c | 6 +++-
extensions/file_manager/gth-copy-task.h | 3 +-
extensions/find_duplicates/gth-find-duplicates.c | 3 +-
gthumb/glib-utils.c | 1 +
gthumb/gth-browser.c | 34 ++++++++++++++-------
gthumb/gth-file-list.c | 14 +++++---
gthumb/gth-file-list.h | 3 +-
gthumb/gth-file-source-vfs.c | 1 +
gthumb/gth-file-source.c | 9 ++++-
gthumb/gth-file-source.h | 2 +
gthumb/gth-file-store.c | 35 +++++++++++++++-------
gthumb/gth-file-store.h | 6 ++-
gthumb/gth-marshal.list | 1 +
gthumb/gth-monitor.c | 24 +++++++++++++-
gthumb/gth-monitor.h | 5 +++
gthumb/gth-source-tree.c | 1 +
21 files changed, 164 insertions(+), 53 deletions(-)
---
diff --git a/extensions/catalogs/callbacks.c b/extensions/catalogs/callbacks.c
index afac9c1..58edbd4 100644
--- a/extensions/catalogs/callbacks.c
+++ b/extensions/catalogs/callbacks.c
@@ -194,6 +194,7 @@ static void
monitor_folder_changed_cb (GthMonitor *monitor,
GFile *parent,
GList *list,
+ int position,
GthMonitorEvent event,
gpointer user_data)
{
@@ -230,7 +231,7 @@ catalogs__gth_browser_construct_cb (GthBrowser *browser)
}
data->monitor_events = g_signal_connect (gth_main_get_default_monitor (),
- "folder_changed",
+ "folder-changed",
G_CALLBACK (monitor_folder_changed_cb),
data);
diff --git a/extensions/catalogs/gth-file-source-catalogs.c b/extensions/catalogs/gth-file-source-catalogs.c
index 8f11d79..5ce5006 100644
--- a/extensions/catalogs/gth-file-source-catalogs.c
+++ b/extensions/catalogs/gth-file-source-catalogs.c
@@ -658,6 +658,7 @@ typedef struct {
GthFileSource *file_source;
GthFileData *destination;
GList *file_list;
+ int destination_position;
ProgressCallback progress_callback;
DialogCallback dialog_callback;
ReadyCallback ready_callback;
@@ -687,11 +688,12 @@ copy__catalog_save_done_cb (void **buffer,
{
CopyOpData *cod = user_data;
- if (error == NULL)
- gth_monitor_folder_changed (gth_main_get_default_monitor (),
- cod->destination->file,
- cod->files,
- GTH_MONITOR_EVENT_CREATED);
+ if (error == NULL) {
+ gth_monitor_files_created_with_pos (gth_main_get_default_monitor (),
+ cod->destination->file,
+ cod->files,
+ cod->destination_position);
+ }
cod->ready_callback (G_OBJECT (cod->file_source), error, cod->user_data);
copy_op_data_free (cod);
@@ -704,6 +706,7 @@ catalog_ready_cb (GObject *catalog,
gpointer user_data)
{
CopyOpData *cod = user_data;
+ int position;
GList *scan;
char *buffer;
gsize size;
@@ -717,8 +720,15 @@ catalog_ready_cb (GObject *catalog,
cod->catalog = (GthCatalog *) catalog;
- for (scan = cod->files; scan; scan = scan->next)
- gth_catalog_insert_file (cod->catalog, (GFile *) scan->data, -1);
+ if (cod->destination_position >= 0)
+ gth_catalog_set_order (cod->catalog, "general::unsorted", FALSE);
+
+ position = cod->destination_position;
+ for (scan = cod->files; scan; scan = scan->next) {
+ gth_catalog_insert_file (cod->catalog, (GFile *) scan->data, position);
+ if (cod->destination_position >= 0) /* always append to the end if destination_position is -1 */
+ position += 1;
+ }
buffer = gth_catalog_to_data (cod->catalog, &size);
gio_file = gth_catalog_file_to_gio_file (cod->destination->file);
@@ -941,6 +951,7 @@ gth_file_source_catalogs_copy (GthFileSource *file_source,
GthFileData *destination,
GList *file_list, /* GFile * list */
gboolean move,
+ int destination_position,
ProgressCallback progress_callback,
DialogCallback dialog_callback,
ReadyCallback ready_callback,
@@ -1007,6 +1018,7 @@ gth_file_source_catalogs_copy (GthFileSource *file_source,
cod->file_source = g_object_ref (file_source);
cod->destination = g_object_ref (destination);
cod->file_list = _g_object_list_ref (file_list);
+ cod->destination_position = destination_position;
cod->progress_callback = progress_callback;
cod->dialog_callback = dialog_callback;
cod->ready_callback = ready_callback;
diff --git a/extensions/change_date/gth-change-date-task.c b/extensions/change_date/gth-change-date-task.c
index 8b4f24c..f569962 100644
--- a/extensions/change_date/gth-change-date-task.c
+++ b/extensions/change_date/gth-change-date-task.c
@@ -139,7 +139,10 @@ update_modification_time (GthChangeDateTask *self)
monitor = gth_main_get_default_monitor ();
files = gth_file_data_list_to_file_list (self->priv->file_list);
- gth_monitor_folder_changed (monitor, self->priv->location, files, GTH_MONITOR_EVENT_CHANGED);
+ gth_monitor_folder_changed (monitor,
+ self->priv->location,
+ files,
+ GTH_MONITOR_EVENT_CHANGED);
gth_task_completed (GTH_TASK (self), error);
diff --git a/extensions/file_manager/actions.c b/extensions/file_manager/actions.c
index 1d9aed1..305b607 100644
--- a/extensions/file_manager/actions.c
+++ b/extensions/file_manager/actions.c
@@ -296,6 +296,8 @@ clipboard_received_cb (GtkClipboard *clipboard,
const char *raw_data;
char **clipboard_data;
int i;
+ GtkTreePath *path;
+ int position;
GthTask *task;
raw_data = (const char *) gtk_selection_data_get_data (selection_data);
@@ -342,10 +344,22 @@ clipboard_received_cb (GtkClipboard *clipboard,
paste_data->cut = FALSE;
}
+ position = -1;
+ path = gth_file_selection_get_last_selected (GTH_FILE_SELECTION (gth_browser_get_file_list_view (browser)));
+ if (path != NULL) {
+ int *indices;
+
+ indices = gtk_tree_path_get_indices (path);
+ if (indices != NULL)
+ position = indices[0] + 1;
+ gtk_tree_path_free (path);
+ }
+
task = gth_copy_task_new (paste_data->file_source,
paste_data->destination,
paste_data->cut,
- paste_data->files);
+ paste_data->files,
+ position);
gth_browser_exec_task (browser, task, FALSE);
g_object_unref (task);
@@ -797,7 +811,7 @@ copy_files_to_folder (GthBrowser *browser,
data->destination = g_file_dup (destination_data->file);
data->view_destination = view_destination;
- task = gth_copy_task_new (file_source, destination_data, move, files);
+ task = gth_copy_task_new (file_source, destination_data, move, files, -1);
g_signal_connect (task,
"completed",
G_CALLBACK (copy_complete_cb),
diff --git a/extensions/file_manager/callbacks.c b/extensions/file_manager/callbacks.c
index 13c0871..7150e1e 100644
--- a/extensions/file_manager/callbacks.c
+++ b/extensions/file_manager/callbacks.c
@@ -363,13 +363,16 @@ gth_file_list_drag_data_received (GtkWidget *file_view,
if (! cancel) {
GthFileSource *location_source;
+ BrowserData *data;
GthTask *task;
location_source = gth_main_get_file_source (gth_browser_get_location (browser));
+ data = g_object_get_data (G_OBJECT (browser), BROWSER_DATA_KEY);
task = gth_copy_task_new (location_source,
gth_browser_get_location_data (browser),
move,
- selected_files);
+ selected_files,
+ data->drop_pos);
gth_browser_exec_task (browser, task, FALSE);
g_object_unref (task);
@@ -439,17 +442,20 @@ gth_file_list_drag_motion (GtkWidget *file_view,
BrowserData *data;
data = g_object_get_data (G_OBJECT (browser), BROWSER_DATA_KEY);
+ data->drop_pos = -1;
if ((gtk_drag_get_source_widget (context) == file_view) && ! gth_file_source_is_reorderable (gth_browser_get_location_source (browser))) {
- data->drop_pos = -1;
gdk_drag_status (context, 0, time);
return FALSE;
}
- if ((gtk_drag_get_source_widget (context) == file_view) && gth_file_source_is_reorderable (gth_browser_get_location_source (browser))) {
+ if (gth_file_source_is_reorderable (gth_browser_get_location_source (browser))) {
GtkAllocation allocation;
- gdk_drag_status (context, GDK_ACTION_MOVE, time);
+ if (gtk_drag_get_source_widget (context) == file_view)
+ gdk_drag_status (context, GDK_ACTION_MOVE, time);
+ else
+ gdk_drag_status (context, GDK_ACTION_COPY, time);
gth_file_view_set_drag_dest_pos (GTH_FILE_VIEW (file_view), context, x, y, time, &data->drop_pos);
gtk_widget_get_allocation (file_view, &allocation);
@@ -775,7 +781,8 @@ fm__gth_browser_folder_tree_drag_data_received_cb (GthBrowser *browser,
task = gth_copy_task_new (file_source,
destination,
(action == GDK_ACTION_MOVE),
- file_list);
+ file_list,
+ -1);
gth_browser_exec_task (browser, task, FALSE);
g_object_unref (task);
diff --git a/extensions/file_manager/gth-copy-task.c b/extensions/file_manager/gth-copy-task.c
index f8406aa..257496f 100644
--- a/extensions/file_manager/gth-copy-task.c
+++ b/extensions/file_manager/gth-copy-task.c
@@ -28,6 +28,7 @@ struct _GthCopyTaskPrivate {
GthFileSource *file_source;
GList *files;
gboolean move;
+ int destination_position;
};
@@ -103,6 +104,7 @@ gth_copy_task_exec (GthTask *task)
self->priv->destination,
self->priv->files,
self->priv->move,
+ self->priv->destination_position,
copy_progress_cb,
copy_dialog_cb,
copy_done_cb,
@@ -166,7 +168,8 @@ GthTask *
gth_copy_task_new (GthFileSource *file_source,
GthFileData *destination,
gboolean move,
- GList *files)
+ GList *files,
+ int destination_position)
{
GthCopyTask *self;
@@ -176,6 +179,7 @@ gth_copy_task_new (GthFileSource *file_source,
self->priv->destination = g_object_ref (destination);
self->priv->move = move;
self->priv->files = _g_object_list_ref (files);
+ self->priv->destination_position = destination_position;
return (GthTask *) self;
}
diff --git a/extensions/file_manager/gth-copy-task.h b/extensions/file_manager/gth-copy-task.h
index 17021f6..c663b8d 100644
--- a/extensions/file_manager/gth-copy-task.h
+++ b/extensions/file_manager/gth-copy-task.h
@@ -51,7 +51,8 @@ GType gth_copy_task_get_type (void);
GthTask * gth_copy_task_new (GthFileSource *file_source,
GthFileData *destination,
gboolean move,
- GList *file_list);
+ GList *file_list,
+ int destination_position);
G_END_DECLS
diff --git a/extensions/find_duplicates/gth-find-duplicates.c b/extensions/find_duplicates/gth-find-duplicates.c
index 72d1285..4e78c68 100644
--- a/extensions/find_duplicates/gth-find-duplicates.c
+++ b/extensions/find_duplicates/gth-find-duplicates.c
@@ -431,7 +431,7 @@ file_input_stream_read_ready_cb (GObject *source,
singleton = g_list_append (NULL, d_data->file_data);
if (d_data->n_files == 2)
- gth_file_list_add_files (GTH_FILE_LIST (self->priv->duplicates_list), singleton);
+ gth_file_list_add_files (GTH_FILE_LIST (self->priv->duplicates_list), singleton, -1);
else
gth_file_list_update_files (GTH_FILE_LIST (self->priv->duplicates_list), singleton);
g_list_free (singleton);
@@ -488,6 +488,7 @@ static void
folder_changed_cb (GthMonitor *monitor,
GFile *parent,
GList *list,
+ int position,
GthMonitorEvent event,
gpointer user_data)
{
diff --git a/gthumb/glib-utils.c b/gthumb/glib-utils.c
index a53ffa4..d5595b6 100644
--- a/gthumb/glib-utils.c
+++ b/gthumb/glib-utils.c
@@ -1191,6 +1191,7 @@ _g_string_append_for_html (GString *str,
state = 0;
break;
}
+ break;
}
p = next;
diff --git a/gthumb/gth-browser.c b/gthumb/gth-browser.c
index 00cccbb..a9fff33 100644
--- a/gthumb/gth-browser.c
+++ b/gthumb/gth-browser.c
@@ -198,6 +198,7 @@ typedef struct {
int ref;
GthFileSource *file_source;
GFile *parent;
+ int position;
GthMonitorEvent event;
GthBrowser *browser;
gboolean update_file_list;
@@ -2843,6 +2844,17 @@ filterbar_close_button_clicked_cb (GthFilterbar *filterbar,
static void
+_gth_browser_change_file_list_order (GthBrowser *browser,
+ int *new_order)
+{
+ g_file_info_set_attribute_string (browser->priv->location->info, "sort::type", "general::unsorted");
+ g_file_info_set_attribute_boolean (browser->priv->location->info, "sort::inverse", FALSE);
+ gth_file_store_reorder (gth_browser_get_file_store (browser), new_order);
+ gth_browser_update_title (browser);
+}
+
+
+static void
file_attributes_ready_cb (GthFileSource *file_source,
GList *files,
GError *error,
@@ -2864,9 +2876,14 @@ file_attributes_ready_cb (GthFileSource *file_source,
if (monitor_data->update_folder_tree)
gth_folder_tree_add_children (GTH_FOLDER_TREE (browser->priv->folder_tree), monitor_data->parent, visible_folders);
if (monitor_data->update_file_list) {
- gth_file_list_add_files (GTH_FILE_LIST (browser->priv->file_list), files);
+ if (monitor_data->position >= 0)
+ _gth_browser_set_sort_order (browser,
+ gth_main_get_sort_type ("general::unsorted"),
+ FALSE,
+ FALSE);
+ gth_file_list_add_files (GTH_FILE_LIST (browser->priv->file_list), files, monitor_data->position);
gth_file_list_update_files (GTH_FILE_LIST (browser->priv->file_list), files);
- gth_file_list_add_files (GTH_FILE_LIST (browser->priv->thumbnail_list), files);
+ gth_file_list_add_files (GTH_FILE_LIST (browser->priv->thumbnail_list), files, monitor_data->position);
gth_file_list_update_files (GTH_FILE_LIST (browser->priv->thumbnail_list), files);
}
}
@@ -2931,6 +2948,7 @@ static void
folder_changed_cb (GthMonitor *monitor,
GFile *parent,
GList *list,
+ int position,
GthMonitorEvent event,
GthBrowser *browser)
{
@@ -2990,6 +3008,7 @@ folder_changed_cb (GthMonitor *monitor,
monitor_data = monitor_event_data_new ();
monitor_data->file_source = gth_main_get_file_source (parent);
monitor_data->parent = g_file_dup (parent);
+ monitor_data->position = position;
monitor_data->event = event;
monitor_data->browser = browser;
monitor_data->update_file_list = update_file_list;
@@ -3261,15 +3280,8 @@ order_changed_cb (GthMonitor *monitor,
int *new_order,
GthBrowser *browser)
{
- if (browser->priv->location == NULL)
- return;
-
- if (g_file_equal (file, browser->priv->location->file)) {
- g_file_info_set_attribute_string (browser->priv->location->info, "sort::type", "general::unsorted");
- g_file_info_set_attribute_boolean (browser->priv->location->info, "sort::inverse", FALSE);
- gth_file_store_reorder (gth_browser_get_file_store (browser), new_order);
- gth_browser_update_title (browser);
- }
+ if ((browser->priv->location != NULL) && g_file_equal (file, browser->priv->location->file))
+ _gth_browser_change_file_list_order (browser, new_order);
}
diff --git a/gthumb/gth-file-list.c b/gthumb/gth-file-list.c
index eed8fa7..e0bf82c 100644
--- a/gthumb/gth-file-list.c
+++ b/gthumb/gth-file-list.c
@@ -72,6 +72,7 @@ typedef struct {
int ival;
GFile *file;
GthFileData *file_data;
+ int position;
} GthFileListOp;
@@ -986,7 +987,8 @@ _gth_file_list_get_metadata (GthFileList *file_list,
static void
gfl_add_files (GthFileList *file_list,
- GList *files)
+ GList *files,
+ int position)
{
GthFileStore *file_store;
GList *scan;
@@ -1038,19 +1040,21 @@ gfl_add_files (GthFileList *file_list,
}
g_free (cache_base_uri);
- gth_file_store_exec_add (file_store);
+ gth_file_store_exec_add (file_store, position);
_gth_file_list_update_pane (file_list);
}
void
gth_file_list_add_files (GthFileList *file_list,
- GList *files)
+ GList *files,
+ int position)
{
GthFileListOp *op;
op = gth_file_list_op_new (GTH_FILE_LIST_OP_TYPE_ADD_FILES);
op->file_list = _g_object_list_ref (files);
+ op->position = position;
_gth_file_list_queue_op (file_list, op);
}
@@ -1202,7 +1206,7 @@ gfl_set_files (GthFileList *file_list,
gth_file_store_clear ((GthFileStore*) gth_file_view_get_model (GTH_FILE_VIEW (file_list->priv->view)));
g_hash_table_remove_all (file_list->priv->thumb_data);
- gfl_add_files (file_list, files);
+ gfl_add_files (file_list, files, -1);
}
@@ -1946,7 +1950,7 @@ _gth_file_list_exec_next_op (GthFileList *file_list)
gfl_set_files (file_list, op->file_list);
break;
case GTH_FILE_LIST_OP_TYPE_ADD_FILES:
- gfl_add_files (file_list, op->file_list);
+ gfl_add_files (file_list, op->file_list, op->position);
break;
case GTH_FILE_LIST_OP_TYPE_DELETE_FILES:
gfl_delete_files (file_list, op->files);
diff --git a/gthumb/gth-file-list.h b/gthumb/gth-file-list.h
index 7a62b9b..5ae1ada 100644
--- a/gthumb/gth-file-list.h
+++ b/gthumb/gth-file-list.h
@@ -78,7 +78,8 @@ GList * gth_file_list_get_files (GthFileList *file_li
void gth_file_list_clear (GthFileList *file_list,
const char *message);
void gth_file_list_add_files (GthFileList *file_list,
- GList *list /* GthFileData */);
+ GList *list /* GthFileData */,
+ int position);
void gth_file_list_delete_files (GthFileList *file_list,
GList *list /* GFile */);
void gth_file_list_update_files (GthFileList *file_list,
diff --git a/gthumb/gth-file-source-vfs.c b/gthumb/gth-file-source-vfs.c
index 2489335..b968941 100644
--- a/gthumb/gth-file-source-vfs.c
+++ b/gthumb/gth-file-source-vfs.c
@@ -338,6 +338,7 @@ gth_file_source_vfs_copy (GthFileSource *file_source,
GthFileData *destination,
GList *file_list, /* GFile * list */
gboolean move,
+ int destination_position,
ProgressCallback progress_callback,
DialogCallback dialog_callback,
ReadyCallback ready_callback,
diff --git a/gthumb/gth-file-source.c b/gthumb/gth-file-source.c
index 1338a59..175ba83 100644
--- a/gthumb/gth-file-source.c
+++ b/gthumb/gth-file-source.c
@@ -86,6 +86,7 @@ typedef struct {
GthFileData *destination;
GList *file_list;
gboolean move;
+ int destination_position;
ProgressCallback progress_callback;
DialogCallback dialog_callback;
ReadyCallback ready_callback;
@@ -335,6 +336,7 @@ gth_file_source_queue_copy (GthFileSource *file_source,
GthFileData *destination,
GList *file_list,
gboolean move,
+ int destination_position,
ProgressCallback progress_callback,
DialogCallback dialog_callback,
ReadyCallback ready_callback,
@@ -348,6 +350,7 @@ gth_file_source_queue_copy (GthFileSource *file_source,
async_op->data.copy.destination = gth_file_data_dup (destination);
async_op->data.copy.file_list = _g_file_list_dup (file_list);
async_op->data.copy.move = move;
+ async_op->data.copy.destination_position = destination_position;
async_op->data.copy.progress_callback = progress_callback;
async_op->data.copy.dialog_callback = dialog_callback;
async_op->data.copy.ready_callback = ready_callback;
@@ -469,6 +472,7 @@ gth_file_source_exec_next_in_queue (GthFileSource *file_source)
async_op->data.copy.destination,
async_op->data.copy.file_list,
async_op->data.copy.move,
+ async_op->data.copy.destination_position,
async_op->data.copy.progress_callback,
async_op->data.copy.dialog_callback,
async_op->data.copy.ready_callback,
@@ -1174,17 +1178,18 @@ gth_file_source_copy (GthFileSource *file_source,
GthFileData *destination,
GList *file_list, /* GFile * list */
gboolean move,
+ int destination_position,
ProgressCallback progress_callback,
DialogCallback dialog_callback,
ReadyCallback ready_callback,
gpointer data)
{
if (gth_file_source_is_active (file_source)) {
- gth_file_source_queue_copy (file_source, destination, file_list, move, progress_callback, dialog_callback, ready_callback, data);
+ gth_file_source_queue_copy (file_source, destination, file_list, move, destination_position, progress_callback, dialog_callback, ready_callback, data);
return;
}
g_cancellable_reset (file_source->priv->cancellable);
- GTH_FILE_SOURCE_GET_CLASS (G_OBJECT (file_source))->copy (file_source, destination, file_list, move, progress_callback, dialog_callback, ready_callback, data);
+ GTH_FILE_SOURCE_GET_CLASS (G_OBJECT (file_source))->copy (file_source, destination, file_list, move, destination_position, progress_callback, dialog_callback, ready_callback, data);
}
diff --git a/gthumb/gth-file-source.h b/gthumb/gth-file-source.h
index 90334e8..73f6c03 100644
--- a/gthumb/gth-file-source.h
+++ b/gthumb/gth-file-source.h
@@ -103,6 +103,7 @@ struct _GthFileSourceClass
GthFileData *destination,
GList *file_list, /* GFile list */
gboolean move,
+ int destination_position,
ProgressCallback progress_callback,
DialogCallback dialog_callback,
ReadyCallback callback,
@@ -186,6 +187,7 @@ void gth_file_source_copy (GthFileSource *file
GthFileData *destination,
GList *file_list, /* GFile list */
gboolean move,
+ int destination_position,
ProgressCallback progress_callback,
DialogCallback dialog_callback,
ReadyCallback ready_callback,
diff --git a/gthumb/gth-file-store.c b/gthumb/gth-file-store.c
index 834e1af..15c11b7 100644
--- a/gthumb/gth-file-store.c
+++ b/gthumb/gth-file-store.c
@@ -800,7 +800,8 @@ _gth_file_store_hide_row (GthFileStore *file_store,
static void
_gth_file_store_update_visibility (GthFileStore *file_store,
- GList *add_queue)
+ GList *add_queue,
+ int position)
{
GthFileRow **all_rows = NULL;
guint all_rows_n = 0;
@@ -825,11 +826,21 @@ g_print ("UPDATE VISIBILITY\n");
all_rows_n = file_store->priv->tot_rows + g_list_length (add_queue);
all_rows = g_new (GthFileRow *, all_rows_n);
- for (i = 0; i < file_store->priv->tot_rows; i++)
- all_rows[i] = _gth_file_row_copy (file_store->priv->all_rows[i]);
+ /* append to the end if position is -1 */
+
+ if (position == -1)
+ position = file_store->priv->tot_rows;
+
+ /* insert the new rows at position */
+
+ j = 0;
+ for (i = 0; i < position; i++)
+ all_rows[j++] = _gth_file_row_copy (file_store->priv->all_rows[i]);
for (scan = add_queue; scan; scan = scan->next)
- all_rows[i++] = (GthFileRow *) scan->data;
+ all_rows[j++] = (GthFileRow *) scan->data;
+ for (i = position; i < file_store->priv->tot_rows; i++)
+ all_rows[j++] = _gth_file_row_copy (file_store->priv->all_rows[i]);
old_rows_n = file_store->priv->num_rows;
old_rows = g_new (GthFileRow *, old_rows_n);
@@ -1070,7 +1081,7 @@ gth_file_store_set_filter (GthFileStore *file_store,
else
file_store->priv->filter = gth_test_new ();
- _gth_file_store_update_visibility (file_store, NULL);
+ _gth_file_store_update_visibility (file_store, NULL, -1);
}
@@ -1397,10 +1408,11 @@ gth_file_store_add (GthFileStore *file_store,
GdkPixbuf *thumbnail,
gboolean is_icon,
const char *metadata,
- gboolean checked)
+ gboolean checked,
+ int position)
{
gth_file_store_queue_add (file_store, file, thumbnail, is_icon, metadata, checked);
- gth_file_store_exec_add (file_store);
+ gth_file_store_exec_add (file_store, position);
}
@@ -1428,9 +1440,10 @@ gth_file_store_queue_add (GthFileStore *file_store,
void
-gth_file_store_exec_add (GthFileStore *file_store)
+gth_file_store_exec_add (GthFileStore *file_store,
+ int position)
{
- _gth_file_store_update_visibility (file_store, file_store->priv->queue);
+ _gth_file_store_update_visibility (file_store, file_store->priv->queue, position);
_gth_file_store_clear_queue (file_store);
}
@@ -1542,7 +1555,7 @@ gth_file_store_exec_set (GthFileStore *file_store)
_gth_file_store_list_changed (file_store);
_gth_file_store_clear_queue (file_store);
if (file_store->priv->update_filter) {
- _gth_file_store_update_visibility (file_store, NULL);
+ _gth_file_store_update_visibility (file_store, NULL, -1);
file_store->priv->update_filter = FALSE;
}
else if (file_store->priv->check_changed) {
@@ -1596,7 +1609,7 @@ gth_file_store_exec_remove (GthFileStore *file_store)
_gth_file_store_compact_rows (file_store);
_gth_file_store_clear_queue (file_store);
- _gth_file_store_update_visibility (file_store, NULL);
+ _gth_file_store_update_visibility (file_store, NULL, -1);
}
diff --git a/gthumb/gth-file-store.h b/gthumb/gth-file-store.h
index 9132c20..564eff5 100644
--- a/gthumb/gth-file-store.h
+++ b/gthumb/gth-file-store.h
@@ -106,14 +106,16 @@ void gth_file_store_add (GthFileStore *file_sto
GdkPixbuf *thumbnail,
gboolean is_icon,
const char *metadata,
- gboolean checked);
+ gboolean checked,
+ int position);
void gth_file_store_queue_add (GthFileStore *file_store,
GthFileData *file,
GdkPixbuf *thumbnail,
gboolean is_icon,
const char *metadata,
gboolean checked);
-void gth_file_store_exec_add (GthFileStore *file_store);
+void gth_file_store_exec_add (GthFileStore *file_store,
+ int position);
void gth_file_store_set (GthFileStore *file_store,
GtkTreeIter *iter,
...);
diff --git a/gthumb/gth-marshal.list b/gthumb/gth-marshal.list
index 3ab5c7d..e419c1a 100644
--- a/gthumb/gth-marshal.list
+++ b/gthumb/gth-marshal.list
@@ -3,6 +3,7 @@ VOID:ENUM, ENUM
VOID:INT, INT
VOID:OBJECT, BOOLEAN
VOID:OBJECT, BOXED, ENUM
+VOID:OBJECT, BOXED, INT, ENUM
VOID:OBJECT, OBJECT
VOID:OBJECT, OBJECT, INT, INT, POINTER
VOID:OBJECT, POINTER
diff --git a/gthumb/gth-monitor.c b/gthumb/gth-monitor.c
index 7d133ac..b440517 100644
--- a/gthumb/gth-monitor.c
+++ b/gthumb/gth-monitor.c
@@ -126,11 +126,12 @@ gth_monitor_class_init (GthMonitorClass *class)
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GthMonitorClass, folder_changed),
NULL, NULL,
- gth_marshal_VOID__OBJECT_BOXED_ENUM,
+ gth_marshal_VOID__OBJECT_BOXED_INT_ENUM,
G_TYPE_NONE,
- 3,
+ 4,
G_TYPE_OBJECT,
G_TYPE_OBJECT_LIST,
+ G_TYPE_INT,
GTH_TYPE_MONITOR_EVENT);
monitor_signals[FILE_RENAMED] =
g_signal_new ("file-renamed",
@@ -282,11 +283,30 @@ gth_monitor_folder_changed (GthMonitor *monitor,
0,
parent,
list,
+ -1,
event);
}
void
+gth_monitor_files_created_with_pos (GthMonitor *monitor,
+ GFile *parent,
+ GList *list, /* GFile list */
+ int position)
+{
+ g_return_if_fail (GTH_IS_MONITOR (monitor));
+
+ g_signal_emit (G_OBJECT (monitor),
+ monitor_signals[FOLDER_CONTENT_CHANGED],
+ 0,
+ parent,
+ list,
+ position,
+ GTH_MONITOR_EVENT_CREATED);
+}
+
+
+void
gth_monitor_file_renamed (GthMonitor *monitor,
GFile *file,
GFile *new_file)
diff --git a/gthumb/gth-monitor.h b/gthumb/gth-monitor.h
index d72a33f..dd40995 100644
--- a/gthumb/gth-monitor.h
+++ b/gthumb/gth-monitor.h
@@ -66,6 +66,7 @@ struct _GthMonitorClass
void (*folder_changed) (GthMonitor *monitor,
GFile *parent,
GList *list,
+ int position,
GthMonitorEvent event);
void (*file_renamed) (GthMonitor *monitor,
GFile *file,
@@ -90,6 +91,10 @@ void gth_monitor_folder_changed (GthMonitor *monitor,
GFile *parent,
GList *list, /* GFile list */
GthMonitorEvent event);
+void gth_monitor_files_created_with_pos (GthMonitor *monitor,
+ GFile *parent,
+ GList *list, /* GFile list */
+ int position);
void gth_monitor_file_renamed (GthMonitor *monitor,
GFile *file,
GFile *new_file);
diff --git a/gthumb/gth-source-tree.c b/gthumb/gth-source-tree.c
index 81a90a4..76e1941 100644
--- a/gthumb/gth-source-tree.c
+++ b/gthumb/gth-source-tree.c
@@ -237,6 +237,7 @@ static void
monitor_folder_changed_cb (GthMonitor *monitor,
GFile *parent,
GList *list,
+ int position,
GthMonitorEvent event,
GthSourceTree *source_tree)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]