From f8f42ebf382a7bdd199f93823c8734169b702612 Mon Sep 17 00:00:00 2001 From: Benedikt Meurer <benny@xfce.org> Date: Tue, 27 Sep 2005 22:14:26 +0000 Subject: [PATCH] 2005-09-27 Benedikt Meurer <benny@xfce.org> * configure.in.in: Substitute platform flags properly. * thunar/Makefile.am: Don't delete thunar-thumbnail-frame.h. * thunar/thunar-standard-view.c(thunar_standard_view_selection_changed): Use ngettext() for the Cut/Copy File(s) actions. * thunar/thunar-file.{c,h}: Add new virtual method get_actions(), which is used to support custom actions for certain files (e.g. the Empty Trash Bin action for the trash file). * thunar/thunar-application.{c,h}: Add thunar_application_delete_uris() to be able to easily delete arbitrary files. * thunar/thunar-trash-file.c(thunar_trash_file_new): Use thunar_file_destroy() instead of gtk_object_destroy(). * thunar/thunar-trash-folder.c: Implement the get_actions() method with the "Empty Trash Bin" action. * thunar/thunar-standard-view-ui.xml, thunar/thunar-standard-view.c: Extend the extension menu merge mechanism to also load custom actions provided by ThunarFile implementations. * thunar/thunar-file.c(thunar_file_accepts_uri_drop): Fix typo. * thunar/thunar-trash-folder.c: Watch files for changes. * thunar/thunar-favourites-view.c (thunar_favourites_view_button_press_event): Add custom actions to the favourite context menu. * TODO: Drop completed item. * configure.in.in: Disable strict aliasing if debugging is enabled and the compiler supports the -fno-strict-aliasing switch. * po/*.po: Update translations. * main.c(main): Initialize file properly. * thunar/thunar-file.c(thunar_local_file_is_renameable): Don't permit users to rename root nodes. * thunar/thunar-open-with-action.c(thunar_open_with_action_menu_mapped): Use "Other Application..." instead of just "Other...". (Old svn revision: 17872) --- ChangeLog | 33 ++++++++ TODO | 7 -- configure.in.in | 21 +++++ po/de.po | 99 ++++++++++++++-------- po/el.po | 103 +++++++++++++++-------- po/hu.po | 103 +++++++++++++++-------- po/ja.po | 102 ++++++++++++++-------- thunar/Makefile.am | 2 +- thunar/main.c | 2 +- thunar/thunar-application.c | 67 ++++++++++++--- thunar/thunar-application.h | 4 + thunar/thunar-favourites-view.c | 43 +++++++++- thunar/thunar-file.c | 30 ++++++- thunar/thunar-file.h | 14 ++- thunar/thunar-local-file.c | 14 +-- thunar/thunar-open-with-action.c | 2 +- thunar/thunar-standard-view-ui.xml | 4 +- thunar/thunar-standard-view.c | 124 ++++++++++++++++----------- thunar/thunar-trash-file.c | 2 +- thunar/thunar-trash-folder.c | 131 ++++++++++++++++++++++++++++- 20 files changed, 679 insertions(+), 228 deletions(-) diff --git a/ChangeLog b/ChangeLog index d8d153e65..dfa6eb9e7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,36 @@ +2005-09-27 Benedikt Meurer <benny@xfce.org> + + * configure.in.in: Substitute platform flags properly. + * thunar/Makefile.am: Don't delete thunar-thumbnail-frame.h. + * thunar/thunar-standard-view.c(thunar_standard_view_selection_changed): + Use ngettext() for the Cut/Copy File(s) actions. + * thunar/thunar-file.{c,h}: Add new virtual method get_actions(), which + is used to support custom actions for certain files (e.g. the Empty + Trash Bin action for the trash file). + * thunar/thunar-application.{c,h}: Add thunar_application_delete_uris() + to be able to easily delete arbitrary files. + * thunar/thunar-trash-file.c(thunar_trash_file_new): Use + thunar_file_destroy() instead of gtk_object_destroy(). + * thunar/thunar-trash-folder.c: Implement the get_actions() method with + the "Empty Trash Bin" action. + * thunar/thunar-standard-view-ui.xml, thunar/thunar-standard-view.c: + Extend the extension menu merge mechanism to also load custom actions + provided by ThunarFile implementations. + * thunar/thunar-file.c(thunar_file_accepts_uri_drop): Fix typo. + * thunar/thunar-trash-folder.c: Watch files for changes. + * thunar/thunar-favourites-view.c + (thunar_favourites_view_button_press_event): Add custom actions to the + favourite context menu. + * TODO: Drop completed item. + * configure.in.in: Disable strict aliasing if debugging is enabled and + the compiler supports the -fno-strict-aliasing switch. + * po/*.po: Update translations. + * main.c(main): Initialize file properly. + * thunar/thunar-file.c(thunar_local_file_is_renameable): Don't permit + users to rename root nodes. + * thunar/thunar-open-with-action.c(thunar_open_with_action_menu_mapped): + Use "Other Application..." instead of just "Other...". + 2005-09-23 Benedikt Meurer <benny@xfce.org> * thunar/thunar-details-view.c(thunar_details_view_button_press_event), diff --git a/TODO b/TODO index 2e0825cd1..8f1b49ea2 100644 --- a/TODO +++ b/TODO @@ -22,13 +22,6 @@ Important for Thunar 1.0 - Check getmntinfo() or getfsstat() for ThunarVfsVolumeManagerBSD, which might be faster than several statfs() calls. - - ThunarFavouritesModel should include the 'Trash' in the default system - favourites list, given the user the ability to atleast empty the trash - by right-clicking on the favourite and choosing 'Empty trash bin' from - the context menu. An optional, yet tricky feature, would be to allow - dropping files to the trash bin in the favourites pane (not for 1.0 I'd - say). - - The layouting code for ThunarLocationButtons is still buggy. Problem shows with paths that include a very long directory; you cannot scroll to the last path component then. diff --git a/configure.in.in b/configure.in.in index c97e00243..59fdcb8a6 100644 --- a/configure.in.in +++ b/configure.in.in @@ -202,6 +202,20 @@ AC_MSG_CHECKING([whether to enable debugging support]) if test x"$enable_debug" != x"no"; then PLATFORM_CFLAGS="$PLATFORM_CFLAGS -O0 -g3 -DG_DISABLE_DEPRECATED -Werror -Wall" AC_MSG_RESULT([yes]) + + dnl Check whether the compiler accepts the -fno-strict-aliasing + dnl switch, as certain packages - like Glib - still don't work + dnl properly with newer compilers. + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -fno-strict-aliasing" + AC_MSG_CHECKING([whether $CC accepts -fno-strict-aliasing]) + AC_COMPILE_IFELSE(AC_LANG_SOURCE([int x;]), [ + AC_MSG_RESULT([yes]) + PLATFORM_CFLAGS="$PLATFORM_CFLAGS -fno-strict-aliasing" + ], [ + AC_MSG_RESULT([no]) + ]) + CFLAGS="$save_CFLAGS" else PLATFORM_CPPFLAGS="$PLATFORM_CPPFLAGS -DG_DISABLE_ASSERT -DG_DISABLE_CAST_CHECKS -DG_DISABLE_CHECKS" AC_MSG_RESULT([no]) @@ -258,6 +272,13 @@ if test x"$have_gnuc_visibility" = x"yes"; then fi AM_CONDITIONAL([HAVE_GNUC_VISIBILITY], [test x"$have_gnuc_visibility" = x"yes"]) +dnl ********************************* +dnl *** Substitute platform flags *** +dnl ********************************* +AC_SUBST([PLATFORM_CFLAGS]) +AC_SUBST([PLATFORM_CPPFLAGS]) +AC_SUBST([PLATFORM_LDFLAGS]) + AC_OUTPUT([ Makefile docs/Makefile diff --git a/po/de.po b/po/de.po index 3bec1f69c..b8b8c77b2 100644 --- a/po/de.po +++ b/po/de.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Thunar 0.0.2\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2005-09-22 23:04+0200\n" +"POT-Creation-Date: 2005-09-27 23:46+0200\n" "PO-Revision-Date: 2005-08-03 22:30+0200\n" "Last-Translator: Benedikt Meurer <benny@xfce.org>\n" "Language-Team: German <de@li.org>\n" @@ -179,6 +179,11 @@ msgstr "" msgid "Moving files..." msgstr "" +#. let the application take care of the dialog +#: ../thunar/thunar-application.c:432 +msgid "Deleting files..." +msgstr "" + #: ../thunar/thunar-clipboard-manager.c:148 msgid "Can paste" msgstr "" @@ -257,34 +262,34 @@ msgid "Detailed directory listing" msgstr "" #. append the remove menu item -#: ../thunar/thunar-favourites-view.c:250 +#: ../thunar/thunar-favourites-view.c:291 msgid "_Remove Favourite" msgstr "" #. append the rename menu item -#: ../thunar/thunar-favourites-view.c:265 +#: ../thunar/thunar-favourites-view.c:306 msgid "Re_name Favourite" msgstr "" -#: ../thunar/thunar-favourites-view.c:585 +#: ../thunar/thunar-favourites-view.c:626 #, c-format msgid "The URI '%s' does not refer to a directory" msgstr "" -#: ../thunar/thunar-favourites-view.c:610 +#: ../thunar/thunar-favourites-view.c:651 msgid "Could not add favourite" msgstr "" -#: ../thunar/thunar-file.c:459 +#: ../thunar/thunar-file.c:460 #, c-format msgid "Failed to determine parent URI for '%s'" msgstr "" -#: ../thunar/thunar-file.c:492 +#: ../thunar/thunar-file.c:493 msgid "Unable to rename file" msgstr "" -#: ../thunar/thunar-folder.c:134 ../thunar/thunar-standard-view.c:331 +#: ../thunar/thunar-folder.c:134 ../thunar/thunar-standard-view.c:333 #: ../thunar/thunar-statusbar.c:203 ../thunar/thunar-statusbar.c:745 #: ../thunar/thunar-view.c:82 msgid "Loading" @@ -665,102 +670,106 @@ msgid "%s (%u Bytes)" msgstr "" #: ../thunar/thunar-properties-dialog.c:681 -#: ../thunar/thunar-standard-view.c:1760 +#: ../thunar/thunar-standard-view.c:1787 #, c-format msgid "Failed to rename %s." msgstr "" -#: ../thunar/thunar-standard-view.c:214 +#: ../thunar/thunar-standard-view.c:216 msgid "File Context Menu" msgstr "" -#: ../thunar/thunar-standard-view.c:215 +#: ../thunar/thunar-standard-view.c:217 msgid "Folder Context Menu" msgstr "" -#: ../thunar/thunar-standard-view.c:216 +#: ../thunar/thunar-standard-view.c:218 msgid "_Properties" msgstr "" -#: ../thunar/thunar-standard-view.c:216 +#: ../thunar/thunar-standard-view.c:218 msgid "View the properties of the selected item" msgstr "" -#: ../thunar/thunar-standard-view.c:217 ../thunar/thunar-standard-view.c:2005 +#: ../thunar/thunar-standard-view.c:219 msgid "_Copy files" msgstr "" -#: ../thunar/thunar-standard-view.c:218 ../thunar/thunar-standard-view.c:2011 +#: ../thunar/thunar-standard-view.c:220 msgid "Cu_t files" msgstr "" -#: ../thunar/thunar-standard-view.c:219 +#: ../thunar/thunar-standard-view.c:221 msgid "_Paste files" msgstr "" -#: ../thunar/thunar-standard-view.c:220 +#: ../thunar/thunar-standard-view.c:222 msgid "Paste files into folder" msgstr "" -#: ../thunar/thunar-standard-view.c:220 +#: ../thunar/thunar-standard-view.c:222 msgid "Paste files into the selected folder" msgstr "" -#: ../thunar/thunar-standard-view.c:221 +#: ../thunar/thunar-standard-view.c:223 msgid "Select _all files" msgstr "" -#: ../thunar/thunar-standard-view.c:221 +#: ../thunar/thunar-standard-view.c:223 msgid "Select all files in this window" msgstr "" -#: ../thunar/thunar-standard-view.c:222 +#: ../thunar/thunar-standard-view.c:224 msgid "Select by _pattern" msgstr "" -#: ../thunar/thunar-standard-view.c:222 +#: ../thunar/thunar-standard-view.c:224 msgid "Select all files that match a certain pattern" msgstr "" -#: ../thunar/thunar-standard-view.c:223 +#: ../thunar/thunar-standard-view.c:225 msgid "_Rename" msgstr "" -#: ../thunar/thunar-standard-view.c:223 +#: ../thunar/thunar-standard-view.c:225 msgid "Rename the selected item" msgstr "" -#: ../thunar/thunar-standard-view.c:228 +#: ../thunar/thunar-standard-view.c:230 msgid "Show _hidden files" msgstr "" -#: ../thunar/thunar-standard-view.c:228 +#: ../thunar/thunar-standard-view.c:230 msgid "Toggles the display of hidden files in the current window" msgstr "" -#: ../thunar/thunar-standard-view.c:332 ../thunar/thunar-view.c:83 +#: ../thunar/thunar-standard-view.c:334 ../thunar/thunar-view.c:83 msgid "Whether the view is currently being loaded" msgstr "" -#: ../thunar/thunar-standard-view.c:834 +#: ../thunar/thunar-standard-view.c:836 msgid "Loading folder contents..." msgstr "" -#: ../thunar/thunar-standard-view.c:1347 +#: ../thunar/thunar-standard-view.c:1374 msgid "Select by pattern" msgstr "" -#: ../thunar/thunar-standard-view.c:1362 +#: ../thunar/thunar-standard-view.c:1389 msgid "Pattern:" msgstr "" -#: ../thunar/thunar-standard-view.c:2005 +#: ../thunar/thunar-standard-view.c:2031 msgid "_Copy file" -msgstr "" +msgid_plural "_Copy files" +msgstr[0] "" +msgstr[1] "" -#: ../thunar/thunar-standard-view.c:2011 +#: ../thunar/thunar-standard-view.c:2037 msgid "Cu_t file" -msgstr "" +msgid_plural "Cu_t files" +msgstr[0] "" +msgstr[1] "" #: ../thunar/thunar-statusbar.c:190 msgid "The file whose icon to display" @@ -802,10 +811,30 @@ msgstr "" msgid "The wrap width" msgstr "" -#: ../thunar/thunar-trash-folder.c:240 +#: ../thunar/thunar-trash-folder.c:258 msgid "Trash" msgstr "" +#. prepare the "Empty Trash Bin" action +#: ../thunar/thunar-trash-folder.c:287 +msgid "_Empty Trash Bin" +msgstr "" + +#: ../thunar/thunar-trash-folder.c:287 +msgid "Delete all items in the Trash" +msgstr "" + +#: ../thunar/thunar-trash-folder.c:414 +msgid "Are you sure that you want to delete all trashed files?" +msgstr "" + +#: ../thunar/thunar-trash-folder.c:416 +#, c-format +msgid "This will delete %d file currently located in the trash bin." +msgid_plural "This will delete %d files currently located in the trash bin." +msgstr[0] "" +msgstr[1] "" + #: ../thunar/thunar-view.c:99 msgid "Text to be displayed in the statusbar associated with this view" msgstr "" diff --git a/po/el.po b/po/el.po index cf8017ef2..f1f6de6b3 100644 --- a/po/el.po +++ b/po/el.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: thunar\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2005-09-22 23:04+0200\n" +"POT-Creation-Date: 2005-09-27 23:46+0200\n" "PO-Revision-Date: 2005-08-05 21:53+0200\n" "Last-Translator: Stavros Giannouris <stavrosg2002@freemail.gr>\n" "Language-Team: Greek <nls@tux.hellug.gr>\n" @@ -186,6 +186,12 @@ msgstr "ΑντιγÏαφή αÏχείων..." msgid "Moving files..." msgstr "Μετακίνηση αÏχείων..." +#. let the application take care of the dialog +#: ../thunar/thunar-application.c:432 +#, fuzzy +msgid "Deleting files..." +msgstr "Συλλογή αÏχείων..." + #: ../thunar/thunar-clipboard-manager.c:148 msgid "Can paste" msgstr "Δυνατότητα επικόλλησης" @@ -264,37 +270,37 @@ msgid "Detailed directory listing" msgstr "" #. append the remove menu item -#: ../thunar/thunar-favourites-view.c:250 +#: ../thunar/thunar-favourites-view.c:291 #, fuzzy msgid "_Remove Favourite" msgstr "_ΑπομάκÏυνση αγαπημÎνου" #. append the rename menu item -#: ../thunar/thunar-favourites-view.c:265 +#: ../thunar/thunar-favourites-view.c:306 #, fuzzy msgid "Re_name Favourite" msgstr "_ΑπομάκÏυνση αγαπημÎνου" -#: ../thunar/thunar-favourites-view.c:585 +#: ../thunar/thunar-favourites-view.c:626 #, c-format msgid "The URI '%s' does not refer to a directory" msgstr "" -#: ../thunar/thunar-favourites-view.c:610 +#: ../thunar/thunar-favourites-view.c:651 msgid "Could not add favourite" msgstr "Αδυναμία Ï€Ïοσθήκης αγαπημÎνου" -#: ../thunar/thunar-file.c:459 +#: ../thunar/thunar-file.c:460 #, c-format msgid "Failed to determine parent URI for '%s'" msgstr "" -#: ../thunar/thunar-file.c:492 +#: ../thunar/thunar-file.c:493 #, fuzzy msgid "Unable to rename file" msgstr "ΑδÏνατο το άνοιγμα αÏχείου %s." -#: ../thunar/thunar-folder.c:134 ../thunar/thunar-standard-view.c:331 +#: ../thunar/thunar-folder.c:134 ../thunar/thunar-standard-view.c:333 #: ../thunar/thunar-statusbar.c:203 ../thunar/thunar-statusbar.c:745 #: ../thunar/thunar-view.c:82 msgid "Loading" @@ -680,103 +686,109 @@ msgid "%s (%u Bytes)" msgstr "%s (%u Bytes)" #: ../thunar/thunar-properties-dialog.c:681 -#: ../thunar/thunar-standard-view.c:1760 +#: ../thunar/thunar-standard-view.c:1787 #, fuzzy, c-format msgid "Failed to rename %s." msgstr "ΑδÏνατη η αφαίÏεση του %s." -#: ../thunar/thunar-standard-view.c:214 +#: ../thunar/thunar-standard-view.c:216 msgid "File Context Menu" msgstr "" -#: ../thunar/thunar-standard-view.c:215 +#: ../thunar/thunar-standard-view.c:217 msgid "Folder Context Menu" msgstr "" -#: ../thunar/thunar-standard-view.c:216 +#: ../thunar/thunar-standard-view.c:218 msgid "_Properties" msgstr "_Ιδιότητες" -#: ../thunar/thunar-standard-view.c:216 +#: ../thunar/thunar-standard-view.c:218 msgid "View the properties of the selected item" msgstr "Î Ïοβολή των ιδιοτήτων του επιλεγμÎνου αντικειμÎνου" -#: ../thunar/thunar-standard-view.c:217 ../thunar/thunar-standard-view.c:2005 +#: ../thunar/thunar-standard-view.c:219 msgid "_Copy files" msgstr "_ΑντιγÏαφή ΑÏχείων" -#: ../thunar/thunar-standard-view.c:218 ../thunar/thunar-standard-view.c:2011 +#: ../thunar/thunar-standard-view.c:220 msgid "Cu_t files" msgstr "Αποκοπή _ΑÏχείων" -#: ../thunar/thunar-standard-view.c:219 +#: ../thunar/thunar-standard-view.c:221 msgid "_Paste files" msgstr "_Επικόλληση ΑÏχείων" -#: ../thunar/thunar-standard-view.c:220 +#: ../thunar/thunar-standard-view.c:222 msgid "Paste files into folder" msgstr "_Επικόλληση ΑÏχείων στο φάκελο" -#: ../thunar/thunar-standard-view.c:220 +#: ../thunar/thunar-standard-view.c:222 msgid "Paste files into the selected folder" msgstr "Επικόλληση αÏχείων στον επιλεγμÎνο φάκελο" -#: ../thunar/thunar-standard-view.c:221 +#: ../thunar/thunar-standard-view.c:223 msgid "Select _all files" msgstr "Επιλογή ÏŒ_λων των αÏχείων" -#: ../thunar/thunar-standard-view.c:221 +#: ../thunar/thunar-standard-view.c:223 msgid "Select all files in this window" msgstr "Επιλογή όλων των αÏχείων σε αυτό το παÏάθυÏο" -#: ../thunar/thunar-standard-view.c:222 +#: ../thunar/thunar-standard-view.c:224 msgid "Select by _pattern" msgstr "Επιλογή βάσει _μοτίβου" -#: ../thunar/thunar-standard-view.c:222 +#: ../thunar/thunar-standard-view.c:224 msgid "Select all files that match a certain pattern" msgstr "Επιλογή όλων των αÏχείων που ταιÏιάζουν σε Îνα μοτίβο" -#: ../thunar/thunar-standard-view.c:223 +#: ../thunar/thunar-standard-view.c:225 msgid "_Rename" msgstr "" -#: ../thunar/thunar-standard-view.c:223 +#: ../thunar/thunar-standard-view.c:225 #, fuzzy msgid "Rename the selected item" msgstr "Î Ïοβολή των ιδιοτήτων του επιλεγμÎνου αντικειμÎνου" -#: ../thunar/thunar-standard-view.c:228 +#: ../thunar/thunar-standard-view.c:230 msgid "Show _hidden files" msgstr "Εμφάνιση _ΚÏυφών ΑÏχείων" -#: ../thunar/thunar-standard-view.c:228 +#: ../thunar/thunar-standard-view.c:230 msgid "Toggles the display of hidden files in the current window" msgstr "Εναλλάσσει την εμφάνιση κÏυφών αÏχείων στο Ï„ÏÎχον παÏάθυÏο" -#: ../thunar/thunar-standard-view.c:332 ../thunar/thunar-view.c:83 +#: ../thunar/thunar-standard-view.c:334 ../thunar/thunar-view.c:83 msgid "Whether the view is currently being loaded" msgstr "" -#: ../thunar/thunar-standard-view.c:834 +#: ../thunar/thunar-standard-view.c:836 msgid "Loading folder contents..." msgstr "ΦόÏτωμα πεÏιεχομÎνων φακÎλου..." -#: ../thunar/thunar-standard-view.c:1347 +#: ../thunar/thunar-standard-view.c:1374 msgid "Select by pattern" msgstr "Επιλογή βάσει μοτίβου" -#: ../thunar/thunar-standard-view.c:1362 +#: ../thunar/thunar-standard-view.c:1389 msgid "Pattern:" msgstr "Μοτίβο:" -#: ../thunar/thunar-standard-view.c:2005 +#: ../thunar/thunar-standard-view.c:2031 +#, fuzzy msgid "_Copy file" -msgstr "_ΑντιγÏαφή ΑÏχείου" +msgid_plural "_Copy files" +msgstr[0] "_ΑντιγÏαφή ΑÏχείου" +msgstr[1] "_ΑντιγÏαφή ΑÏχείου" -#: ../thunar/thunar-standard-view.c:2011 +#: ../thunar/thunar-standard-view.c:2037 +#, fuzzy msgid "Cu_t file" -msgstr "Α_ποκοπή ΑÏχείου" +msgid_plural "Cu_t files" +msgstr[0] "Α_ποκοπή ΑÏχείου" +msgstr[1] "Α_ποκοπή ΑÏχείου" #: ../thunar/thunar-statusbar.c:190 msgid "The file whose icon to display" @@ -818,10 +830,31 @@ msgstr "" msgid "The wrap width" msgstr "" -#: ../thunar/thunar-trash-folder.c:240 +#: ../thunar/thunar-trash-folder.c:258 msgid "Trash" msgstr "ΑποÏÏίμματα" +#. prepare the "Empty Trash Bin" action +#: ../thunar/thunar-trash-folder.c:287 +msgid "_Empty Trash Bin" +msgstr "" + +#: ../thunar/thunar-trash-folder.c:287 +#, fuzzy +msgid "Delete all items in the Trash" +msgstr "Επιλογή όλων των αÏχείων σε αυτό το παÏάθυÏο" + +#: ../thunar/thunar-trash-folder.c:414 +msgid "Are you sure that you want to delete all trashed files?" +msgstr "" + +#: ../thunar/thunar-trash-folder.c:416 +#, c-format +msgid "This will delete %d file currently located in the trash bin." +msgid_plural "This will delete %d files currently located in the trash bin." +msgstr[0] "" +msgstr[1] "" + #: ../thunar/thunar-view.c:99 msgid "Text to be displayed in the statusbar associated with this view" msgstr "" diff --git a/po/hu.po b/po/hu.po index a589c0704..9b096cacf 100644 --- a/po/hu.po +++ b/po/hu.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Thunar 0.0.2\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2005-09-22 23:04+0200\n" +"POT-Creation-Date: 2005-09-27 23:46+0200\n" "PO-Revision-Date: 2005-08-04 00:45+0100\n" "Last-Translator: SZERVÃC Attila <sas@321.hu>\n" "Language-Team: Hungarian <hu@li.org>\n" @@ -191,6 +191,12 @@ msgstr "Fájlok másolása..." msgid "Moving files..." msgstr "Fájlok mozgatása..." +#. let the application take care of the dialog +#: ../thunar/thunar-application.c:432 +#, fuzzy +msgid "Deleting files..." +msgstr "Fájlok gyűjtése..." + #: ../thunar/thunar-clipboard-manager.c:148 msgid "Can paste" msgstr "BeilleszthetÅ‘" @@ -269,35 +275,35 @@ msgid "Detailed directory listing" msgstr "Részletes könyvtárlista" #. append the remove menu item -#: ../thunar/thunar-favourites-view.c:250 +#: ../thunar/thunar-favourites-view.c:291 msgid "_Remove Favourite" msgstr "" #. append the rename menu item -#: ../thunar/thunar-favourites-view.c:265 +#: ../thunar/thunar-favourites-view.c:306 msgid "Re_name Favourite" msgstr "" -#: ../thunar/thunar-favourites-view.c:585 +#: ../thunar/thunar-favourites-view.c:626 #, c-format msgid "The URI '%s' does not refer to a directory" msgstr "" -#: ../thunar/thunar-favourites-view.c:610 +#: ../thunar/thunar-favourites-view.c:651 msgid "Could not add favourite" msgstr "" -#: ../thunar/thunar-file.c:459 +#: ../thunar/thunar-file.c:460 #, c-format msgid "Failed to determine parent URI for '%s'" msgstr "Nem sikerült meghatározni a szülÅ‘ URI-t ehhez: %s" -#: ../thunar/thunar-file.c:492 +#: ../thunar/thunar-file.c:493 #, fuzzy msgid "Unable to rename file" msgstr "Nem nyitható meg e fájl: %s" -#: ../thunar/thunar-folder.c:134 ../thunar/thunar-standard-view.c:331 +#: ../thunar/thunar-folder.c:134 ../thunar/thunar-standard-view.c:333 #: ../thunar/thunar-statusbar.c:203 ../thunar/thunar-statusbar.c:745 #: ../thunar/thunar-view.c:82 msgid "Loading" @@ -682,105 +688,111 @@ msgid "%s (%u Bytes)" msgstr "%s (%u bájt)" #: ../thunar/thunar-properties-dialog.c:681 -#: ../thunar/thunar-standard-view.c:1760 +#: ../thunar/thunar-standard-view.c:1787 #, fuzzy, c-format msgid "Failed to rename %s." msgstr "Nem törölhetÅ‘: %s" -#: ../thunar/thunar-standard-view.c:214 +#: ../thunar/thunar-standard-view.c:216 #, fuzzy msgid "File Context Menu" msgstr "Helyi menü" -#: ../thunar/thunar-standard-view.c:215 +#: ../thunar/thunar-standard-view.c:217 #, fuzzy msgid "Folder Context Menu" msgstr "Helyi menü" -#: ../thunar/thunar-standard-view.c:216 +#: ../thunar/thunar-standard-view.c:218 msgid "_Properties" msgstr "Tulajdonságok" -#: ../thunar/thunar-standard-view.c:216 +#: ../thunar/thunar-standard-view.c:218 msgid "View the properties of the selected item" msgstr "A kijelölt elem tulajdonságai" -#: ../thunar/thunar-standard-view.c:217 ../thunar/thunar-standard-view.c:2005 +#: ../thunar/thunar-standard-view.c:219 msgid "_Copy files" msgstr "Fájlok másolása" -#: ../thunar/thunar-standard-view.c:218 ../thunar/thunar-standard-view.c:2011 +#: ../thunar/thunar-standard-view.c:220 msgid "Cu_t files" msgstr "Fájlok kivágása" -#: ../thunar/thunar-standard-view.c:219 +#: ../thunar/thunar-standard-view.c:221 msgid "_Paste files" msgstr "Fájlok beillesztése" -#: ../thunar/thunar-standard-view.c:220 +#: ../thunar/thunar-standard-view.c:222 msgid "Paste files into folder" msgstr "Fájlok mappába illesztése" -#: ../thunar/thunar-standard-view.c:220 +#: ../thunar/thunar-standard-view.c:222 msgid "Paste files into the selected folder" msgstr "Fájlok beillesztése a kijelölt mappába" -#: ../thunar/thunar-standard-view.c:221 +#: ../thunar/thunar-standard-view.c:223 msgid "Select _all files" msgstr "Minden fájl kiválasztása" -#: ../thunar/thunar-standard-view.c:221 +#: ../thunar/thunar-standard-view.c:223 msgid "Select all files in this window" msgstr "Minden fájlt kiválaszt ebbÅ‘l az ablakból" -#: ../thunar/thunar-standard-view.c:222 +#: ../thunar/thunar-standard-view.c:224 msgid "Select by _pattern" msgstr "Kijelölés mintával" -#: ../thunar/thunar-standard-view.c:222 +#: ../thunar/thunar-standard-view.c:224 msgid "Select all files that match a certain pattern" msgstr "Egy adott mintára illÅ‘ valamennyi fájl kiválasztása" -#: ../thunar/thunar-standard-view.c:223 +#: ../thunar/thunar-standard-view.c:225 msgid "_Rename" msgstr "" -#: ../thunar/thunar-standard-view.c:223 +#: ../thunar/thunar-standard-view.c:225 #, fuzzy msgid "Rename the selected item" msgstr "A kijelölt elem tulajdonságai" -#: ../thunar/thunar-standard-view.c:228 +#: ../thunar/thunar-standard-view.c:230 msgid "Show _hidden files" msgstr "Rejtett fájlok mutatása" -#: ../thunar/thunar-standard-view.c:228 +#: ../thunar/thunar-standard-view.c:230 msgid "Toggles the display of hidden files in the current window" msgstr "A rejtett fájlok mutatását váltja a jelen ablakban" -#: ../thunar/thunar-standard-view.c:332 ../thunar/thunar-view.c:83 +#: ../thunar/thunar-standard-view.c:334 ../thunar/thunar-view.c:83 msgid "Whether the view is currently being loaded" msgstr "A nézet betöltését adja meg" -#: ../thunar/thunar-standard-view.c:834 +#: ../thunar/thunar-standard-view.c:836 msgid "Loading folder contents..." msgstr "Mappa beolvasása..." -#: ../thunar/thunar-standard-view.c:1347 +#: ../thunar/thunar-standard-view.c:1374 msgid "Select by pattern" msgstr "Kijelölés mintával" -#: ../thunar/thunar-standard-view.c:1362 +#: ../thunar/thunar-standard-view.c:1389 msgid "Pattern:" msgstr "Minta:" -#: ../thunar/thunar-standard-view.c:2005 +#: ../thunar/thunar-standard-view.c:2031 +#, fuzzy msgid "_Copy file" -msgstr "Fájl másolás" +msgid_plural "_Copy files" +msgstr[0] "Fájl másolás" +msgstr[1] "Fájl másolás" -#: ../thunar/thunar-standard-view.c:2011 +#: ../thunar/thunar-standard-view.c:2037 +#, fuzzy msgid "Cu_t file" -msgstr "Fájl kivágás" +msgid_plural "Cu_t files" +msgstr[0] "Fájl kivágás" +msgstr[1] "Fájl kivágás" #: ../thunar/thunar-statusbar.c:190 msgid "The file whose icon to display" @@ -823,10 +835,31 @@ msgstr "" msgid "The wrap width" msgstr "" -#: ../thunar/thunar-trash-folder.c:240 +#: ../thunar/thunar-trash-folder.c:258 msgid "Trash" msgstr "Kuka" +#. prepare the "Empty Trash Bin" action +#: ../thunar/thunar-trash-folder.c:287 +msgid "_Empty Trash Bin" +msgstr "" + +#: ../thunar/thunar-trash-folder.c:287 +#, fuzzy +msgid "Delete all items in the Trash" +msgstr "Minden fájlt kiválaszt ebbÅ‘l az ablakból" + +#: ../thunar/thunar-trash-folder.c:414 +msgid "Are you sure that you want to delete all trashed files?" +msgstr "" + +#: ../thunar/thunar-trash-folder.c:416 +#, c-format +msgid "This will delete %d file currently located in the trash bin." +msgid_plural "This will delete %d files currently located in the trash bin." +msgstr[0] "" +msgstr[1] "" + #: ../thunar/thunar-view.c:99 msgid "Text to be displayed in the statusbar associated with this view" msgstr "E nézet állapotsorának szövege" diff --git a/po/ja.po b/po/ja.po index 36c9dfde1..c9b9eeaeb 100644 --- a/po/ja.po +++ b/po/ja.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: Thunar 0.1.2svn-r\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2005-09-24 15:57+0900\n" +"POT-Creation-Date: 2005-09-27 23:46+0200\n" "PO-Revision-Date: 2005-09-24 15:58+0900\n" "Last-Translator: Daichi Kawahata <daichi@xfce.org>\n" "Language-Team: Japanese <xfce-users-jp@ml.fdiary.net>\n" @@ -193,6 +193,12 @@ msgstr "ファイルをコピーã—ã¦ã„ã¾ã™..." msgid "Moving files..." msgstr "ファイルを移動ã—ã¦ã„ã¾ã™..." +#. let the application take care of the dialog +#: ../thunar/thunar-application.c:432 +#, fuzzy +msgid "Deleting files..." +msgstr "ファイルを集ã‚ã¦ã„ã¾ã™..." + #: ../thunar/thunar-clipboard-manager.c:148 msgid "Can paste" msgstr "貼り付ã‘å¯èƒ½" @@ -271,34 +277,34 @@ msgid "Detailed directory listing" msgstr "詳細ãªãƒ•ã‚©ãƒ«ãƒ€å†…容をリスト表示ã—ã¾ã™" #. append the remove menu item -#: ../thunar/thunar-favourites-view.c:250 +#: ../thunar/thunar-favourites-view.c:291 msgid "_Remove Favourite" msgstr "ãŠæ°—ã«å…¥ã‚Šã‚’削除(_R)" #. append the rename menu item -#: ../thunar/thunar-favourites-view.c:265 +#: ../thunar/thunar-favourites-view.c:306 msgid "Re_name Favourite" msgstr "ãŠæ°—ã«å…¥ã‚Šã®åå‰ã‚’変更(_N)" -#: ../thunar/thunar-favourites-view.c:585 +#: ../thunar/thunar-favourites-view.c:626 #, c-format msgid "The URI '%s' does not refer to a directory" msgstr "URI '%s' ã¯ãƒ•ã‚©ãƒ«ãƒ€ã‚’å‚ç…§ã—ã¦ã„ã¾ã›ã‚“" -#: ../thunar/thunar-favourites-view.c:610 +#: ../thunar/thunar-favourites-view.c:651 msgid "Could not add favourite" msgstr "ãŠæ°—ã«å…¥ã‚Šã‚’è¿½åŠ ã§ãã¾ã›ã‚“ã§ã—ãŸ" -#: ../thunar/thunar-file.c:459 +#: ../thunar/thunar-file.c:460 #, c-format msgid "Failed to determine parent URI for '%s'" msgstr "'%s' ã®è¦ª URI を確定ã™ã‚‹ã®ã«å¤±æ•—ã—ã¾ã—ãŸ" -#: ../thunar/thunar-file.c:492 +#: ../thunar/thunar-file.c:493 msgid "Unable to rename file" msgstr "ファイルåを変更ã§ãã¾ã›ã‚“" -#: ../thunar/thunar-folder.c:134 ../thunar/thunar-standard-view.c:331 +#: ../thunar/thunar-folder.c:134 ../thunar/thunar-standard-view.c:333 #: ../thunar/thunar-statusbar.c:203 ../thunar/thunar-statusbar.c:745 #: ../thunar/thunar-view.c:82 msgid "Loading" @@ -673,102 +679,106 @@ msgid "%s (%u Bytes)" msgstr "%s (%u ãƒã‚¤ãƒˆ)" #: ../thunar/thunar-properties-dialog.c:681 -#: ../thunar/thunar-standard-view.c:1760 +#: ../thunar/thunar-standard-view.c:1787 #, c-format msgid "Failed to rename %s." msgstr "%s ã®åå‰å¤‰æ›´ã«å¤±æ•—ã—ã¾ã—ãŸã€‚" -#: ../thunar/thunar-standard-view.c:214 +#: ../thunar/thunar-standard-view.c:216 msgid "File Context Menu" msgstr "ファイル・コンテã‚スト・メニュー" -#: ../thunar/thunar-standard-view.c:215 +#: ../thunar/thunar-standard-view.c:217 msgid "Folder Context Menu" msgstr "フォルダ・コンテã‚スト・メニュー" -#: ../thunar/thunar-standard-view.c:216 +#: ../thunar/thunar-standard-view.c:218 msgid "_Properties" msgstr "プãƒãƒ‘ティ(_P)" -#: ../thunar/thunar-standard-view.c:216 +#: ../thunar/thunar-standard-view.c:218 msgid "View the properties of the selected item" msgstr "é¸æŠžã—ãŸã‚¢ã‚¤ãƒ†ãƒ ã®ãƒ—ãƒãƒ‘ティを表示ã—ã¾ã™" -#: ../thunar/thunar-standard-view.c:217 ../thunar/thunar-standard-view.c:2005 +#: ../thunar/thunar-standard-view.c:219 msgid "_Copy files" msgstr "コピー(_C)" -#: ../thunar/thunar-standard-view.c:218 ../thunar/thunar-standard-view.c:2011 +#: ../thunar/thunar-standard-view.c:220 msgid "Cu_t files" msgstr "切りå–ã‚Š(_T)" -#: ../thunar/thunar-standard-view.c:219 +#: ../thunar/thunar-standard-view.c:221 msgid "_Paste files" msgstr "貼り付ã‘(_P)" -#: ../thunar/thunar-standard-view.c:220 +#: ../thunar/thunar-standard-view.c:222 msgid "Paste files into folder" msgstr "ファイルをフォルダã«è²¼ã‚Šä»˜ã‘" -#: ../thunar/thunar-standard-view.c:220 +#: ../thunar/thunar-standard-view.c:222 msgid "Paste files into the selected folder" msgstr "é¸æŠžã—ãŸãƒ•ã‚©ãƒ«ãƒ€ã«ãƒ•ã‚¡ã‚¤ãƒ«ã‚’貼り付ã‘ã¾ã™" -#: ../thunar/thunar-standard-view.c:221 +#: ../thunar/thunar-standard-view.c:223 msgid "Select _all files" msgstr "å…¨ã¦ã®ãƒ•ã‚¡ã‚¤ãƒ«ã‚’é¸æŠž(_A)" -#: ../thunar/thunar-standard-view.c:221 +#: ../thunar/thunar-standard-view.c:223 msgid "Select all files in this window" msgstr "ã“ã®ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ã®å…¨ã¦ã®ãƒ•ã‚¡ã‚¤ãƒ«ã‚’é¸æŠžã—ã¾ã™" -#: ../thunar/thunar-standard-view.c:222 +#: ../thunar/thunar-standard-view.c:224 msgid "Select by _pattern" msgstr "パターンã§é¸æŠž(_P)" -#: ../thunar/thunar-standard-view.c:222 +#: ../thunar/thunar-standard-view.c:224 msgid "Select all files that match a certain pattern" msgstr "ã‚る特定ã®ãƒ‘ターンã«ä¸€è‡´ã™ã‚‹å…¨ã¦ã®ãƒ•ã‚¡ã‚¤ãƒ«ã‚’é¸æŠžã—ã¾ã™" -#: ../thunar/thunar-standard-view.c:223 +#: ../thunar/thunar-standard-view.c:225 msgid "_Rename" msgstr "åå‰å¤‰æ›´(_R)" -#: ../thunar/thunar-standard-view.c:223 +#: ../thunar/thunar-standard-view.c:225 msgid "Rename the selected item" msgstr "é¸æŠžã—ãŸã‚¢ã‚¤ãƒ†ãƒ ã®åå‰ã‚’変更ã—ã¾ã™" -#: ../thunar/thunar-standard-view.c:228 +#: ../thunar/thunar-standard-view.c:230 msgid "Show _hidden files" msgstr "éš ã—ファイルを表示(_H)" -#: ../thunar/thunar-standard-view.c:228 +#: ../thunar/thunar-standard-view.c:230 msgid "Toggles the display of hidden files in the current window" msgstr "ç¾åœ¨ã®ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ã§éš ã—ファイルã®è¡¨ç¤º/éžè¡¨ç¤ºã‚’切り替ãˆã¾ã™" -#: ../thunar/thunar-standard-view.c:332 ../thunar/thunar-view.c:83 +#: ../thunar/thunar-standard-view.c:334 ../thunar/thunar-view.c:83 msgid "Whether the view is currently being loaded" msgstr "表示ペインãŒç¾åœ¨èªã¿è¾¼ã¾ã‚Œã¦ã„ã‚‹ã‹ã©ã†ã‹ã‚’表ã—ã¾ã™" -#: ../thunar/thunar-standard-view.c:834 +#: ../thunar/thunar-standard-view.c:836 msgid "Loading folder contents..." msgstr "フォルダã®å†…容をèªã¿è¾¼ã‚“ã§ã„ã¾ã™..." -#: ../thunar/thunar-standard-view.c:1347 +#: ../thunar/thunar-standard-view.c:1374 msgid "Select by pattern" msgstr "パターンã§é¸æŠž" -#: ../thunar/thunar-standard-view.c:1362 +#: ../thunar/thunar-standard-view.c:1389 msgid "Pattern:" msgstr "パターン:" -#: ../thunar/thunar-standard-view.c:2005 +#: ../thunar/thunar-standard-view.c:2031 +#, fuzzy msgid "_Copy file" -msgstr "コピー(_C)" +msgid_plural "_Copy files" +msgstr[0] "コピー(_C)" -#: ../thunar/thunar-standard-view.c:2011 +#: ../thunar/thunar-standard-view.c:2037 +#, fuzzy msgid "Cu_t file" -msgstr "切りå–ã‚Š(_T)" +msgid_plural "Cu_t files" +msgstr[0] "切りå–ã‚Š(_T)" #: ../thunar/thunar-statusbar.c:190 msgid "The file whose icon to display" @@ -810,10 +820,32 @@ msgstr "折り返ã—å¹…" msgid "The wrap width" msgstr "折り返ã—å¹…ã§ã™" -#: ../thunar/thunar-trash-folder.c:240 +#: ../thunar/thunar-trash-folder.c:258 msgid "Trash" msgstr "ゴミ箱" +#. prepare the "Empty Trash Bin" action +#: ../thunar/thunar-trash-folder.c:287 +msgid "_Empty Trash Bin" +msgstr "" + +#: ../thunar/thunar-trash-folder.c:287 +#, fuzzy +msgid "Delete all items in the Trash" +msgstr "ã“ã®ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ã®å…¨ã¦ã®ãƒ•ã‚¡ã‚¤ãƒ«ã‚’é¸æŠžã—ã¾ã™" + +#: ../thunar/thunar-trash-folder.c:414 +#, fuzzy +msgid "Are you sure that you want to delete all trashed files?" +msgstr "å…¨ã¦ã®ãƒ•ã‚©ãƒ«ãƒ€ã‚’é–‹ã„ã¦ã‚‚よã‚ã—ã„ã§ã™ã‹ï¼Ÿ" + +#: ../thunar/thunar-trash-folder.c:416 +#, c-format +msgid "This will delete %d file currently located in the trash bin." +msgid_plural "This will delete %d files currently located in the trash bin." +msgstr[0] "" +msgstr[1] "" + #: ../thunar/thunar-view.c:99 msgid "Text to be displayed in the statusbar associated with this view" msgstr "ã“ã®è¡¨ç¤ºã«é–¢é€£ä»˜ã‘られãŸã‚¹ãƒ†ãƒ¼ã‚¿ã‚¹ãƒãƒ¼ã§è¡¨ç¤ºã•ã‚Œã‚‹ãƒ†ã‚ストã§ã™" diff --git a/thunar/Makefile.am b/thunar/Makefile.am index 7b70788c1..dacc38c42 100644 --- a/thunar/Makefile.am +++ b/thunar/Makefile.am @@ -158,7 +158,7 @@ DISTCLEANFILES = \ thunar-fallback-icon.c \ thunar-icon-view-ui.h \ thunar-standard-view-ui.h \ - thunar-thumbnail-frame.h \ + thunar-thumbnail-frame.c \ thunar-window-ui.h BUILT_SOURCES = \ diff --git a/thunar/main.c b/thunar/main.c index 353b562db..ef6c07463 100644 --- a/thunar/main.c +++ b/thunar/main.c @@ -39,7 +39,7 @@ main (int argc, char **argv) ThunarApplication *application; ThunarVfsURI *uri; const gchar *path; - ThunarFile *file; + ThunarFile *file = NULL; GError *error = NULL; /* setup translation domain */ diff --git a/thunar/thunar-application.c b/thunar/thunar-application.c index 15b0ee2eb..a39f11ab5 100644 --- a/thunar/thunar-application.c +++ b/thunar/thunar-application.c @@ -313,10 +313,10 @@ thunar_application_open_window (ThunarApplication *application, * interaction. **/ void -thunar_application_copy_uris (ThunarApplication *application, - GtkWindow *window, - GList *source_uri_list, - ThunarVfsURI *target_uri) +thunar_application_copy_uris (ThunarApplication *application, + GtkWindow *window, + GList *source_uri_list, + ThunarVfsURI *target_uri) { ThunarVfsJob *job; GtkWidget *message; @@ -331,8 +331,8 @@ thunar_application_copy_uris (ThunarApplication *application, { message = gtk_message_dialog_new (window, GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, - "%s", error->message); + GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, + "%s.", error->message); gtk_dialog_run (GTK_DIALOG (message)); gtk_widget_destroy (message); g_error_free (error); @@ -359,10 +359,10 @@ thunar_application_copy_uris (ThunarApplication *application, * interaction. **/ void -thunar_application_move_uris (ThunarApplication *application, - GtkWindow *window, - GList *source_uri_list, - ThunarVfsURI *target_uri) +thunar_application_move_uris (ThunarApplication *application, + GtkWindow *window, + GList *source_uri_list, + ThunarVfsURI *target_uri) { ThunarVfsJob *job; GtkWidget *message; @@ -377,8 +377,8 @@ thunar_application_move_uris (ThunarApplication *application, { message = gtk_message_dialog_new (window, GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, - "%s", error->message); + GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, + "%s.", error->message); gtk_dialog_run (GTK_DIALOG (message)); gtk_widget_destroy (message); g_error_free (error); @@ -393,3 +393,46 @@ thunar_application_move_uris (ThunarApplication *application, +/** + * thunar_application_delete_uris: + * @application : a #ThunarApplication. + * @window : a parent #GtkWindow or %NULL. + * @uri_list : the list of #ThunarVfsURI<!---->s that should be deleted. + * + * Deletes all files referenced by the @uri_list and takes care of all user + * interaction. + **/ +void +thunar_application_delete_uris (ThunarApplication *application, + GtkWindow *window, + GList *uri_list) +{ + ThunarVfsJob *job; + GtkWidget *message; + GError *error = NULL; + + g_return_if_fail (THUNAR_IS_APPLICATION (application)); + g_return_if_fail (window == NULL || GTK_IS_WINDOW (window)); + + /* allocate the job */ + job = thunar_vfs_unlink (uri_list, &error); + if (G_UNLIKELY (job == NULL)) + { + message = gtk_message_dialog_new (window, GTK_DIALOG_MODAL | + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, + "%s.", error->message); + gtk_dialog_run (GTK_DIALOG (message)); + gtk_widget_destroy (message); + g_error_free (error); + } + else + { + /* let the application take care of the dialog */ + thunar_application_handle_job (application, window, job, "stock_delete", _("Deleting files...")); + thunar_vfs_job_unref (job); + } +} + + + diff --git a/thunar/thunar-application.h b/thunar/thunar-application.h index e8e37ec59..2f950bc09 100644 --- a/thunar/thunar-application.h +++ b/thunar/thunar-application.h @@ -55,6 +55,10 @@ void thunar_application_move_uris (ThunarApplication *applicat GList *source_uri_list, ThunarVfsURI *target_uri); +void thunar_application_delete_uris (ThunarApplication *application, + GtkWindow *window, + GList *uri_list); + G_END_DECLS; #endif /* !__THUNAR_APPLICATION_H__ */ diff --git a/thunar/thunar-favourites-view.c b/thunar/thunar-favourites-view.c index 989f9bcfd..9c7b4e48a 100644 --- a/thunar/thunar-favourites-view.c +++ b/thunar/thunar-favourites-view.c @@ -216,12 +216,16 @@ thunar_favourites_view_button_press_event (GtkWidget *widget, GtkTreeModel *model; GtkTreePath *path; GtkTreeIter iter; + ThunarFile *file; + GtkWidget *window; GtkWidget *image; GtkWidget *menu; GtkWidget *item; GMainLoop *loop; gboolean mutable; gboolean result; + GList *actions; + GList *lp; /* let the widget process the event first (handles focussing and scrolling) */ result = GTK_WIDGET_CLASS (thunar_favourites_view_parent_class)->button_press_event (widget, event); @@ -233,11 +237,16 @@ thunar_favourites_view_button_press_event (GtkWidget *widget, /* resolve the path to the cursor position */ if (gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (widget), event->x, event->y, &path, NULL, NULL, NULL)) { - /* check whether the favourite at the given path is mutable */ + /* determine the iterator for the selected row */ model = gtk_tree_view_get_model (GTK_TREE_VIEW (widget)); gtk_tree_model_get_iter (model, &iter, path); + + /* check whether the favourite at the given path is mutable */ gtk_tree_model_get (model, &iter, THUNAR_FAVOURITES_MODEL_COLUMN_MUTABLE, &mutable, -1); + /* determine the file for the given path */ + file = thunar_favourites_model_file_for_iter (THUNAR_FAVOURITES_MODEL (model), &iter); + /* prepare the internal loop */ loop = g_main_loop_new (NULL, FALSE); @@ -246,6 +255,38 @@ thunar_favourites_view_button_press_event (GtkWidget *widget, gtk_menu_set_screen (GTK_MENU (menu), gtk_widget_get_screen (widget)); g_signal_connect_swapped (G_OBJECT (menu), "deactivate", G_CALLBACK (g_main_loop_quit), loop); + /* prepend the custom actions for the selected file (if any) */ + if (G_LIKELY (file != NULL)) + { + /* determine the toplevel window */ + window = gtk_widget_get_toplevel (widget); + + /* determine the actions for the selected file */ + actions = thunar_file_get_actions (file, window); + + /* check if we have any actions */ + if (G_LIKELY (actions != NULL)) + { + /* append the actions */ + for (lp = actions; lp != NULL; lp = lp->next) + { + /* append the menu item */ + item = gtk_action_create_menu_item (GTK_ACTION (lp->data)); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); + gtk_widget_show (item); + + /* release the reference on the action */ + g_object_unref (G_OBJECT (lp->data)); + } + g_list_free (actions); + + /* append a menu separator */ + item = gtk_separator_menu_item_new (); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); + gtk_widget_show (item); + } + } + /* append the remove menu item */ item = gtk_image_menu_item_new_with_mnemonic (_("_Remove Favourite")); g_object_set_data_full (G_OBJECT (item), "thunar-favourites-row", diff --git a/thunar/thunar-file.c b/thunar/thunar-file.c index 836d7b6e4..f9be31462 100644 --- a/thunar/thunar-file.c +++ b/thunar/thunar-file.c @@ -238,6 +238,7 @@ thunar_file_class_init (ThunarFileClass *klass) klass->is_readable = thunar_file_real_is_readable; klass->is_renameable = (gpointer) exo_noop_false; klass->is_writable = thunar_file_real_is_writable; + klass->get_actions = (gpointer) exo_noop_null; klass->get_emblem_names = (gpointer) exo_noop_null; klass->reload = (gpointer) exo_noop; klass->changed = thunar_file_real_changed; @@ -930,7 +931,7 @@ thunar_file_accepts_uri_drop (ThunarFile *file, } /* check if this URI is supported */ - action = (*THUNAR_FILE_GET_CLASS (file)->accepts_uri_drop) (file, lp->data, action); + action = (*THUNAR_FILE_GET_CLASS (file)->accepts_uri_drop) (file, lp->data, actions); if (G_UNLIKELY (action == 0)) return 0; @@ -1430,6 +1431,33 @@ thunar_file_is_writable (ThunarFile *file) +/** + * thunar_file_get_actions: + * @file : a #ThunarFile instance. + * @window : a #GdkWindow instance. + * + * Returns additional #GtkAction<!---->s for @file. + * + * The caller is responsible to free the returned list + * using + * <informalexample><programlisting> + * g_list_foreach (list, (GFunc) g_object_unref, NULL); + * g_list_free (list); + * </programlisting></informalexample> + * + * Return value: additional #GtkAction<!---->s for @file. + **/ +GList* +thunar_file_get_actions (ThunarFile *file, + GtkWidget *window) +{ + g_return_val_if_fail (THUNAR_IS_FILE (file), NULL); + g_return_val_if_fail (GTK_IS_WINDOW (window), NULL); + return (*THUNAR_FILE_GET_CLASS (file)->get_actions) (file, window); +} + + + /** * thunar_file_get_emblem_names: * @file : a #ThunarFile instance. diff --git a/thunar/thunar-file.h b/thunar/thunar-file.h index c8365f671..f4d9a3666 100644 --- a/thunar/thunar-file.h +++ b/thunar/thunar-file.h @@ -127,6 +127,9 @@ struct _ThunarFileClass gboolean (*is_renameable) (ThunarFile *file); gboolean (*is_writable) (ThunarFile *file); + GList *(*get_actions) (ThunarFile *file, + GtkWidget *window); + GList *(*get_emblem_names) (ThunarFile *file); const gchar *(*get_icon_name) (ThunarFile *file, ThunarFileIconState icon_state, @@ -207,10 +210,13 @@ ThunarVfsVolume *thunar_file_get_volume (ThunarFile *file, ThunarVfsGroup *thunar_file_get_group (ThunarFile *file); ThunarVfsUser *thunar_file_get_user (ThunarFile *file); -gboolean thunar_file_is_executable (ThunarFile *file); -gboolean thunar_file_is_readable (ThunarFile *file); -gboolean thunar_file_is_renameable (ThunarFile *file); -gboolean thunar_file_is_writable (ThunarFile *file); +gboolean thunar_file_is_executable (ThunarFile *file); +gboolean thunar_file_is_readable (ThunarFile *file); +gboolean thunar_file_is_renameable (ThunarFile *file); +gboolean thunar_file_is_writable (ThunarFile *file); + +GList *thunar_file_get_actions (ThunarFile *file, + GtkWidget *window); GList *thunar_file_get_emblem_names (ThunarFile *file); GdkPixbuf *thunar_file_load_icon (ThunarFile *file, diff --git a/thunar/thunar-local-file.c b/thunar/thunar-local-file.c index a5aca13d2..2bf6d78f1 100644 --- a/thunar/thunar-local-file.c +++ b/thunar/thunar-local-file.c @@ -471,12 +471,16 @@ thunar_local_file_is_renameable (ThunarFile *file) { gboolean renameable = FALSE; - /* we just do a guess here, by checking whether the folder is writable */ - file = thunar_file_get_parent (file, NULL); - if (G_LIKELY (file != NULL)) + /* we cannot rename root nodes */ + if (G_LIKELY (!thunar_file_is_root (file))) { - renameable = thunar_file_is_writable (file); - g_object_unref (G_OBJECT (file)); + /* we just do a guess here, by checking whether the folder is writable */ + file = thunar_file_get_parent (file, NULL); + if (G_LIKELY (file != NULL)) + { + renameable = thunar_file_is_writable (file); + g_object_unref (G_OBJECT (file)); + } } return renameable; diff --git a/thunar/thunar-open-with-action.c b/thunar/thunar-open-with-action.c index d7aeb2a0d..f093eca8b 100644 --- a/thunar/thunar-open-with-action.c +++ b/thunar/thunar-open-with-action.c @@ -367,7 +367,7 @@ thunar_open_with_action_menu_mapped (GtkWidget *menu, } /* add our custom children */ - item = gtk_image_menu_item_new_with_label (_("Other...")); + item = gtk_image_menu_item_new_with_label (_("Other Application...")); g_signal_connect_swapped (G_OBJECT (item), "activate", G_CALLBACK (gtk_action_activate), open_with_action); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); gtk_widget_show (item); diff --git a/thunar/thunar-standard-view-ui.xml b/thunar/thunar-standard-view-ui.xml index 24de3b785..968ccef09 100644 --- a/thunar/thunar-standard-view-ui.xml +++ b/thunar/thunar-standard-view-ui.xml @@ -55,7 +55,7 @@ <separator /> <menuitem action="rename" name="rename" /> <separator /> - <placeholder name="placeholder-extensions" /> + <placeholder name="placeholder-custom-actions" /> <separator /> <menuitem action="properties" name="properties" /> </popup> @@ -65,7 +65,7 @@ <separator /> <menuitem action="paste" name="paste" /> <separator /> - <placeholder name="placeholder-extensions" /> + <placeholder name="placeholder-custom-actions" /> </popup> </ui> diff --git a/thunar/thunar-standard-view.c b/thunar/thunar-standard-view.c index c948d4688..3f6296fcb 100644 --- a/thunar/thunar-standard-view.c +++ b/thunar/thunar-standard-view.c @@ -101,7 +101,7 @@ static GdkDragAction thunar_standard_view_get_dest_actions (ThunarStand ThunarFile **file_return); static GList *thunar_standard_view_get_selected_files (ThunarStandardView *standard_view); static GList *thunar_standard_view_get_selected_uris (ThunarStandardView *standard_view); -static void thunar_standard_view_merge_menu_extensions (ThunarStandardView *standard_view, +static void thunar_standard_view_merge_custom_actions (ThunarStandardView *standard_view, GList *selected_items); static void thunar_standard_view_action_properties (GtkAction *action, ThunarStandardView *standard_view); @@ -189,10 +189,12 @@ struct _ThunarStandardViewPrivate GtkAction *action_rename; GtkAction *action_show_hidden_files; - /* menu extensions support */ + /* support for file manager extensions */ ThunarExtensionManager *extension_manager; - GtkActionGroup *extension_actions; - gint extension_merge_id; + + /* custom menu actions support */ + GtkActionGroup *custom_actions; + gint custom_merge_id; /* right-click drag/popup support */ GList *drag_uri_list; @@ -861,19 +863,19 @@ thunar_standard_view_set_ui_manager (ThunarView *view, /* disconnect from the previous UI manager */ if (G_LIKELY (standard_view->ui_manager != NULL)) { - /* remove any registered menu extension actions */ - if (G_LIKELY (standard_view->priv->extension_merge_id != 0)) + /* remove any registered custom menu actions */ + if (G_LIKELY (standard_view->priv->custom_merge_id != 0)) { - gtk_ui_manager_remove_ui (standard_view->ui_manager, standard_view->priv->extension_merge_id); - standard_view->priv->extension_merge_id = 0; + gtk_ui_manager_remove_ui (standard_view->ui_manager, standard_view->priv->custom_merge_id); + standard_view->priv->custom_merge_id = 0; } - /* drop any previous extensions action group */ - if (G_LIKELY (standard_view->priv->extension_actions != NULL)) + /* drop the previous custom action group */ + if (G_LIKELY (standard_view->priv->custom_actions != NULL)) { - gtk_ui_manager_remove_action_group (standard_view->ui_manager, standard_view->priv->extension_actions); - g_object_unref (G_OBJECT (standard_view->priv->extension_actions)); - standard_view->priv->extension_actions = NULL; + gtk_ui_manager_remove_action_group (standard_view->ui_manager, standard_view->priv->custom_actions); + g_object_unref (G_OBJECT (standard_view->priv->custom_actions)); + standard_view->priv->custom_actions = NULL; } /* drop our action group from the previous UI manager */ @@ -1072,8 +1074,8 @@ compare_actions (gconstpointer a, static void -thunar_standard_view_merge_menu_extensions (ThunarStandardView *standard_view, - GList *selected_items) +thunar_standard_view_merge_custom_actions (ThunarStandardView *standard_view, + GList *selected_items) { GtkTreeIter iter; ThunarFile *file = NULL; @@ -1088,13 +1090,13 @@ thunar_standard_view_merge_menu_extensions (ThunarStandardView *standard_view, if (G_UNLIKELY (standard_view->ui_manager == NULL)) return; + /* determine the toplevel window we belong to */ + window = gtk_widget_get_toplevel (GTK_WIDGET (standard_view)); + /* load the menu providers from the extension manager */ providers = thunar_extension_manager_list_providers (standard_view->priv->extension_manager, THUNARX_TYPE_MENU_PROVIDER); if (G_LIKELY (providers != NULL)) { - /* determine the toplevel window we belong to */ - window = gtk_widget_get_toplevel (GTK_WIDGET (standard_view)); - /* determine the list of selected files or the current folder */ if (G_LIKELY (selected_items != NULL)) { @@ -1130,28 +1132,53 @@ thunar_standard_view_merge_menu_extensions (ThunarStandardView *standard_view, thunar_file_list_free (files); } + /* determine the currently selected file/folder for which to load custom actions */ + if (G_LIKELY (selected_items != NULL && selected_items->next == NULL)) + { + gtk_tree_model_get_iter (GTK_TREE_MODEL (standard_view->model), &iter, selected_items->data); + file = thunar_list_model_get_file (standard_view->model, &iter); + } + else if (selected_items == NULL) + { + file = thunar_navigator_get_current_directory (THUNAR_NAVIGATOR (standard_view)); + if (G_LIKELY (file != NULL)) + g_object_ref (G_OBJECT (file)); + } + else + { + file = NULL; + } + + /* load the custom actions for the currently selected file/folder */ + if (G_LIKELY (file != NULL)) + { + tmp = thunar_file_get_actions (file, window); + actions = g_list_concat (actions, tmp); + g_object_unref (G_OBJECT (file)); + } + /* remove the previously determined menu actions from the UI manager */ - if (G_LIKELY (standard_view->priv->extension_merge_id != 0)) + if (G_LIKELY (standard_view->priv->custom_actions != 0)) { - gtk_ui_manager_remove_ui (standard_view->ui_manager, standard_view->priv->extension_merge_id); - standard_view->priv->extension_merge_id = 0; + gtk_ui_manager_remove_ui (standard_view->ui_manager, standard_view->priv->custom_merge_id); + standard_view->priv->custom_merge_id = 0; } - /* drop any previous extensions action group */ - if (G_LIKELY (standard_view->priv->extension_actions != NULL)) + /* drop any previous custom action group */ + if (G_LIKELY (standard_view->priv->custom_actions != NULL)) { - gtk_ui_manager_remove_action_group (standard_view->ui_manager, standard_view->priv->extension_actions); - g_object_unref (G_OBJECT (standard_view->priv->extension_actions)); - standard_view->priv->extension_actions = NULL; + gtk_ui_manager_remove_action_group (standard_view->ui_manager, standard_view->priv->custom_actions); + g_object_unref (G_OBJECT (standard_view->priv->custom_actions)); + standard_view->priv->custom_actions = NULL; } /* add the actions specified by the menu providers */ if (G_LIKELY (actions != NULL)) { - /* allocate the action group and the merge id for the extensions */ - standard_view->priv->extension_actions = gtk_action_group_new ("thunar-standard-view-extensions"); - standard_view->priv->extension_merge_id = gtk_ui_manager_new_merge_id (standard_view->ui_manager); - gtk_ui_manager_insert_action_group (standard_view->ui_manager, standard_view->priv->extension_actions, -1); + /* allocate the action group and the merge id for the custom actions */ + standard_view->priv->custom_actions = gtk_action_group_new ("thunar-standard-view-custom-actions"); + standard_view->priv->custom_merge_id = gtk_ui_manager_new_merge_id (standard_view->ui_manager); + gtk_ui_manager_insert_action_group (standard_view->ui_manager, standard_view->priv->custom_actions, -1); /* sort the actions by their names */ actions = g_list_sort (actions, compare_actions); @@ -1160,15 +1187,15 @@ thunar_standard_view_merge_menu_extensions (ThunarStandardView *standard_view, for (lp = actions; lp != NULL; lp = lp->next) { /* add the action to the action group */ - gtk_action_group_add_action (standard_view->priv->extension_actions, GTK_ACTION (lp->data)); + gtk_action_group_add_action (standard_view->priv->custom_actions, GTK_ACTION (lp->data)); /* add the action to the UI manager */ if (G_LIKELY (selected_items != NULL)) { /* add to the file context menu */ gtk_ui_manager_add_ui (standard_view->ui_manager, - standard_view->priv->extension_merge_id, - "/file-context-menu/placeholder-extensions", + standard_view->priv->custom_merge_id, + "/file-context-menu/placeholder-custom-actions", gtk_action_get_name (GTK_ACTION (lp->data)), gtk_action_get_name (GTK_ACTION (lp->data)), GTK_UI_MANAGER_MENUITEM, FALSE); @@ -1177,8 +1204,8 @@ thunar_standard_view_merge_menu_extensions (ThunarStandardView *standard_view, { /* add to the folder context menu */ gtk_ui_manager_add_ui (standard_view->ui_manager, - standard_view->priv->extension_merge_id, - "/folder-context-menu/placeholder-extensions", + standard_view->priv->custom_merge_id, + "/folder-context-menu/placeholder-custom-actions", gtk_action_get_name (GTK_ACTION (lp->data)), gtk_action_get_name (GTK_ACTION (lp->data)), GTK_UI_MANAGER_MENUITEM, FALSE); @@ -1850,22 +1877,21 @@ thunar_standard_view_context_menu (ThunarStandardView *standard_view, guint button, guint32 time) { - GMainLoop *loop; - GtkWidget *menu; - GList *selected_items; - guint id; + GMainLoop *loop; + GtkWidget *menu; + GList *selected_items; + guint id; g_return_if_fail (THUNAR_IS_STANDARD_VIEW (standard_view)); - /* check if we need to popup the file or the folder context menu */ - selected_items = THUNAR_STANDARD_VIEW_GET_CLASS (standard_view)->get_selected_items (standard_view); - if (G_LIKELY (selected_items != NULL)) - menu = gtk_ui_manager_get_widget (standard_view->ui_manager, "/file-context-menu"); - else - menu = gtk_ui_manager_get_widget (standard_view->ui_manager, "/folder-context-menu"); + /* determine the selected items */ + selected_items = (*THUNAR_STANDARD_VIEW_GET_CLASS (standard_view)->get_selected_items) (standard_view); + + /* merge the custom menu actions for the selected items */ + thunar_standard_view_merge_custom_actions (standard_view, selected_items); - /* merge the menu extensions for the selected items */ - thunar_standard_view_merge_menu_extensions (standard_view, selected_items); + /* check if we need to popup the file or the folder context menu */ + menu = gtk_ui_manager_get_widget (standard_view->ui_manager, (selected_items != NULL) ? "/file-context-menu" : "/folder-context-menu"); /* release the selected items */ g_list_foreach (selected_items, (GFunc) gtk_tree_path_free, NULL); @@ -2002,13 +2028,13 @@ thunar_standard_view_selection_changed (ThunarStandardView *standard_view) /* update the "Copy file(s)" action */ g_object_set (G_OBJECT (standard_view->priv->action_copy), - "label", (n_selected_files > 1) ? _("_Copy files") : _("_Copy file"), + "label", ngettext ("_Copy file", "_Copy files", n_selected_files), "sensitive", (n_selected_files > 0), NULL); /* update the "Cut file(s)" action */ g_object_set (G_OBJECT (standard_view->priv->action_cut), - "label", (n_selected_files > 1) ? _("Cu_t files") : _("Cu_t file"), + "label", ngettext ("Cu_t file", "Cu_t files", n_selected_files), "sensitive", (n_selected_files > 0) && writable, NULL); diff --git a/thunar/thunar-trash-file.c b/thunar/thunar-trash-file.c index 1dfed864b..05b75e9e1 100644 --- a/thunar/thunar-trash-file.c +++ b/thunar/thunar-trash-file.c @@ -317,7 +317,7 @@ thunar_trash_file_new (ThunarVfsURI *uri, /* watch the real file */ g_signal_connect_swapped (G_OBJECT (real_file), "changed", G_CALLBACK (thunar_file_changed), trash_file); - g_signal_connect_swapped (G_OBJECT (real_file), "destroy", G_CALLBACK (gtk_object_destroy), trash_file); + g_signal_connect_swapped (G_OBJECT (real_file), "destroy", G_CALLBACK (thunar_file_destroy), trash_file); thunar_file_watch (real_file); /* cleanup */ diff --git a/thunar/thunar-trash-folder.c b/thunar/thunar-trash-folder.c index 7afa5bc37..973d02896 100644 --- a/thunar/thunar-trash-folder.c +++ b/thunar/thunar-trash-folder.c @@ -21,6 +21,7 @@ #include <config.h> #endif +#include <thunar/thunar-application.h> #include <thunar/thunar-folder.h> #include <thunar/thunar-trash-file.h> #include <thunar/thunar-trash-folder.h> @@ -52,12 +53,18 @@ static ThunarVfsMimeInfo *thunar_trash_folder_get_mime_info (ThunarFil static const gchar *thunar_trash_folder_get_display_name (ThunarFile *file); static ThunarVfsFileType thunar_trash_folder_get_kind (ThunarFile *file); static ThunarVfsFileMode thunar_trash_folder_get_mode (ThunarFile *file); +static GList *thunar_trash_folder_get_actions (ThunarFile *file, + GtkWidget *window); static const gchar *thunar_trash_folder_get_icon_name (ThunarFile *file, ThunarFileIconState icon_state, GtkIconTheme *icon_theme); static ThunarFile *thunar_trash_folder_get_corresponding_file (ThunarFolder *folder); static GList *thunar_trash_folder_get_files (ThunarFolder *folder); static gboolean thunar_trash_folder_get_loading (ThunarFolder *folder); +static void thunar_trash_folder_action_empty (GtkAction *action, + GtkWindow *window); +static void thunar_trash_folder_file_destroy (ThunarFile *file, + ThunarTrashFolder *trash_folder); @@ -77,6 +84,8 @@ struct _ThunarTrashFolder +static GQuark thunar_trash_folder_action_quark; + G_DEFINE_TYPE_WITH_CODE (ThunarTrashFolder, thunar_trash_folder, THUNAR_TYPE_FILE, @@ -91,6 +100,11 @@ thunar_trash_folder_class_init (ThunarTrashFolderClass *klass) ThunarFileClass *thunarfile_class; GObjectClass *gobject_class; + /* setup the thunar-trash-folder-action quark, which is + * used to connect the custom actions to the folder instance. + */ + thunar_trash_folder_action_quark = g_quark_from_static_string ("thunar-trash-folder-action"); + gobject_class = G_OBJECT_CLASS (klass); gobject_class->finalize = thunar_trash_folder_finalize; gobject_class->get_property = thunar_trash_folder_get_property; @@ -103,6 +117,7 @@ thunar_trash_folder_class_init (ThunarTrashFolderClass *klass) thunarfile_class->get_display_name = thunar_trash_folder_get_display_name; thunarfile_class->get_kind = thunar_trash_folder_get_kind; thunarfile_class->get_mode = thunar_trash_folder_get_mode; + thunarfile_class->get_actions = thunar_trash_folder_get_actions; thunarfile_class->get_icon_name = thunar_trash_folder_get_icon_name; g_object_class_override_property (gobject_class, @@ -141,7 +156,10 @@ thunar_trash_folder_finalize (GObject *object) /* drop the files list */ for (lp = trash_folder->files; lp != NULL; lp = lp->next) - g_object_unref (G_OBJECT (lp->data)); + { + g_signal_handlers_disconnect_by_func (G_OBJECT (lp->data), thunar_trash_folder_file_destroy, trash_folder); + g_object_unref (G_OBJECT (lp->data)); + } g_list_free (trash_folder->files); /* unregister from the trash manager */ @@ -151,7 +169,7 @@ thunar_trash_folder_finalize (GObject *object) /* release the trash URI */ thunar_vfs_uri_unref (trash_folder->uri); - G_OBJECT_CLASS (thunar_trash_folder_parent_class)->finalize (object); + (*G_OBJECT_CLASS (thunar_trash_folder_parent_class)->finalize) (object); } @@ -258,6 +276,24 @@ thunar_trash_folder_get_mode (ThunarFile *file) +static GList* +thunar_trash_folder_get_actions (ThunarFile *file, + GtkWidget *window) +{ + ThunarTrashFolder *trash_folder = THUNAR_TRASH_FOLDER (file); + GtkAction *action; + + /* prepare the "Empty Trash Bin" action */ + action = gtk_action_new ("ThunarTrashFolder::empty-trash-bin", _("_Empty Trash Bin"), _("Delete all items in the Trash"), NULL); + g_object_set_qdata_full (G_OBJECT (action), thunar_trash_folder_action_quark, g_object_ref (G_OBJECT (trash_folder)), g_object_unref); + exo_binding_new_with_negation (G_OBJECT (trash_folder->manager), "empty", G_OBJECT (action), "sensitive"); + g_signal_connect (G_OBJECT (action), "activate", G_CALLBACK (thunar_trash_folder_action_empty), window); + + return g_list_prepend (NULL, action); +} + + + static const gchar* thunar_trash_folder_get_icon_name (ThunarFile *file, ThunarFileIconState icon_state, @@ -317,7 +353,13 @@ thunar_trash_folder_get_files (ThunarFolder *folder) uri = thunar_vfs_trash_get_uri (trash, fp->data); file = thunar_file_get_for_uri (uri, NULL); if (file != NULL) - trash_folder->files = g_list_prepend (trash_folder->files, file); + { + /* watch the lifecycle of the file */ + g_signal_connect (G_OBJECT (file), "destroy", G_CALLBACK (thunar_trash_folder_file_destroy), trash_folder); + + /* add the file to our internal list */ + trash_folder->files = g_list_prepend (trash_folder->files, file); + } thunar_vfs_uri_unref (uri); } g_object_unref (G_OBJECT (trash)); @@ -338,6 +380,89 @@ thunar_trash_folder_get_loading (ThunarFolder *folder) +static void +thunar_trash_folder_action_empty (GtkAction *action, + GtkWindow *window) +{ + ThunarApplication *application; + ThunarTrashFolder *trash_folder; + GtkWidget *message; + GList *uri_list; + GList *files; + GList *lp; + gint response; + gint n_files; + + g_return_if_fail (GTK_IS_ACTION (action)); + g_return_if_fail (GTK_IS_WINDOW (window)); + + /* grab the pointer on the trash folder for the action */ + trash_folder = g_object_get_qdata (G_OBJECT (action), thunar_trash_folder_action_quark); + + /* determine the files currently stored in the trash can */ + files = thunar_folder_get_files (THUNAR_FOLDER (trash_folder)); + n_files = g_list_length (files); + if (G_UNLIKELY (n_files == 0)) + return; + + /* ask the user whether to empty the trash can */ + message = gtk_message_dialog_new (GTK_WINDOW (window), + GTK_DIALOG_DESTROY_WITH_PARENT + | GTK_DIALOG_MODAL, + GTK_MESSAGE_QUESTION, + GTK_BUTTONS_YES_NO, + _("Are you sure that you want to delete all trashed files?")); + gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (message), + ngettext ("This will delete %d file currently located in the trash bin.", + "This will delete %d files currently located in the trash bin.", + n_files), + n_files); + response = gtk_dialog_run (GTK_DIALOG (message)); + gtk_widget_destroy (message); + + /* check if we should delete all trashed files */ + if (G_LIKELY (response == GTK_RESPONSE_YES)) + { + /* determine the URIs for the trashed files */ + for (lp = files, uri_list = NULL; lp != NULL; lp = lp->next) + uri_list = g_list_prepend (uri_list, thunar_file_get_uri (lp->data)); + + /* perform the unlink operation */ + application = thunar_application_get (); + thunar_application_delete_uris (application, window, uri_list); + g_object_unref (G_OBJECT (application)); + + /* cleanup */ + g_list_free (uri_list); + } +} + + + +static void +thunar_trash_folder_file_destroy (ThunarFile *file, + ThunarTrashFolder *trash_folder) +{ + GList files; + + g_return_if_fail (THUNAR_IS_FILE (file)); + g_return_if_fail (THUNAR_IS_TRASH_FOLDER (trash_folder)); + g_return_if_fail (g_list_find (trash_folder->files, file) != NULL); + + /* disconnect from the file */ + g_signal_handlers_disconnect_by_func (G_OBJECT (file), thunar_trash_folder_file_destroy, trash_folder); + trash_folder->files = g_list_remove (trash_folder->files, file); + + /* tell everybody that the file is gone */ + files.data = file; files.next = files.prev = NULL; + thunar_folder_files_removed (THUNAR_FOLDER (trash_folder), &files); + + /* drop our reference on the fole */ + g_object_unref (G_OBJECT (file)); +} + + + /** * thunar_trash_folder_new: * @uri : the #ThunarVfsURI referrring to the trash file. -- GitLab