[gthumb/ext] allow to delete files from a catalog
- From: Paolo Bacchilega <paobac src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gthumb/ext] allow to delete files from a catalog
- Date: Wed, 28 Oct 2009 22:43:16 +0000 (UTC)
commit 1630dad3aec13b5394ac0a0d9609f3f39e8b88a3
Author: Paolo Bacchilega <paobac src gnome org>
Date: Wed Oct 28 23:42:04 2009 +0100
allow to delete files from a catalog
extensions/file_manager/actions.c | 51 ++++++++++++++-------
extensions/file_manager/callbacks.c | 12 +++---
extensions/rename_series/data/ui/rename-series.ui | 3 +-
gthumb/gth-browser.c | 2 +-
4 files changed, 42 insertions(+), 26 deletions(-)
---
diff --git a/extensions/file_manager/actions.c b/extensions/file_manager/actions.c
index 62a233f..91fabbb 100644
--- a/extensions/file_manager/actions.c
+++ b/extensions/file_manager/actions.c
@@ -363,6 +363,22 @@ gth_browser_activate_action_edit_duplicate (GtkAction *action,
static void
+notify_files_delete (GtkWindow *window,
+ GList *files)
+{
+ GFile *parent;
+
+ parent = g_file_get_parent ((GFile*) files->data);
+ gth_monitor_folder_changed (gth_main_get_default_monitor (),
+ parent,
+ files,
+ GTH_MONITOR_EVENT_DELETED);
+
+ g_object_unref (parent);
+}
+
+
+static void
delete_file_permanently (GtkWindow *window,
GList *file_list)
{
@@ -370,20 +386,10 @@ delete_file_permanently (GtkWindow *window,
GError *error = NULL;
files = gth_file_data_list_to_file_list (file_list);
- if (! _g_delete_files (files, TRUE, &error)) {
+ if (! _g_delete_files (files, TRUE, &error))
_gtk_error_dialog_from_gerror_show (window, _("Could not delete the files"), &error);
- }
- else {
- GFile *parent;
-
- parent = g_file_get_parent ((GFile*) files->data);
- gth_monitor_folder_changed (gth_main_get_default_monitor (),
- parent,
- files,
- GTH_MONITOR_EVENT_DELETED);
-
- g_object_unref (parent);
- }
+ else
+ notify_files_delete (window, files);
_g_object_list_unref (files);
}
@@ -408,10 +414,11 @@ void
gth_browser_activate_action_edit_trash (GtkAction *action,
GthBrowser *browser)
{
- GList *items;
- GList *file_list = NULL;
- GList *scan;
- GError *error = NULL;
+ GList *items;
+ GList *file_list = NULL;
+ GList *scan;
+ GError *error = NULL;
+ gboolean moved_to_trash = TRUE;
items = gth_file_selection_get_selected (GTH_FILE_SELECTION (gth_browser_get_file_list_view (browser)));
file_list = gth_file_list_get_files (GTH_FILE_LIST (gth_browser_get_file_list (browser)), items);
@@ -438,10 +445,20 @@ gth_browser_activate_action_edit_trash (GtkAction *action,
break;
}
_gtk_error_dialog_from_gerror_show (GTK_WINDOW (browser), _("Could not move the files to the Trash"), &error);
+ moved_to_trash = FALSE;
break;
}
}
+ if (moved_to_trash) {
+ GList *files;
+
+ files = gth_file_data_list_to_file_list (file_list);
+ notify_files_delete (GTK_WINDOW (browser), files);
+
+ _g_object_list_unref (files);
+ }
+
_g_object_list_unref (file_list);
_gtk_tree_path_list_free (items);
}
diff --git a/extensions/file_manager/callbacks.c b/extensions/file_manager/callbacks.c
index 98a7dcc..d84d15f 100644
--- a/extensions/file_manager/callbacks.c
+++ b/extensions/file_manager/callbacks.c
@@ -80,6 +80,12 @@ static const char *browser_ui_info =
" </placeholder>"
" </menu>"
" </menubar>"
+" <popup name='FileListPopup'>"
+" <placeholder name='Folder_Actions'>"
+" <menuitem action='Edit_Trash'/>"
+" <menuitem action='Edit_Delete'/>"
+" </placeholder>"
+" </popup>"
"</ui>";
@@ -92,12 +98,6 @@ static const char *browser_vfs_ui_info =
" </placeholder>"
" </menu>"
" </menubar>"
-" <popup name='FileListPopup'>"
-" <placeholder name='Folder_Actions'>"
-" <menuitem action='Edit_Trash'/>"
-" <menuitem action='Edit_Delete'/>"
-" </placeholder>"
-" </popup>"
"</ui>";
diff --git a/extensions/rename_series/data/ui/rename-series.ui b/extensions/rename_series/data/ui/rename-series.ui
index 359bf7c..edcffa1 100644
--- a/extensions/rename_series/data/ui/rename-series.ui
+++ b/extensions/rename_series/data/ui/rename-series.ui
@@ -495,8 +495,8 @@
<object class="GtkSizeGroup" id="sizegroup1">
<property name="mode">vertical</property>
<widgets>
- <widget name="label1"/>
<widget name="template_entry"/>
+ <widget name="label1"/>
</widgets>
</object>
<object class="GtkAdjustment" id="start_at_adjustment">
@@ -504,6 +504,5 @@
<property name="upper">1000000000</property>
<property name="step_increment">1</property>
<property name="page_increment">10</property>
- <property name="page_size">10</property>
</object>
</interface>
diff --git a/gthumb/gth-browser.c b/gthumb/gth-browser.c
index 5d00200..b6daf91 100644
--- a/gthumb/gth-browser.c
+++ b/gthumb/gth-browser.c
@@ -2475,7 +2475,7 @@ folder_changed_cb (GthMonitor *monitor,
|| ((path != NULL) && gth_folder_tree_is_loaded (GTH_FOLDER_TREE (browser->priv->folder_tree), path)));
update_file_list = g_file_equal (parent, browser->priv->location->file);
- if (! update_file_list && (event == GTH_MONITOR_EVENT_CHANGED)) {
+ if (! update_file_list && (event != GTH_MONITOR_EVENT_CREATED)) {
GthFileStore *file_store;
GList *scan;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]