From 736ae7a33778f623e3f1d465435a8973aa298ef5 Mon Sep 17 00:00:00 2001 From: Benedikt Meurer <benny@xfce.org> Date: Wed, 8 Feb 2006 22:58:40 +0000 Subject: [PATCH] 2006-02-08 Benedikt Meurer <benny@xfce.org> * thunar-vfs/thunar-vfs-util.{c,h}, thunar-vfs/thunar-vfs.symbols: Add new function thunar_vfs_canonicalize_filename(). * thunar-vfs/thunar-vfs-path.c(thunar_vfs_path_new): Use thunar_vfs_canonicalize_filename() on absolute paths. * docs/reference/thunar-vfs/: Update the thunar-vfs API docs. * thunar/thunar-dialogs.{c,h}: Use a generic parent parameter instead of a GtkWidget, so this method is also usable if no GtkWidget is none, but the dialog must appear on a specific screen. * thunar/thunar-application.{c,h}: Add a "daemon" property, which determines whether Thunar will exit once the last window is closed. Remove the D-BUS service here. Add process_filenames() method, to process the list of filenames given on the command line. Bug #1384. * thunar/main.c: Attach the D-BUS here. * Makefile.am, org.xfce.Thunar.service.in: Add Thunar specific service file. * thunar/thunar-dbus-service-infos.xml, thunar/thunar-dbus-service.c: Add the org.xfce.Thunar interface here, with currently only a LaunchFiles() method, which can process Thunar command line parameters in a remote instance. Bug #1384. * thunar/thunar-dbus-client.{c,h}, thunar/Makefile.am: Add convenience wrapper for the D-BUS LaunchFiles() of the org.xfce.Thunar interface, which is used on startup to first try to reuse an existing instance. This way new folder windows will popup instantly if an instance of Thunar is already running. * org.xfce.Thunar.service.in, org.xfce.FileManager.service.in, thunar/main.c: Add --daemon option and use it when starting from the message bus. Pass all additional parameters as file names to a run- ning remote instance or to ThunarApplication as fallback. Bug #1384. * examples/xfce-file-manager.py, examples/Makefile.am: Add a simple example how to communicate with the file manager using the D-BUS Python bindings. * po/Thunar.pot, po/*.po: Merge new strings. (Old svn revision: 19782) --- ChangeLog | 35 +++ Makefile.am | 2 +- .../thunar-vfs/thunar-vfs-sections.txt | 1 + .../thunar-vfs/tmpl/thunar-vfs-util.sgml | 9 + examples/Makefile.am | 3 + examples/xfce-file-manager.py | 66 +++++ org.xfce.FileManager.service.in | 2 +- org.xfce.Thunar.service.in | 3 + po/Thunar.pot | 55 +++- po/ca.po | 55 +++- po/de.po | 55 +++- po/el.po | 55 +++- po/es.po | 55 +++- po/fr.po | 55 +++- po/hu.po | 55 +++- po/it.po | 55 +++- po/ja.po | 56 +++- po/nl.po | 55 +++- po/pl.po | 55 +++- po/pt_BR.po | 55 +++- po/ru.po | 55 +++- thunar-vfs/thunar-vfs-path.c | 24 +- thunar-vfs/thunar-vfs-util.c | 185 +++++++++++++ thunar-vfs/thunar-vfs-util.h | 12 +- thunar-vfs/thunar-vfs.symbols | 2 + thunar/Makefile.am | 2 + thunar/main.c | 127 +++++++-- thunar/thunar-application.c | 257 ++++++++++++++++-- thunar/thunar-application.h | 112 ++++---- thunar/thunar-dbus-client.c | 123 +++++++++ thunar/thunar-dbus-client.h | 34 +++ thunar/thunar-dbus-service-infos.xml | 38 +++ thunar/thunar-dbus-service.c | 53 ++++ thunar/thunar-dialogs.c | 50 +++- thunar/thunar-dialogs.h | 4 +- 35 files changed, 1582 insertions(+), 278 deletions(-) create mode 100755 examples/xfce-file-manager.py create mode 100644 org.xfce.Thunar.service.in create mode 100644 thunar/thunar-dbus-client.c create mode 100644 thunar/thunar-dbus-client.h diff --git a/ChangeLog b/ChangeLog index e0a5e4235..e9107b9b2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,38 @@ +2006-02-08 Benedikt Meurer <benny@xfce.org> + + * thunar-vfs/thunar-vfs-util.{c,h}, thunar-vfs/thunar-vfs.symbols: Add + new function thunar_vfs_canonicalize_filename(). + * thunar-vfs/thunar-vfs-path.c(thunar_vfs_path_new): Use + thunar_vfs_canonicalize_filename() on absolute paths. + * docs/reference/thunar-vfs/: Update the thunar-vfs API docs. + * thunar/thunar-dialogs.{c,h}: Use a generic parent parameter instead of + a GtkWidget, so this method is also usable if no GtkWidget is none, + but the dialog must appear on a specific screen. + * thunar/thunar-application.{c,h}: Add a "daemon" property, which + determines whether Thunar will exit once the last window is closed. + Remove the D-BUS service here. Add process_filenames() method, to + process the list of filenames given on the command line. Bug #1384. + * thunar/main.c: Attach the D-BUS here. + * Makefile.am, org.xfce.Thunar.service.in: Add Thunar specific service + file. + * thunar/thunar-dbus-service-infos.xml, thunar/thunar-dbus-service.c: + Add the org.xfce.Thunar interface here, with currently only a + LaunchFiles() method, which can process Thunar command line parameters + in a remote instance. Bug #1384. + * thunar/thunar-dbus-client.{c,h}, thunar/Makefile.am: Add convenience + wrapper for the D-BUS LaunchFiles() of the org.xfce.Thunar interface, + which is used on startup to first try to reuse an existing instance. + This way new folder windows will popup instantly if an instance of + Thunar is already running. + * org.xfce.Thunar.service.in, org.xfce.FileManager.service.in, + thunar/main.c: Add --daemon option and use it when starting from the + message bus. Pass all additional parameters as file names to a run- + ning remote instance or to ThunarApplication as fallback. Bug #1384. + * examples/xfce-file-manager.py, examples/Makefile.am: Add a simple + example how to communicate with the file manager using the D-BUS + Python bindings. + * po/Thunar.pot, po/*.po: Merge new strings. + 2006-02-08 Benedikt Meurer <benny@xfce.org> * thunar/thunar-window.c(thunar_window_action_about): Fix the copyright diff --git a/Makefile.am b/Makefile.am index 75c8fc251..16d4df93e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -35,7 +35,7 @@ desktop_DATA = $(desktop_in_files:.desktop.in=.desktop) if HAVE_DBUS servicedir = $(datadir)/dbus-1/services -service_in_files = org.xfce.FileManager.service.in +service_in_files = org.xfce.FileManager.service.in org.xfce.Thunar.service.in service_DATA = $(service_in_files:.service.in=.service) %.service: %.service.in sed -e "s,\@bindir\@,$(bindir),g" < $< > $@ diff --git a/docs/reference/thunar-vfs/thunar-vfs-sections.txt b/docs/reference/thunar-vfs/thunar-vfs-sections.txt index 4e6258ef9..f03ae4248 100644 --- a/docs/reference/thunar-vfs/thunar-vfs-sections.txt +++ b/docs/reference/thunar-vfs/thunar-vfs-sections.txt @@ -373,6 +373,7 @@ thunar_vfs_user_manager_get_type <SECTION> <FILE>thunar-vfs-util</FILE> <TITLE>Utility Functions</TITLE> +thunar_vfs_canonicalize_filename thunar_vfs_expand_filename thunar_vfs_humanize_size </SECTION> diff --git a/docs/reference/thunar-vfs/tmpl/thunar-vfs-util.sgml b/docs/reference/thunar-vfs/tmpl/thunar-vfs-util.sgml index 9f8596a8e..db19b1599 100644 --- a/docs/reference/thunar-vfs/tmpl/thunar-vfs-util.sgml +++ b/docs/reference/thunar-vfs/tmpl/thunar-vfs-util.sgml @@ -17,6 +17,15 @@ Utility Functions <!-- ##### SECTION Stability_Level ##### --> +<!-- ##### FUNCTION thunar_vfs_canonicalize_filename ##### --> +<para> + +</para> + +@filename: +@Returns: + + <!-- ##### FUNCTION thunar_vfs_expand_filename ##### --> <para> diff --git a/examples/Makefile.am b/examples/Makefile.am index 38697d19f..abebb1944 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -3,4 +3,7 @@ SUBDIRS = \ tex-open-terminal +EXTRA_DIST = \ + xfce-file-manager.py + # vi:set ts=8 sw=8 noet ai nocindent syntax=automake: diff --git a/examples/xfce-file-manager.py b/examples/xfce-file-manager.py new file mode 100755 index 000000000..87a1c32d9 --- /dev/null +++ b/examples/xfce-file-manager.py @@ -0,0 +1,66 @@ +#!/usr/bin/env python +# +# $Id$ +# +# Copyright (c) 2006 Benedikt Meurer <benny@xfce.org> +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 of the License, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA +# + +# --------------------------------------------------------------------------- # +# Simple example of how to communicate with Thunar (and any other Xfce file # +# file manager) using the org.xfce.FileManager D-BUS interface. # +# # +# Thunar must be compiled with D-BUS support for this to work. # +# --------------------------------------------------------------------------- # + +import gtk +import dbus +import dbus.service +if getattr(dbus, 'version', (0,0,0)) >= (0,41,0): + import dbus.glib + +# acquire a reference to the FileManager object +bus = dbus.SessionBus() +xfce_file_manager_object = bus.get_object('org.xfce.FileManager', '/org/xfce/FileManager') +xfce_file_manager = dbus.Interface(xfce_file_manager_object, 'org.xfce.FileManager') + +# You can now invoke methods on the xfce_file_manager object, +# for example, to open a new file manager window for /tmp, you +# would use the following method: +# +# xfce_file_manager.DisplayFolder('/tmp', '') +# +# else if you want to display the file managers preferences +# dialog, you'd use +# +# xfce_file_manager.DisplayPreferencesDialog('') +# +# and to open the file properties dialog of a given file, use +# +# xfce_file_manager.DisplayFileProperties('/path/to/file', '') +# +# and last but not least, to launch a given file (or open +# a folder), use +# +# xfce_file_manager.Launch('/path/to/file', '') +# +# See the thunar-dbus-service-infos.xml file for the exact +# interface definition. +# + +# We just popup a new window for the root directory here to +# demonstrate that it works. ;-) +xfce_file_manager.Launch('/', '') diff --git a/org.xfce.FileManager.service.in b/org.xfce.FileManager.service.in index bde2fca35..adbacf1af 100644 --- a/org.xfce.FileManager.service.in +++ b/org.xfce.FileManager.service.in @@ -1,3 +1,3 @@ [D-BUS Service] Name=org.xfce.FileManager -Exec=@bindir@/Thunar +Exec=@bindir@/Thunar --daemon diff --git a/org.xfce.Thunar.service.in b/org.xfce.Thunar.service.in new file mode 100644 index 000000000..7d0aff85f --- /dev/null +++ b/org.xfce.Thunar.service.in @@ -0,0 +1,3 @@ +[D-BUS Service] +Name=org.xfce.Thunar +Exec=@bindir@/Thunar --daemon diff --git a/po/Thunar.pot b/po/Thunar.pot index 20fa0f1ac..ff1a80de2 100644 --- a/po/Thunar.pot +++ b/po/Thunar.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2006-02-07 22:04+0100\n" +"POT-Creation-Date: 2006-02-08 23:51+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -224,11 +224,11 @@ msgid "" "Do you want to skip it?" msgstr "" -#: ../thunar-vfs/thunar-vfs-util.c:68 ../thunar/thunar-path-entry.c:1252 +#: ../thunar-vfs/thunar-vfs-util.c:253 ../thunar/thunar-path-entry.c:1252 msgid "Invalid path" msgstr "" -#: ../thunar-vfs/thunar-vfs-util.c:104 +#: ../thunar-vfs/thunar-vfs-util.c:289 #, c-format msgid "Unknown user `%s'" msgstr "" @@ -356,37 +356,68 @@ msgstr "" msgid "Failed to create symbolic `%s'" msgstr "" +#: ../thunar/main.c:47 +msgid "Run in daemon mode" +msgstr "" + #. setup application name -#: ../thunar/main.c:48 +#: ../thunar/main.c:68 msgid "Thunar" msgstr "" +#. initialize Gtk+ +#: ../thunar/main.c:78 +msgid "[FILES...]" +msgstr "" + +#: ../thunar/main.c:85 +#, c-format +msgid "Thunar: Failed to open display: %s\n" +msgstr "" + +#. yep, there's an error, so print it +#: ../thunar/main.c:90 +#, c-format +msgid "Thunar: %s\n" +msgstr "" + #. display an error message to the user -#: ../thunar/thunar-application.c:240 +#: ../thunar/thunar-application.c:303 msgid "Failed to launch operation" msgstr "" -#: ../thunar/thunar-application.c:487 ../thunar/thunar-application.c:520 +#. tell the user that we were unable to launch the file specified on the cmdline +#: ../thunar/thunar-application.c:649 +#, c-format +msgid "Failed to open \"%s\"" +msgstr "" + +#: ../thunar/thunar-application.c:661 +#, c-format +msgid "Failed to open \"%s\": %s" +msgstr "" + +#: ../thunar/thunar-application.c:698 ../thunar/thunar-application.c:731 msgid "Copying files..." msgstr "" -#: ../thunar/thunar-application.c:554 +#: ../thunar/thunar-application.c:765 msgid "Creating symbolic links..." msgstr "" -#: ../thunar/thunar-application.c:589 +#: ../thunar/thunar-application.c:800 msgid "Moving files..." msgstr "" -#: ../thunar/thunar-application.c:624 +#: ../thunar/thunar-application.c:835 msgid "Deleting files..." msgstr "" -#: ../thunar/thunar-application.c:664 +#: ../thunar/thunar-application.c:875 msgid "Creating files..." msgstr "" -#: ../thunar/thunar-application.c:704 +#: ../thunar/thunar-application.c:915 msgid "Creating directories..." msgstr "" @@ -527,7 +558,7 @@ msgstr "" msgid "Details view" msgstr "" -#: ../thunar/thunar-dialogs.c:74 ../thunar/thunar-dialogs.c:78 +#: ../thunar/thunar-dialogs.c:104 ../thunar/thunar-dialogs.c:112 #: ../thunar-uca/thunar-uca-chooser.c:414 #: ../thunar-uca/thunar-uca-provider.c:329 #, c-format diff --git a/po/ca.po b/po/ca.po index 76c3e60c7..cdf47d1e5 100644 --- a/po/ca.po +++ b/po/ca.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Thunar 0.2.1svn\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2006-02-07 22:04+0100\n" +"POT-Creation-Date: 2006-02-08 23:51+0100\n" "PO-Revision-Date: 2006-01-29 15:14+0900\n" "Last-Translator: Pau Rul·lan Ferragut <paurullan@bulma.net>\n" "Language-Team: Catalan\n" @@ -243,11 +243,11 @@ msgstr "" "\n" "El voleu ometre?" -#: ../thunar-vfs/thunar-vfs-util.c:68 ../thunar/thunar-path-entry.c:1252 +#: ../thunar-vfs/thunar-vfs-util.c:253 ../thunar/thunar-path-entry.c:1252 msgid "Invalid path" msgstr "Camà invà lid" -#: ../thunar-vfs/thunar-vfs-util.c:104 +#: ../thunar-vfs/thunar-vfs-util.c:289 #, c-format msgid "Unknown user `%s'" msgstr "Usuari `%s' desconegut" @@ -376,38 +376,69 @@ msgstr "No s'ha pogut copiar el fitxer especial `%s'" msgid "Failed to create symbolic `%s'" msgstr "No s'ha pogut crear un `%s' simbòlic" +#: ../thunar/main.c:47 +msgid "Run in daemon mode" +msgstr "" + #. setup application name -#: ../thunar/main.c:48 +#: ../thunar/main.c:68 msgid "Thunar" msgstr "Thunar" +#. initialize Gtk+ +#: ../thunar/main.c:78 +msgid "[FILES...]" +msgstr "" + +#: ../thunar/main.c:85 +#, fuzzy, c-format +msgid "Thunar: Failed to open display: %s\n" +msgstr "Ha fallat" + +#. yep, there's an error, so print it +#: ../thunar/main.c:90 +#, fuzzy, c-format +msgid "Thunar: %s\n" +msgstr "Thunar" + #. display an error message to the user -#: ../thunar/thunar-application.c:240 +#: ../thunar/thunar-application.c:303 msgid "Failed to launch operation" msgstr "No s'ha pogut executar l'operació" -#: ../thunar/thunar-application.c:487 ../thunar/thunar-application.c:520 +#. tell the user that we were unable to launch the file specified on the cmdline +#: ../thunar/thunar-application.c:649 +#, fuzzy, c-format +msgid "Failed to open \"%s\"" +msgstr "Ha fallat" + +#: ../thunar/thunar-application.c:661 +#, fuzzy, c-format +msgid "Failed to open \"%s\": %s" +msgstr "Ha fallat" + +#: ../thunar/thunar-application.c:698 ../thunar/thunar-application.c:731 msgid "Copying files..." msgstr "S'estan copiant els fitxers..." -#: ../thunar/thunar-application.c:554 +#: ../thunar/thunar-application.c:765 msgid "Creating symbolic links..." msgstr "S'estan creant els enllaços simbòlics..." -#: ../thunar/thunar-application.c:589 +#: ../thunar/thunar-application.c:800 msgid "Moving files..." msgstr "S'estan movent els fitxers..." -#: ../thunar/thunar-application.c:624 +#: ../thunar/thunar-application.c:835 msgid "Deleting files..." msgstr "S'estan suprimint els fitxers..." -#: ../thunar/thunar-application.c:664 +#: ../thunar/thunar-application.c:875 #, fuzzy msgid "Creating files..." msgstr "Recol·lectant fitxers..." -#: ../thunar/thunar-application.c:704 +#: ../thunar/thunar-application.c:915 msgid "Creating directories..." msgstr "S'estan creant els directoris..." @@ -550,7 +581,7 @@ msgstr "Llistat detallat de directoris" msgid "Details view" msgstr "Mostra detalls" -#: ../thunar/thunar-dialogs.c:74 ../thunar/thunar-dialogs.c:78 +#: ../thunar/thunar-dialogs.c:104 ../thunar/thunar-dialogs.c:112 #: ../thunar-uca/thunar-uca-chooser.c:414 #: ../thunar-uca/thunar-uca-provider.c:329 #, c-format diff --git a/po/de.po b/po/de.po index 8fcfdb96c..810aa6cb5 100644 --- a/po/de.po +++ b/po/de.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Thunar 0.2.1svn\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2006-02-07 22:04+0100\n" +"POT-Creation-Date: 2006-02-08 23:51+0100\n" "PO-Revision-Date: 2006-02-05 23:10+0100\n" "Last-Translator: Benedikt Meurer <benny@xfce.org>\n" "Language-Team: German <de@li.org>\n" @@ -231,11 +231,11 @@ msgid "" "Do you want to skip it?" msgstr "" -#: ../thunar-vfs/thunar-vfs-util.c:68 ../thunar/thunar-path-entry.c:1252 +#: ../thunar-vfs/thunar-vfs-util.c:253 ../thunar/thunar-path-entry.c:1252 msgid "Invalid path" msgstr "Ungültiger Pfad" -#: ../thunar-vfs/thunar-vfs-util.c:104 +#: ../thunar-vfs/thunar-vfs-util.c:289 #, c-format msgid "Unknown user `%s'" msgstr "Unbekannter Benutzer »%s«" @@ -363,37 +363,68 @@ msgstr "" msgid "Failed to create symbolic `%s'" msgstr "" +#: ../thunar/main.c:47 +msgid "Run in daemon mode" +msgstr "" + #. setup application name -#: ../thunar/main.c:48 +#: ../thunar/main.c:68 msgid "Thunar" msgstr "Thunar" +#. initialize Gtk+ +#: ../thunar/main.c:78 +msgid "[FILES...]" +msgstr "" + +#: ../thunar/main.c:85 +#, fuzzy, c-format +msgid "Thunar: Failed to open display: %s\n" +msgstr "Konnte »%s« nicht umbenennen" + +#. yep, there's an error, so print it +#: ../thunar/main.c:90 +#, fuzzy, c-format +msgid "Thunar: %s\n" +msgstr "Thunar" + #. display an error message to the user -#: ../thunar/thunar-application.c:240 +#: ../thunar/thunar-application.c:303 msgid "Failed to launch operation" msgstr "" -#: ../thunar/thunar-application.c:487 ../thunar/thunar-application.c:520 +#. tell the user that we were unable to launch the file specified on the cmdline +#: ../thunar/thunar-application.c:649 +#, fuzzy, c-format +msgid "Failed to open \"%s\"" +msgstr "Konnte »%s« nicht umbenennen" + +#: ../thunar/thunar-application.c:661 +#, fuzzy, c-format +msgid "Failed to open \"%s\": %s" +msgstr "Konnte »%s« nicht umbenennen" + +#: ../thunar/thunar-application.c:698 ../thunar/thunar-application.c:731 msgid "Copying files..." msgstr "Kopiere Dateien..." -#: ../thunar/thunar-application.c:554 +#: ../thunar/thunar-application.c:765 msgid "Creating symbolic links..." msgstr "Erstelle Verknüpfungen..." -#: ../thunar/thunar-application.c:589 +#: ../thunar/thunar-application.c:800 msgid "Moving files..." msgstr "Verschiebe Dateien..." -#: ../thunar/thunar-application.c:624 +#: ../thunar/thunar-application.c:835 msgid "Deleting files..." msgstr "Lösche Dateien..." -#: ../thunar/thunar-application.c:664 +#: ../thunar/thunar-application.c:875 msgid "Creating files..." msgstr "Erstelle Dateien..." -#: ../thunar/thunar-application.c:704 +#: ../thunar/thunar-application.c:915 msgid "Creating directories..." msgstr "Erstelle Verzeichnisse..." @@ -537,7 +568,7 @@ msgstr "Detailierte Verzeichnisansicht" msgid "Details view" msgstr "Detailansicht" -#: ../thunar/thunar-dialogs.c:74 ../thunar/thunar-dialogs.c:78 +#: ../thunar/thunar-dialogs.c:104 ../thunar/thunar-dialogs.c:112 #: ../thunar-uca/thunar-uca-chooser.c:414 #: ../thunar-uca/thunar-uca-provider.c:329 #, c-format diff --git a/po/el.po b/po/el.po index 83f718b14..7862a2610 100644 --- a/po/el.po +++ b/po/el.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Thunar 0.2.1svn\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2006-02-07 22:04+0100\n" +"POT-Creation-Date: 2006-02-08 23:51+0100\n" "PO-Revision-Date: 2006-02-05 00:53+0200\n" "Last-Translator: Stavros Giannouris <stavrosg2002@freemail.gr>\n" "Language-Team: Greek <nls@tux.hellug.gr>\n" @@ -243,11 +243,11 @@ msgstr "" "\n" "ΘÎλετε να το Ï€ÏοσπεÏάσετε;" -#: ../thunar-vfs/thunar-vfs-util.c:68 ../thunar/thunar-path-entry.c:1252 +#: ../thunar-vfs/thunar-vfs-util.c:253 ../thunar/thunar-path-entry.c:1252 msgid "Invalid path" msgstr "Μη ÎγκυÏη διαδÏομή" -#: ../thunar-vfs/thunar-vfs-util.c:104 +#: ../thunar-vfs/thunar-vfs-util.c:289 #, c-format msgid "Unknown user `%s'" msgstr "Άγνωστος χÏήστης `%s'" @@ -375,37 +375,68 @@ msgstr "Αδυναμία αντιγÏαφής του ÎµÎ¹Î´Î¹ÎºÎ¿Ï Î±Ïχείο msgid "Failed to create symbolic `%s'" msgstr "Δεν είναι δυνατή η δημιουÏγία ÏƒÏ…Î¼Î²Î¿Î»Î¹ÎºÎ¿Ï Î´ÎµÏƒÎ¼Î¿Ï `%s'" +#: ../thunar/main.c:47 +msgid "Run in daemon mode" +msgstr "" + #. setup application name -#: ../thunar/main.c:48 +#: ../thunar/main.c:68 msgid "Thunar" msgstr "Thunar" +#. initialize Gtk+ +#: ../thunar/main.c:78 +msgid "[FILES...]" +msgstr "" + +#: ../thunar/main.c:85 +#, fuzzy, c-format +msgid "Thunar: Failed to open display: %s\n" +msgstr "Η μετονομασία του `%s' απÎτυχε" + +#. yep, there's an error, so print it +#: ../thunar/main.c:90 +#, fuzzy, c-format +msgid "Thunar: %s\n" +msgstr "Thunar" + #. display an error message to the user -#: ../thunar/thunar-application.c:240 +#: ../thunar/thunar-application.c:303 msgid "Failed to launch operation" msgstr "Η εκκίνηση της ενÎÏγειας απÎτυχε" -#: ../thunar/thunar-application.c:487 ../thunar/thunar-application.c:520 +#. tell the user that we were unable to launch the file specified on the cmdline +#: ../thunar/thunar-application.c:649 +#, fuzzy, c-format +msgid "Failed to open \"%s\"" +msgstr "Η μετονομασία του `%s' απÎτυχε" + +#: ../thunar/thunar-application.c:661 +#, fuzzy, c-format +msgid "Failed to open \"%s\": %s" +msgstr "Η μετονομασία του `%s' απÎτυχε" + +#: ../thunar/thunar-application.c:698 ../thunar/thunar-application.c:731 msgid "Copying files..." msgstr "ΑντιγÏαφή αÏχείων..." -#: ../thunar/thunar-application.c:554 +#: ../thunar/thunar-application.c:765 msgid "Creating symbolic links..." msgstr "ΔημιουÏγία συμβολικών δεσμών..." -#: ../thunar/thunar-application.c:589 +#: ../thunar/thunar-application.c:800 msgid "Moving files..." msgstr "Μετακίνηση αÏχείων..." -#: ../thunar/thunar-application.c:624 +#: ../thunar/thunar-application.c:835 msgid "Deleting files..." msgstr "ΔιαγÏαφή αÏχείων..." -#: ../thunar/thunar-application.c:664 +#: ../thunar/thunar-application.c:875 msgid "Creating files..." msgstr "ΔημιουÏγία αÏχείων..." -#: ../thunar/thunar-application.c:704 +#: ../thunar/thunar-application.c:915 msgid "Creating directories..." msgstr "ΔημιουÏγία καταλόγων..." @@ -550,7 +581,7 @@ msgstr "ΛεπτομεÏής απεικόνιση καταλόγων" msgid "Details view" msgstr "Î Ïοβολή λεπτομεÏιών" -#: ../thunar/thunar-dialogs.c:74 ../thunar/thunar-dialogs.c:78 +#: ../thunar/thunar-dialogs.c:104 ../thunar/thunar-dialogs.c:112 #: ../thunar-uca/thunar-uca-chooser.c:414 #: ../thunar-uca/thunar-uca-provider.c:329 #, c-format diff --git a/po/es.po b/po/es.po index cef6c06e5..1f138a66f 100644 --- a/po/es.po +++ b/po/es.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Thunar 0.2.1svn\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2006-02-07 22:04+0100\n" +"POT-Creation-Date: 2006-02-08 23:51+0100\n" "PO-Revision-Date: 2005-10-14 23:57+0900\n" "Last-Translator: Pablo Hernández-M. Saiz <homeless3d@gmail.com>\n" "Language-Team: Spanish <es@li.org>\n" @@ -241,12 +241,12 @@ msgstr "" "\n" "¿Quiere dejarlo como está?" -#: ../thunar-vfs/thunar-vfs-util.c:68 ../thunar/thunar-path-entry.c:1252 +#: ../thunar-vfs/thunar-vfs-util.c:253 ../thunar/thunar-path-entry.c:1252 #, fuzzy msgid "Invalid path" msgstr "Nombre de archivo inválido" -#: ../thunar-vfs/thunar-vfs-util.c:104 +#: ../thunar-vfs/thunar-vfs-util.c:289 #, c-format msgid "Unknown user `%s'" msgstr "" @@ -374,39 +374,70 @@ msgstr "Imposible copiar el archivo %s." msgid "Failed to create symbolic `%s'" msgstr "Imposible crear el enlace de %s." +#: ../thunar/main.c:47 +msgid "Run in daemon mode" +msgstr "" + #. setup application name -#: ../thunar/main.c:48 +#: ../thunar/main.c:68 msgid "Thunar" msgstr "Thunar" +#. initialize Gtk+ +#: ../thunar/main.c:78 +msgid "[FILES...]" +msgstr "" + +#: ../thunar/main.c:85 +#, fuzzy, c-format +msgid "Thunar: Failed to open display: %s\n" +msgstr "Imposible renombrar %s." + +#. yep, there's an error, so print it +#: ../thunar/main.c:90 +#, fuzzy, c-format +msgid "Thunar: %s\n" +msgstr "Thunar" + #. display an error message to the user -#: ../thunar/thunar-application.c:240 +#: ../thunar/thunar-application.c:303 #, fuzzy msgid "Failed to launch operation" msgstr "Imposible renombrar %s." -#: ../thunar/thunar-application.c:487 ../thunar/thunar-application.c:520 +#. tell the user that we were unable to launch the file specified on the cmdline +#: ../thunar/thunar-application.c:649 +#, fuzzy, c-format +msgid "Failed to open \"%s\"" +msgstr "Imposible renombrar %s." + +#: ../thunar/thunar-application.c:661 +#, fuzzy, c-format +msgid "Failed to open \"%s\": %s" +msgstr "Imposible renombrar %s." + +#: ../thunar/thunar-application.c:698 ../thunar/thunar-application.c:731 msgid "Copying files..." msgstr "Copiando archivos..." -#: ../thunar/thunar-application.c:554 +#: ../thunar/thunar-application.c:765 msgid "Creating symbolic links..." msgstr "" -#: ../thunar/thunar-application.c:589 +#: ../thunar/thunar-application.c:800 msgid "Moving files..." msgstr "Moviendo archivos..." -#: ../thunar/thunar-application.c:624 +#: ../thunar/thunar-application.c:835 msgid "Deleting files..." msgstr "Borrando archivos..." -#: ../thunar/thunar-application.c:664 +#: ../thunar/thunar-application.c:875 #, fuzzy msgid "Creating files..." msgstr "Borrando archivos..." -#: ../thunar/thunar-application.c:704 +#: ../thunar/thunar-application.c:915 #, fuzzy msgid "Creating directories..." msgstr "Directorio actual" @@ -555,7 +586,7 @@ msgstr "Listado detallado del directorio" msgid "Details view" msgstr "Vista detallada" -#: ../thunar/thunar-dialogs.c:74 ../thunar/thunar-dialogs.c:78 +#: ../thunar/thunar-dialogs.c:104 ../thunar/thunar-dialogs.c:112 #: ../thunar-uca/thunar-uca-chooser.c:414 #: ../thunar-uca/thunar-uca-provider.c:329 #, c-format diff --git a/po/fr.po b/po/fr.po index a72d46084..ae0453783 100644 --- a/po/fr.po +++ b/po/fr.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Thunar 0.2.1svn\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2006-02-07 22:04+0100\n" +"POT-Creation-Date: 2006-02-08 23:51+0100\n" "PO-Revision-Date: 2006-01-01 15:02+0100\n" "Last-Translator: Stephane Roy <sroy@j2n.net>\n" "Language-Team: French <traduc@traduc.org>\n" @@ -241,12 +241,12 @@ msgstr "" "\n" "Voulez-vous l'ignorer ?" -#: ../thunar-vfs/thunar-vfs-util.c:68 ../thunar/thunar-path-entry.c:1252 +#: ../thunar-vfs/thunar-vfs-util.c:253 ../thunar/thunar-path-entry.c:1252 #, fuzzy msgid "Invalid path" msgstr "Nom de fichier invalide" -#: ../thunar-vfs/thunar-vfs-util.c:104 +#: ../thunar-vfs/thunar-vfs-util.c:289 #, fuzzy, c-format msgid "Unknown user `%s'" msgstr "Élément <%s> inconnu" @@ -375,38 +375,69 @@ msgstr "Échec à la copie du fichier spécial `%s'" msgid "Failed to create symbolic `%s'" msgstr "Échec à la création du lien symbolique `%s'" +#: ../thunar/main.c:47 +msgid "Run in daemon mode" +msgstr "" + #. setup application name -#: ../thunar/main.c:48 +#: ../thunar/main.c:68 msgid "Thunar" msgstr "Thunar" +#. initialize Gtk+ +#: ../thunar/main.c:78 +msgid "[FILES...]" +msgstr "" + +#: ../thunar/main.c:85 +#, fuzzy, c-format +msgid "Thunar: Failed to open display: %s\n" +msgstr "Échec au changement de nom de `%s'" + +#. yep, there's an error, so print it +#: ../thunar/main.c:90 +#, fuzzy, c-format +msgid "Thunar: %s\n" +msgstr "Thunar" + #. display an error message to the user -#: ../thunar/thunar-application.c:240 +#: ../thunar/thunar-application.c:303 msgid "Failed to launch operation" msgstr "Échec au lancement de l'opération" -#: ../thunar/thunar-application.c:487 ../thunar/thunar-application.c:520 +#. tell the user that we were unable to launch the file specified on the cmdline +#: ../thunar/thunar-application.c:649 +#, fuzzy, c-format +msgid "Failed to open \"%s\"" +msgstr "Échec au changement de nom de `%s'" + +#: ../thunar/thunar-application.c:661 +#, fuzzy, c-format +msgid "Failed to open \"%s\": %s" +msgstr "Échec au changement de nom de `%s'" + +#: ../thunar/thunar-application.c:698 ../thunar/thunar-application.c:731 msgid "Copying files..." msgstr "Copie des fichiers..." -#: ../thunar/thunar-application.c:554 +#: ../thunar/thunar-application.c:765 msgid "Creating symbolic links..." msgstr "Création de liens symboliques..." -#: ../thunar/thunar-application.c:589 +#: ../thunar/thunar-application.c:800 msgid "Moving files..." msgstr "Déplacement de fichiers..." -#: ../thunar/thunar-application.c:624 +#: ../thunar/thunar-application.c:835 msgid "Deleting files..." msgstr "Suppression des fichiers..." -#: ../thunar/thunar-application.c:664 +#: ../thunar/thunar-application.c:875 #, fuzzy msgid "Creating files..." msgstr "Récupération des fichiers..." -#: ../thunar/thunar-application.c:704 +#: ../thunar/thunar-application.c:915 msgid "Creating directories..." msgstr "Création de répertoires..." @@ -549,7 +580,7 @@ msgstr "Liste détaillée des répertoires" msgid "Details view" msgstr "Vue détails" -#: ../thunar/thunar-dialogs.c:74 ../thunar/thunar-dialogs.c:78 +#: ../thunar/thunar-dialogs.c:104 ../thunar/thunar-dialogs.c:112 #: ../thunar-uca/thunar-uca-chooser.c:414 #: ../thunar-uca/thunar-uca-provider.c:329 #, c-format diff --git a/po/hu.po b/po/hu.po index dfce6efc4..9a8875f47 100644 --- a/po/hu.po +++ b/po/hu.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Thunar 0.2.1svn\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2006-02-07 22:04+0100\n" +"POT-Creation-Date: 2006-02-08 23:51+0100\n" "PO-Revision-Date: 2005-10-06 22:02+0900\n" "Last-Translator: SZERVÃC Attila <sas@321.hu>\n" "Language-Team: Hungarian <translation-team-hu@lists.sourceforge.net>\n" @@ -240,11 +240,11 @@ msgstr "" "\n" "Ãtugrod?" -#: ../thunar-vfs/thunar-vfs-util.c:68 ../thunar/thunar-path-entry.c:1252 +#: ../thunar-vfs/thunar-vfs-util.c:253 ../thunar/thunar-path-entry.c:1252 msgid "Invalid path" msgstr "" -#: ../thunar-vfs/thunar-vfs-util.c:104 +#: ../thunar-vfs/thunar-vfs-util.c:289 #, c-format msgid "Unknown user `%s'" msgstr "" @@ -372,40 +372,71 @@ msgstr "Nem lehet másolni a fájlt: %s" msgid "Failed to create symbolic `%s'" msgstr "Nem hozható létre e szimlink: %s" +#: ../thunar/main.c:47 +msgid "Run in daemon mode" +msgstr "" + #. setup application name -#: ../thunar/main.c:48 +#: ../thunar/main.c:68 msgid "Thunar" msgstr "Thunar" +#. initialize Gtk+ +#: ../thunar/main.c:78 +msgid "[FILES...]" +msgstr "" + +#: ../thunar/main.c:85 +#, fuzzy, c-format +msgid "Thunar: Failed to open display: %s\n" +msgstr "Nem törölhetÅ‘: %s" + +#. yep, there's an error, so print it +#: ../thunar/main.c:90 +#, fuzzy, c-format +msgid "Thunar: %s\n" +msgstr "Thunar" + #. display an error message to the user -#: ../thunar/thunar-application.c:240 +#: ../thunar/thunar-application.c:303 #, fuzzy msgid "Failed to launch operation" msgstr "Nem törölhetÅ‘: %s" -#: ../thunar/thunar-application.c:487 ../thunar/thunar-application.c:520 +#. tell the user that we were unable to launch the file specified on the cmdline +#: ../thunar/thunar-application.c:649 +#, fuzzy, c-format +msgid "Failed to open \"%s\"" +msgstr "Nem törölhetÅ‘: %s" + +#: ../thunar/thunar-application.c:661 +#, fuzzy, c-format +msgid "Failed to open \"%s\": %s" +msgstr "Nem törölhetÅ‘: %s" + +#: ../thunar/thunar-application.c:698 ../thunar/thunar-application.c:731 msgid "Copying files..." msgstr "Fájlok másolása..." -#: ../thunar/thunar-application.c:554 +#: ../thunar/thunar-application.c:765 msgid "Creating symbolic links..." msgstr "" -#: ../thunar/thunar-application.c:589 +#: ../thunar/thunar-application.c:800 msgid "Moving files..." msgstr "Fájlok mozgatása..." -#: ../thunar/thunar-application.c:624 +#: ../thunar/thunar-application.c:835 #, fuzzy msgid "Deleting files..." msgstr "Fájlok gyűjtése..." -#: ../thunar/thunar-application.c:664 +#: ../thunar/thunar-application.c:875 #, fuzzy msgid "Creating files..." msgstr "Fájlok gyűjtése..." -#: ../thunar/thunar-application.c:704 +#: ../thunar/thunar-application.c:915 #, fuzzy msgid "Creating directories..." msgstr "Jelenlegi könyvtár" @@ -554,7 +585,7 @@ msgstr "Részletes könyvtárlista" msgid "Details view" msgstr "Részletes nézet" -#: ../thunar/thunar-dialogs.c:74 ../thunar/thunar-dialogs.c:78 +#: ../thunar/thunar-dialogs.c:104 ../thunar/thunar-dialogs.c:112 #: ../thunar-uca/thunar-uca-chooser.c:414 #: ../thunar-uca/thunar-uca-provider.c:329 #, c-format diff --git a/po/it.po b/po/it.po index e58c7e994..479fa97b5 100644 --- a/po/it.po +++ b/po/it.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Thunar 0.2.1svn\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2006-02-07 22:04+0100\n" +"POT-Creation-Date: 2006-02-08 23:51+0100\n" "PO-Revision-Date: 2006-01-21 10:58+0100\n" "Last-Translator: Roberto Pariset <r.pariset@gmail.com>\n" "Language-Team: GUFI <traduzioni@gufi.org>\n" @@ -245,11 +245,11 @@ msgstr "" "\n" "Si desidera saltarlo?" -#: ../thunar-vfs/thunar-vfs-util.c:68 ../thunar/thunar-path-entry.c:1252 +#: ../thunar-vfs/thunar-vfs-util.c:253 ../thunar/thunar-path-entry.c:1252 msgid "Invalid path" msgstr "Path non valida" -#: ../thunar-vfs/thunar-vfs-util.c:104 +#: ../thunar-vfs/thunar-vfs-util.c:289 #, c-format msgid "Unknown user `%s'" msgstr "Utente `%s' sconosciuto" @@ -378,38 +378,69 @@ msgstr "Impossibile copiare il file speciale `%s'" msgid "Failed to create symbolic `%s'" msgstr "Impossibile creare link simbolico `%s'" +#: ../thunar/main.c:47 +msgid "Run in daemon mode" +msgstr "" + #. setup application name -#: ../thunar/main.c:48 +#: ../thunar/main.c:68 msgid "Thunar" msgstr "Thunar" +#. initialize Gtk+ +#: ../thunar/main.c:78 +msgid "[FILES...]" +msgstr "" + +#: ../thunar/main.c:85 +#, fuzzy, c-format +msgid "Thunar: Failed to open display: %s\n" +msgstr "Impossibile rinominare `%s'" + +#. yep, there's an error, so print it +#: ../thunar/main.c:90 +#, fuzzy, c-format +msgid "Thunar: %s\n" +msgstr "Thunar" + #. display an error message to the user -#: ../thunar/thunar-application.c:240 +#: ../thunar/thunar-application.c:303 msgid "Failed to launch operation" msgstr "Impossibile lanciare l'operazione" -#: ../thunar/thunar-application.c:487 ../thunar/thunar-application.c:520 +#. tell the user that we were unable to launch the file specified on the cmdline +#: ../thunar/thunar-application.c:649 +#, fuzzy, c-format +msgid "Failed to open \"%s\"" +msgstr "Impossibile rinominare `%s'" + +#: ../thunar/thunar-application.c:661 +#, fuzzy, c-format +msgid "Failed to open \"%s\": %s" +msgstr "Impossibile rinominare `%s'" + +#: ../thunar/thunar-application.c:698 ../thunar/thunar-application.c:731 msgid "Copying files..." msgstr "Copia dei file in corso..." -#: ../thunar/thunar-application.c:554 +#: ../thunar/thunar-application.c:765 msgid "Creating symbolic links..." msgstr "Creazione dei link simbolici in corso..." -#: ../thunar/thunar-application.c:589 +#: ../thunar/thunar-application.c:800 msgid "Moving files..." msgstr "Spostamento dei file in corso..." -#: ../thunar/thunar-application.c:624 +#: ../thunar/thunar-application.c:835 msgid "Deleting files..." msgstr "Eliminazione dei file in corso..." -#: ../thunar/thunar-application.c:664 +#: ../thunar/thunar-application.c:875 #, fuzzy msgid "Creating files..." msgstr "Raccolta file in corso..." -#: ../thunar/thunar-application.c:704 +#: ../thunar/thunar-application.c:915 msgid "Creating directories..." msgstr "Creazione directory in corso..." @@ -552,7 +583,7 @@ msgstr "Lista dettagliata delle directory" msgid "Details view" msgstr "Vista dettagliata" -#: ../thunar/thunar-dialogs.c:74 ../thunar/thunar-dialogs.c:78 +#: ../thunar/thunar-dialogs.c:104 ../thunar/thunar-dialogs.c:112 #: ../thunar-uca/thunar-uca-chooser.c:414 #: ../thunar-uca/thunar-uca-provider.c:329 #, c-format diff --git a/po/ja.po b/po/ja.po index 45fc38d69..d8605a711 100644 --- a/po/ja.po +++ b/po/ja.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: Thunar 0.2.1svn\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2006-02-07 22:04+0100\n" +"POT-Creation-Date: 2006-02-08 23:51+0100\n" "PO-Revision-Date: 2006-02-08 22:25+0900\n" "Last-Translator: Daichi Kawahata <daichi@xfce.org>\n" "Language-Team: Japanese <xfce-users-jp@ml.fdiary.net>\n" @@ -248,11 +248,11 @@ msgstr "" "\n" "ã“れを飛ã°ã—ã¾ã™ã‹ï¼Ÿ" -#: ../thunar-vfs/thunar-vfs-util.c:68 ../thunar/thunar-path-entry.c:1252 +#: ../thunar-vfs/thunar-vfs-util.c:253 ../thunar/thunar-path-entry.c:1252 msgid "Invalid path" msgstr "無効ãªãƒ‘スã§ã™ã€‚" -#: ../thunar-vfs/thunar-vfs-util.c:104 +#: ../thunar-vfs/thunar-vfs-util.c:289 #, c-format msgid "Unknown user `%s'" msgstr "ユーザー「%sã€ã¯ä¸æ˜Žã§ã™ã€‚" @@ -378,38 +378,70 @@ msgstr "特殊ファイル「%sã€ã®ã‚³ãƒ”ーã«å¤±æ•—ã—ã¾ã—ãŸã€‚" msgid "Failed to create symbolic `%s'" msgstr "リンク「%sã€ã®ä½œæˆã«å¤±æ•—ã—ã¾ã—ãŸã€‚" +#: ../thunar/main.c:47 +msgid "Run in daemon mode" +msgstr "" + # FIXME: transliteration? #. setup application name -#: ../thunar/main.c:48 +#: ../thunar/main.c:68 msgid "Thunar" msgstr "Thunar" +#. initialize Gtk+ +#: ../thunar/main.c:78 +msgid "[FILES...]" +msgstr "" + +#: ../thunar/main.c:85 +#, fuzzy, c-format +msgid "Thunar: Failed to open display: %s\n" +msgstr "ファイル「%sã€ã‚’é–‹ãã®ã«å¤±æ•—ã—ã¾ã—ãŸã€‚" + +# FIXME: transliteration? +#. yep, there's an error, so print it +#: ../thunar/main.c:90 +#, fuzzy, c-format +msgid "Thunar: %s\n" +msgstr "Thunar" + #. display an error message to the user -#: ../thunar/thunar-application.c:240 +#: ../thunar/thunar-application.c:303 msgid "Failed to launch operation" msgstr "æ“作ã®å®Ÿè¡Œã«å¤±æ•—ã—ã¾ã—ãŸã€‚" -#: ../thunar/thunar-application.c:487 ../thunar/thunar-application.c:520 +#. tell the user that we were unable to launch the file specified on the cmdline +#: ../thunar/thunar-application.c:649 +#, fuzzy, c-format +msgid "Failed to open \"%s\"" +msgstr "ファイル「%sã€ã‚’é–‹ãã®ã«å¤±æ•—ã—ã¾ã—ãŸã€‚" + +#: ../thunar/thunar-application.c:661 +#, fuzzy, c-format +msgid "Failed to open \"%s\": %s" +msgstr "ファイル「%sã€ã‚’é–‹ãã®ã«å¤±æ•—ã—ã¾ã—ãŸã€‚" + +#: ../thunar/thunar-application.c:698 ../thunar/thunar-application.c:731 msgid "Copying files..." msgstr "ファイルをコピーã—ã¦ã„ã¾ã™..." -#: ../thunar/thunar-application.c:554 +#: ../thunar/thunar-application.c:765 msgid "Creating symbolic links..." msgstr "リンクを作æˆã—ã¦ã„ã¾ã™..." -#: ../thunar/thunar-application.c:589 +#: ../thunar/thunar-application.c:800 msgid "Moving files..." msgstr "ファイルを移動ã—ã¦ã„ã¾ã™..." -#: ../thunar/thunar-application.c:624 +#: ../thunar/thunar-application.c:835 msgid "Deleting files..." msgstr "ファイルを削除ã—ã¦ã„ã¾ã™..." -#: ../thunar/thunar-application.c:664 +#: ../thunar/thunar-application.c:875 msgid "Creating files..." msgstr "ファイルを作æˆã—ã¦ã„ã¾ã™..." -#: ../thunar/thunar-application.c:704 +#: ../thunar/thunar-application.c:915 msgid "Creating directories..." msgstr "フォルダを作æˆã—ã¦ã„ã¾ã™..." @@ -553,7 +585,7 @@ msgstr "詳細ãªãƒ•ã‚¡ã‚¤ãƒ«æƒ…å ±ã¨å…±ã«ãƒ•ã‚©ãƒ«ãƒ€ã‚’リスト表示ã—ã¾ msgid "Details view" msgstr "詳細表示" -#: ../thunar/thunar-dialogs.c:74 ../thunar/thunar-dialogs.c:78 +#: ../thunar/thunar-dialogs.c:104 ../thunar/thunar-dialogs.c:112 #: ../thunar-uca/thunar-uca-chooser.c:414 #: ../thunar-uca/thunar-uca-provider.c:329 #, c-format diff --git a/po/nl.po b/po/nl.po index e43ae9950..176bc6226 100644 --- a/po/nl.po +++ b/po/nl.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Thunar 0.2.1svn\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2006-02-07 22:04+0100\n" +"POT-Creation-Date: 2006-02-08 23:51+0100\n" "PO-Revision-Date: 2006-01-31 14:07+0100\n" "Last-Translator: Vincent Tunru <imnotb@gmail.com>\n" "Language-Team: Dutch <vertaling@vrijschrift.org>\n" @@ -249,11 +249,11 @@ msgstr "" "\n" "Wilt u het overslaan?" -#: ../thunar-vfs/thunar-vfs-util.c:68 ../thunar/thunar-path-entry.c:1252 +#: ../thunar-vfs/thunar-vfs-util.c:253 ../thunar/thunar-path-entry.c:1252 msgid "Invalid path" msgstr "Ongeldig pad" -#: ../thunar-vfs/thunar-vfs-util.c:104 +#: ../thunar-vfs/thunar-vfs-util.c:289 #, c-format msgid "Unknown user `%s'" msgstr "Onbekende gebruiker '%s'" @@ -385,37 +385,68 @@ msgstr "Fout bij het kopiëren van speciaal bestand `%s'" msgid "Failed to create symbolic `%s'" msgstr "Fout bij het maken van symbolisch `%s'" +#: ../thunar/main.c:47 +msgid "Run in daemon mode" +msgstr "" + #. setup application name -#: ../thunar/main.c:48 +#: ../thunar/main.c:68 msgid "Thunar" msgstr "Thunar" +#. initialize Gtk+ +#: ../thunar/main.c:78 +msgid "[FILES...]" +msgstr "" + +#: ../thunar/main.c:85 +#, fuzzy, c-format +msgid "Thunar: Failed to open display: %s\n" +msgstr "Fout bij het wijzigen van de naam van `%s'" + +#. yep, there's an error, so print it +#: ../thunar/main.c:90 +#, fuzzy, c-format +msgid "Thunar: %s\n" +msgstr "Thunar" + #. display an error message to the user -#: ../thunar/thunar-application.c:240 +#: ../thunar/thunar-application.c:303 msgid "Failed to launch operation" msgstr "Fout bij het uitvoeren van de operatie" -#: ../thunar/thunar-application.c:487 ../thunar/thunar-application.c:520 +#. tell the user that we were unable to launch the file specified on the cmdline +#: ../thunar/thunar-application.c:649 +#, fuzzy, c-format +msgid "Failed to open \"%s\"" +msgstr "Fout bij het wijzigen van de naam van `%s'" + +#: ../thunar/thunar-application.c:661 +#, fuzzy, c-format +msgid "Failed to open \"%s\": %s" +msgstr "Fout bij het wijzigen van de naam van `%s'" + +#: ../thunar/thunar-application.c:698 ../thunar/thunar-application.c:731 msgid "Copying files..." msgstr "Bestanden aan het kopiëren..." -#: ../thunar/thunar-application.c:554 +#: ../thunar/thunar-application.c:765 msgid "Creating symbolic links..." msgstr "Symbolische snelkoppelingen aan het maken..." -#: ../thunar/thunar-application.c:589 +#: ../thunar/thunar-application.c:800 msgid "Moving files..." msgstr "Bestanden aan het verplaatsen..." -#: ../thunar/thunar-application.c:624 +#: ../thunar/thunar-application.c:835 msgid "Deleting files..." msgstr "Bestanden aan het verwijderen..." -#: ../thunar/thunar-application.c:664 +#: ../thunar/thunar-application.c:875 msgid "Creating files..." msgstr "Bestanden aan het maken..." -#: ../thunar/thunar-application.c:704 +#: ../thunar/thunar-application.c:915 msgid "Creating directories..." msgstr "Mappen aan het maken..." @@ -558,7 +589,7 @@ msgstr "Gedetailleerde mappenweergave" msgid "Details view" msgstr "Gedetailleerde weergavemodus" -#: ../thunar/thunar-dialogs.c:74 ../thunar/thunar-dialogs.c:78 +#: ../thunar/thunar-dialogs.c:104 ../thunar/thunar-dialogs.c:112 #: ../thunar-uca/thunar-uca-chooser.c:414 #: ../thunar-uca/thunar-uca-provider.c:329 #, c-format diff --git a/po/pl.po b/po/pl.po index 871e71e5f..8069cc800 100644 --- a/po/pl.po +++ b/po/pl.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Thunar 0.2.1svn\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2006-02-07 22:04+0100\n" +"POT-Creation-Date: 2006-02-08 23:51+0100\n" "PO-Revision-Date: 2006-01-13 14:21+0100\n" "Last-Translator: Tomasz MichaÅ‚ Åukaszewski <T.Lukaszewski@aster.pl>\n" "Language-Team: Polish <pl@li.org>\n" @@ -240,12 +240,12 @@ msgstr "" "\n" "Czy chcesz go pominąć?" -#: ../thunar-vfs/thunar-vfs-util.c:68 ../thunar/thunar-path-entry.c:1252 +#: ../thunar-vfs/thunar-vfs-util.c:253 ../thunar/thunar-path-entry.c:1252 #, fuzzy msgid "Invalid path" msgstr "NieprawidÅ‚owa nazwa pliku" -#: ../thunar-vfs/thunar-vfs-util.c:104 +#: ../thunar-vfs/thunar-vfs-util.c:289 #, c-format msgid "Unknown user `%s'" msgstr "" @@ -376,39 +376,70 @@ msgstr "Nie udaÅ‚o siÄ™ skopiować pliku specjalnego '%s'" msgid "Failed to create symbolic `%s'" msgstr "Nie udaÅ‚o siÄ™ utworzyć dowiÄ…zania '%s'" +#: ../thunar/main.c:47 +msgid "Run in daemon mode" +msgstr "" + #. setup application name -#: ../thunar/main.c:48 +#: ../thunar/main.c:68 msgid "Thunar" msgstr "" +#. initialize Gtk+ +#: ../thunar/main.c:78 +msgid "[FILES...]" +msgstr "" + +#: ../thunar/main.c:85 +#, fuzzy, c-format +msgid "Thunar: Failed to open display: %s\n" +msgstr "Nie udaÅ‚o siÄ™ zmienić nazwy %s." + +#. yep, there's an error, so print it +#: ../thunar/main.c:90 +#, c-format +msgid "Thunar: %s\n" +msgstr "" + #. display an error message to the user -#: ../thunar/thunar-application.c:240 +#: ../thunar/thunar-application.c:303 #, fuzzy msgid "Failed to launch operation" msgstr "Nie udaÅ‚o siÄ™ dodać aplikacji %s." -#: ../thunar/thunar-application.c:487 ../thunar/thunar-application.c:520 +#. tell the user that we were unable to launch the file specified on the cmdline +#: ../thunar/thunar-application.c:649 +#, fuzzy, c-format +msgid "Failed to open \"%s\"" +msgstr "Nie udaÅ‚o siÄ™ zmienić nazwy %s." + +#: ../thunar/thunar-application.c:661 +#, fuzzy, c-format +msgid "Failed to open \"%s\": %s" +msgstr "Nie udaÅ‚o siÄ™ zmienić nazwy %s." + +#: ../thunar/thunar-application.c:698 ../thunar/thunar-application.c:731 msgid "Copying files..." msgstr "Kopiowanie plików..." -#: ../thunar/thunar-application.c:554 +#: ../thunar/thunar-application.c:765 msgid "Creating symbolic links..." msgstr "Tworzenie dowiÄ…zaÅ„..." -#: ../thunar/thunar-application.c:589 +#: ../thunar/thunar-application.c:800 msgid "Moving files..." msgstr "Przenoszenie plików..." -#: ../thunar/thunar-application.c:624 +#: ../thunar/thunar-application.c:835 msgid "Deleting files..." msgstr "Usuwanie plików..." -#: ../thunar/thunar-application.c:664 +#: ../thunar/thunar-application.c:875 #, fuzzy msgid "Creating files..." msgstr "WyszukujÄ™ pliki..." -#: ../thunar/thunar-application.c:704 +#: ../thunar/thunar-application.c:915 #, fuzzy msgid "Creating directories..." msgstr "Usuwam katalogi..." @@ -552,7 +583,7 @@ msgstr "Pokazuj szczegóły elementów w katalogu" msgid "Details view" msgstr "Widok szczegółowy" -#: ../thunar/thunar-dialogs.c:74 ../thunar/thunar-dialogs.c:78 +#: ../thunar/thunar-dialogs.c:104 ../thunar/thunar-dialogs.c:112 #: ../thunar-uca/thunar-uca-chooser.c:414 #: ../thunar-uca/thunar-uca-provider.c:329 #, c-format diff --git a/po/pt_BR.po b/po/pt_BR.po index 93bfb28cb..034793824 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Thunar 0.2.1svn\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2006-02-07 22:04+0100\n" +"POT-Creation-Date: 2006-02-08 23:51+0100\n" "PO-Revision-Date: 2005-11-17 16:55+0900\n" "Last-Translator: Joao Pedrosa <joaopedrosa@gmail.com>\n" "Language-Team: os-cillation <info@os-cillation.com>\n" @@ -240,12 +240,12 @@ msgstr "" "\n" "Você quer pulá-lo?" -#: ../thunar-vfs/thunar-vfs-util.c:68 ../thunar/thunar-path-entry.c:1252 +#: ../thunar-vfs/thunar-vfs-util.c:253 ../thunar/thunar-path-entry.c:1252 #, fuzzy msgid "Invalid path" msgstr "Nome de arquivo inválido" -#: ../thunar-vfs/thunar-vfs-util.c:104 +#: ../thunar-vfs/thunar-vfs-util.c:289 #, c-format msgid "Unknown user `%s'" msgstr "" @@ -373,38 +373,69 @@ msgstr "Falha em copiar arquivo especial `%s'" msgid "Failed to create symbolic `%s'" msgstr "Falha em criar simbólico `%s'" +#: ../thunar/main.c:47 +msgid "Run in daemon mode" +msgstr "" + #. setup application name -#: ../thunar/main.c:48 +#: ../thunar/main.c:68 msgid "Thunar" msgstr "Thunar" +#. initialize Gtk+ +#: ../thunar/main.c:78 +msgid "[FILES...]" +msgstr "" + +#: ../thunar/main.c:85 +#, fuzzy, c-format +msgid "Thunar: Failed to open display: %s\n" +msgstr "Falha em renomear `%s'" + +#. yep, there's an error, so print it +#: ../thunar/main.c:90 +#, fuzzy, c-format +msgid "Thunar: %s\n" +msgstr "Thunar" + #. display an error message to the user -#: ../thunar/thunar-application.c:240 +#: ../thunar/thunar-application.c:303 msgid "Failed to launch operation" msgstr "Falha em lançar operação" -#: ../thunar/thunar-application.c:487 ../thunar/thunar-application.c:520 +#. tell the user that we were unable to launch the file specified on the cmdline +#: ../thunar/thunar-application.c:649 +#, fuzzy, c-format +msgid "Failed to open \"%s\"" +msgstr "Falha em renomear `%s'" + +#: ../thunar/thunar-application.c:661 +#, fuzzy, c-format +msgid "Failed to open \"%s\": %s" +msgstr "Falha em renomear `%s'" + +#: ../thunar/thunar-application.c:698 ../thunar/thunar-application.c:731 msgid "Copying files..." msgstr "Copiando arquivos..." -#: ../thunar/thunar-application.c:554 +#: ../thunar/thunar-application.c:765 msgid "Creating symbolic links..." msgstr "Criando ligações simbólicas..." -#: ../thunar/thunar-application.c:589 +#: ../thunar/thunar-application.c:800 msgid "Moving files..." msgstr "Movendo arquivos..." -#: ../thunar/thunar-application.c:624 +#: ../thunar/thunar-application.c:835 msgid "Deleting files..." msgstr "Deletando arquivos..." -#: ../thunar/thunar-application.c:664 +#: ../thunar/thunar-application.c:875 #, fuzzy msgid "Creating files..." msgstr "Coletando arquivos..." -#: ../thunar/thunar-application.c:704 +#: ../thunar/thunar-application.c:915 msgid "Creating directories..." msgstr "Criando diretórios..." @@ -547,7 +578,7 @@ msgstr "Listagem de diretório detalhada" msgid "Details view" msgstr "Visualização de detalhes" -#: ../thunar/thunar-dialogs.c:74 ../thunar/thunar-dialogs.c:78 +#: ../thunar/thunar-dialogs.c:104 ../thunar/thunar-dialogs.c:112 #: ../thunar-uca/thunar-uca-chooser.c:414 #: ../thunar-uca/thunar-uca-provider.c:329 #, c-format diff --git a/po/ru.po b/po/ru.po index da4c3c377..ffd375226 100644 --- a/po/ru.po +++ b/po/ru.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Thunar 0.2.1svn\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2006-02-07 22:04+0100\n" +"POT-Creation-Date: 2006-02-08 23:51+0100\n" "PO-Revision-Date: 2006-01-29 17:47+0500\n" "Last-Translator: Andrey Fedoseev <andrey.fedoseev@gmail.com>\n" "Language-Team: Russian <ru@li.org>\n" @@ -243,11 +243,11 @@ msgstr "" "\n" "ПропуÑтить?" -#: ../thunar-vfs/thunar-vfs-util.c:68 ../thunar/thunar-path-entry.c:1252 +#: ../thunar-vfs/thunar-vfs-util.c:253 ../thunar/thunar-path-entry.c:1252 msgid "Invalid path" msgstr "Ðеверный путь" -#: ../thunar-vfs/thunar-vfs-util.c:104 +#: ../thunar-vfs/thunar-vfs-util.c:289 #, c-format msgid "Unknown user `%s'" msgstr "ÐеизвеÑтный пользователь '%s'" @@ -376,37 +376,68 @@ msgstr "" msgid "Failed to create symbolic `%s'" msgstr "" +#: ../thunar/main.c:47 +msgid "Run in daemon mode" +msgstr "" + #. setup application name -#: ../thunar/main.c:48 +#: ../thunar/main.c:68 msgid "Thunar" msgstr "Thunar" +#. initialize Gtk+ +#: ../thunar/main.c:78 +msgid "[FILES...]" +msgstr "" + +#: ../thunar/main.c:85 +#, fuzzy, c-format +msgid "Thunar: Failed to open display: %s\n" +msgstr "Ðе удалоÑÑŒ переименовать `%s'" + +#. yep, there's an error, so print it +#: ../thunar/main.c:90 +#, fuzzy, c-format +msgid "Thunar: %s\n" +msgstr "Thunar" + #. display an error message to the user -#: ../thunar/thunar-application.c:240 +#: ../thunar/thunar-application.c:303 msgid "Failed to launch operation" msgstr "" -#: ../thunar/thunar-application.c:487 ../thunar/thunar-application.c:520 +#. tell the user that we were unable to launch the file specified on the cmdline +#: ../thunar/thunar-application.c:649 +#, fuzzy, c-format +msgid "Failed to open \"%s\"" +msgstr "Ðе удалоÑÑŒ переименовать `%s'" + +#: ../thunar/thunar-application.c:661 +#, fuzzy, c-format +msgid "Failed to open \"%s\": %s" +msgstr "Ðе удалоÑÑŒ переименовать `%s'" + +#: ../thunar/thunar-application.c:698 ../thunar/thunar-application.c:731 msgid "Copying files..." msgstr "Копирование файлов..." -#: ../thunar/thunar-application.c:554 +#: ../thunar/thunar-application.c:765 msgid "Creating symbolic links..." msgstr "Создание ÑимволичеÑких ÑÑылок..." -#: ../thunar/thunar-application.c:589 +#: ../thunar/thunar-application.c:800 msgid "Moving files..." msgstr "Перемещение файлов..." -#: ../thunar/thunar-application.c:624 +#: ../thunar/thunar-application.c:835 msgid "Deleting files..." msgstr "Удаление файлов..." -#: ../thunar/thunar-application.c:664 +#: ../thunar/thunar-application.c:875 msgid "Creating files..." msgstr "Создание файлов..." -#: ../thunar/thunar-application.c:704 +#: ../thunar/thunar-application.c:915 msgid "Creating directories..." msgstr "Создание каталогов..." @@ -549,7 +580,7 @@ msgstr "" msgid "Details view" msgstr "" -#: ../thunar/thunar-dialogs.c:74 ../thunar/thunar-dialogs.c:78 +#: ../thunar/thunar-dialogs.c:104 ../thunar/thunar-dialogs.c:112 #: ../thunar-uca/thunar-uca-chooser.c:414 #: ../thunar-uca/thunar-uca-provider.c:329 #, c-format diff --git a/thunar-vfs/thunar-vfs-path.c b/thunar-vfs/thunar-vfs-path.c index f0cce20c5..9139a7f07 100644 --- a/thunar-vfs/thunar-vfs-path.c +++ b/thunar-vfs/thunar-vfs-path.c @@ -1,6 +1,6 @@ /* $Id$ */ /*- - * Copyright (c) 2005 Benedikt Meurer <benny@xfce.org> + * Copyright (c) 2005-2006 Benedikt Meurer <benny@xfce.org> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -34,6 +34,7 @@ #define __THUNAR_VFS_PATH_C__ #include <thunar-vfs/thunar-vfs-path.h> +#include <thunar-vfs/thunar-vfs-util.h> #include <thunar-vfs/thunar-vfs-alias.h> @@ -218,7 +219,7 @@ thunar_vfs_path_new (const gchar *identifier, guint n; /* check if we have an absolute path or an URI */ - if (G_UNLIKELY (*identifier != '/')) + if (G_UNLIKELY (*identifier != G_DIR_SEPARATOR)) { /* treat the identifier as URI */ filename = g_filename_from_uri (identifier, NULL, error); @@ -227,8 +228,8 @@ thunar_vfs_path_new (const gchar *identifier, } else { - /* the identifier includes an absolute path */ - filename = (gchar *) identifier; + /* canonicalize the absolute path, to remove additional slashes and dots */ + filename = thunar_vfs_canonicalize_filename (identifier); } /* start at the root path */ @@ -236,7 +237,7 @@ thunar_vfs_path_new (const gchar *identifier, for (n = 1, s = filename + 1; n < n_home_components; ++n) { /* skip additional slashes */ - for (; G_UNLIKELY (*s == '/'); ++s) + for (; G_UNLIKELY (*s == G_DIR_SEPARATOR); ++s) ; /* check if we have reached the end of the filename */ @@ -246,7 +247,7 @@ thunar_vfs_path_new (const gchar *identifier, /* check if the path component equals the next home path component */ for (s1 = thunar_vfs_path_get_name (home_components[n]), s2 = s; *s1 != '\0' && *s1 == *s2; ++s1, ++s2) ; - if (*s1 != '\0' || (*s2 != '\0' && *s2 != '/')) + if (*s1 != '\0' || (*s2 != '\0' && *s2 != G_DIR_SEPARATOR)) break; /* go on with the next home path component */ @@ -255,7 +256,7 @@ thunar_vfs_path_new (const gchar *identifier, } /* skip additional slashes */ - for (; G_UNLIKELY (*s == '/'); ++s) + for (; G_UNLIKELY (*s == G_DIR_SEPARATOR); ++s) ; /* generate the additional path components (if any) */ @@ -265,7 +266,7 @@ thunar_vfs_path_new (const gchar *identifier, parent = path; /* determine the length of the path component in bytes */ - for (s1 = s + 1; *s1 != '\0' && *s1 != '/'; ++s1) + for (s1 = s + 1; *s1 != '\0' && *s1 != G_DIR_SEPARATOR; ++s1) ; n = (((s1 - s) + sizeof (guint)) / sizeof (guint)) * sizeof (guint); @@ -285,17 +286,16 @@ thunar_vfs_path_new (const gchar *identifier, *(((guint *) (((gchar *) path) + sizeof (ThunarVfsPath) + n)) - 1) = 0; /* copy the path component name */ - for (t = (gchar *) thunar_vfs_path_get_name (path); *s != '\0' && *s != '/'; ) + for (t = (gchar *) thunar_vfs_path_get_name (path); *s != '\0' && *s != G_DIR_SEPARATOR; ) *t++ = *s++; /* skip additional slashes */ - for (; G_UNLIKELY (*s == '/'); ++s) + for (; G_UNLIKELY (*s == G_DIR_SEPARATOR); ++s) ; } /* cleanup */ - if ((const gchar *) filename != identifier) - g_free (filename); + g_free (filename); /* return a reference on the path */ return thunar_vfs_path_ref (path); diff --git a/thunar-vfs/thunar-vfs-util.c b/thunar-vfs/thunar-vfs-util.c index c54d23dcd..94613d860 100644 --- a/thunar-vfs/thunar-vfs-util.c +++ b/thunar-vfs/thunar-vfs-util.c @@ -16,6 +16,10 @@ * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. + * + * thunar_vfs_canonicalize_pathname() derived from code by Brian Fox and Chet + * Ramey in GNU Bash, the Bourne Again SHell. Copyright (C) 1987, 1988, 1989, + * 1990, 1991, 1992 Free Software Foundation, Inc. */ #ifdef HAVE_CONFIG_H @@ -26,9 +30,15 @@ #include <sys/types.h> #endif +#ifdef HAVE_MEMORY_H +#include <memory.h> +#endif #ifdef HAVE_PWD_H #include <pwd.h> #endif +#ifdef HAVE_STRING_H +#include <string.h> +#endif #include <libxfce4util/libxfce4util.h> @@ -37,6 +47,181 @@ +static inline gint +find_next_slash (const gchar *path, + gint current_offset) +{ + const gchar *match; + match = strchr (path + current_offset, G_DIR_SEPARATOR); + return (match == NULL) ? -1 : (match - path); +} + + + +static inline gint +find_slash_before_offset (const gchar *path, + gint to) +{ + gint next_offset; + gint result = -1; + + for (next_offset = 0;; ++next_offset) + { + next_offset = find_next_slash (path, next_offset); + if (next_offset < 0 || next_offset >= to) + break; + + result = next_offset; + } + + return result; +} + + + +static inline void +collapse_slash_runs (gchar *path, + gint from_offset) +{ + gint i; + + /* Collapse multiple `/'s in a row. */ + for (i = from_offset; path[i] == G_DIR_SEPARATOR; i++) + ; + + if (from_offset < i) + memmove (path + from_offset, path + i, strlen (path + i) + 1); +} + + + +/** + * thunar_vfs_canonicalize_filename: + * @filename : a local filename. + * + * Canonicalizes @filename and returns a new path. The new path + * differs from @filename in: + * + * <simplelist> + * <member>Multiple `/'s are collapsed to a single `/'.</member> + * <member>Leading `./'s and trailing `/.'s are removed.</member> + * <member>Non-leading `../'s and trailing `..'s are handled by removing portions of the path.</member> + * </simplelist> + * + * The caller is responsible to free the returned string using + * g_free() when no longer needed. + * + * Return value: the canonicalized path for @filename. + **/ +gchar* +thunar_vfs_canonicalize_filename (const gchar *filename) +{ + gchar *path; + gint marker; + gint i; + + g_return_val_if_fail (filename != NULL, NULL); + + /* take a copy of the filename to operate on */ + path = g_strdup (filename); + if (G_UNLIKELY (*path == '\0')) + return path; + + /* Walk along path looking for things to compact. */ + for (i = 0, marker = 0;;) + { + if (G_UNLIKELY (path[i] == '\0')) + break; + + /* Check for `../', `./' or trailing `.' by itself. */ + if (path[i] == '.') + { + /* Handle trailing `.' by itself. */ + if (path[i + 1] == '\0') + { + if (i > 1 && path[i - 1] == G_DIR_SEPARATOR) + { + /* strip the trailing /. */ + path[i - 1] = '\0'; + } + else + { + /* convert path "/." to "/" */ + path[i] = '\0'; + } + break; + } + + /* Handle `./'. */ + if (path[i + 1] == G_DIR_SEPARATOR) + { + memmove (path + i, path + i + 2, strlen (path + i + 2) + 1); + if (i == 0) + { + /* don't leave leading '/' for paths that started + * as relative (.//foo) + */ + collapse_slash_runs (path, i); + marker = 0; + } + continue; + } + + /* Handle `../' or trailing `..' by itself. + * Remove the previous xxx/ part + */ + if (path[i + 1] == '.' && (path[i + 2] == G_DIR_SEPARATOR || path[i + 2] == '\0')) + { + /* ignore ../ at the beginning of a path */ + if (i != 0) + { + marker = find_slash_before_offset (path, i - 1); + + /* Either advance past '/' or point to the first character */ + marker ++; + if (path [i + 2] == '\0' && marker > 1) + { + /* If we are looking at a /.. at the end of the uri and we + * need to eat the last '/' too. + */ + marker--; + } + + /* strip the entire ../ string */ + if (path[i + 2] == G_DIR_SEPARATOR) + ++i; + + memmove (path + marker, path + i + 2, strlen (path + i + 2) + 1); + i = marker; + } + else + { + i = 2; + if (path[i] == G_DIR_SEPARATOR) + i++; + } + + collapse_slash_runs (path, i); + continue; + } + } + + /* advance to the next '/' */ + i = find_next_slash (path, i); + + /* If we didn't find any slashes, then there is nothing left to do. */ + if (i < 0) + break; + + marker = i++; + collapse_slash_runs (path, i); + } + + return path; +} + + + /** * thunar_vfs_expand_filename: * @filename : a local filename. diff --git a/thunar-vfs/thunar-vfs-util.h b/thunar-vfs/thunar-vfs-util.h index 29e3a6c55..d2cd0ced9 100644 --- a/thunar-vfs/thunar-vfs-util.h +++ b/thunar-vfs/thunar-vfs-util.h @@ -26,12 +26,14 @@ G_BEGIN_DECLS; -gchar *thunar_vfs_expand_filename (const gchar *filename, - GError **error) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT; +gchar *thunar_vfs_canonicalize_filename (const gchar *filename) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT; -gchar *thunar_vfs_humanize_size (ThunarVfsFileSize size, - gchar *buffer, - gsize buflen); +gchar *thunar_vfs_expand_filename (const gchar *filename, + GError **error) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT; + +gchar *thunar_vfs_humanize_size (ThunarVfsFileSize size, + gchar *buffer, + gsize buflen); G_END_DECLS; diff --git a/thunar-vfs/thunar-vfs.symbols b/thunar-vfs/thunar-vfs.symbols index 5391ec8bf..38a9ba33b 100644 --- a/thunar-vfs/thunar-vfs.symbols +++ b/thunar-vfs/thunar-vfs.symbols @@ -294,6 +294,7 @@ thunar_vfs_user_manager_get_all_groups G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT /* thunar-vfs-util functions */ #if IN_HEADER(__THUNAR_VFS_UTIL_H__) #if IN_SOURCE(__THUNAR_VFS_UTIL_C__) +thunar_vfs_canonicalize_filename G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT thunar_vfs_expand_filename G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT thunar_vfs_humanize_size #endif @@ -307,6 +308,7 @@ thunar_vfs_volume_get_kind thunar_vfs_volume_get_name thunar_vfs_volume_get_status thunar_vfs_volume_get_mount_point +thunar_vfs_volume_is_disc thunar_vfs_volume_is_mounted thunar_vfs_volume_is_present thunar_vfs_volume_is_ejectable diff --git a/thunar/Makefile.am b/thunar/Makefile.am index d8329f24e..115eb4725 100644 --- a/thunar/Makefile.am +++ b/thunar/Makefile.am @@ -165,6 +165,8 @@ thunar_built_sources += \ thunar-dbus-service-infos.h thunar_dbus_sources = \ + thunar-dbus-client.c \ + thunar-dbus-client.h \ thunar-dbus-service.c \ thunar-dbus-service.h diff --git a/thunar/main.c b/thunar/main.c index 93e5517a0..f9afdcadd 100644 --- a/thunar/main.c +++ b/thunar/main.c @@ -28,18 +28,38 @@ #include <stdlib.h> #endif +#include <glib/gstdio.h> + #include <thunar/thunar-application.h> +#include <thunar/thunar-dbus-client.h> +#include <thunar/thunar-dbus-service.h> #include <thunar/thunar-stock.h> +/* --- globals --- */ +static gboolean opt_daemon = FALSE; + + +/* --- command line options --- */ +static GOptionEntry option_entries[] = +{ + { "daemon", 0, 0, G_OPTION_ARG_NONE, &opt_daemon, N_ ("Run in daemon mode"), NULL, }, + { NULL, }, +}; + + + int main (int argc, char **argv) { +#ifdef HAVE_DBUS + ThunarDBusService *dbus_service; +#endif ThunarApplication *application; - ThunarVfsPath *path; - ThunarFile *file = NULL; GError *error = NULL; + gchar *working_directory = NULL; + gchar **filenames = NULL; /* setup translation domain */ xfce_textdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR, "UTF-8"); @@ -54,13 +74,63 @@ main (int argc, char **argv) g_log_set_always_fatal (G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING); #endif + /* initialize Gtk+ */ + if (!gtk_init_with_args (&argc, &argv, _("[FILES...]"), option_entries, GETTEXT_PACKAGE, &error)) + { + /* check if we have an error message */ + if (G_LIKELY (error == NULL)) + { + /* no error message, the GUI initialization failed */ + const gchar *display_name = gdk_get_display_arg_name (); + g_fprintf (stderr, _("Thunar: Failed to open display: %s\n"), (display_name != NULL) ? display_name : " "); + } + else + { + /* yep, there's an error, so print it */ + g_fprintf (stderr, _("Thunar: %s\n"), error->message); + g_error_free (error); + } + return EXIT_FAILURE; + } + + /* do not try to connect to a running instance, or + * open any windows if run as daemon. + */ + if (G_LIKELY (!opt_daemon)) + { + /* determine the current working directory */ + working_directory = g_get_current_dir (); + + /* check if atleast one filename was specified */ + if (G_LIKELY (argc > 1)) + { + /* use the specified filenames */ + filenames = g_strdupv (argv + 1); + } + else + { + /* use the current working directory */ + filenames = g_new (gchar *, 2); + filenames[0] = g_strdup (working_directory); + filenames[1] = NULL; + } + +#ifdef HAVE_DBUS + /* try to reuse an existing instance */ + if (thunar_dbus_client_launch_files (working_directory, filenames, NULL, NULL)) + { + /* that worked, let's get outa here */ + g_free (working_directory); + g_strfreev (filenames); + return EXIT_SUCCESS; + } +#endif + } + /* initialize the GLib thread support */ if (!g_thread_supported ()) g_thread_init (NULL); - /* initialize Gtk+ */ - gtk_init (&argc, &argv); - /* initialize the ThunarVFS library */ thunar_vfs_init (); @@ -73,28 +143,45 @@ main (int argc, char **argv) /* use the Thunar icon as default for new windows */ gtk_window_set_default_icon_name ("Thunar"); - path = (argc > 1) ? thunar_vfs_path_new (argv[1], &error) : thunar_vfs_path_get_for_home (); - if (G_LIKELY (path != NULL)) + /* if not in daemon mode, try to process the filenames here */ + if (G_LIKELY (!opt_daemon)) { - file = thunar_file_get_for_path (path, &error); - thunar_vfs_path_unref (path); + /* try to process the given filenames */ + if (!thunar_application_process_filenames (application, working_directory, filenames, NULL, &error)) + { + g_fprintf (stderr, "Thunar: %s\n", error->message); + g_object_unref (G_OBJECT (application)); + thunar_vfs_shutdown (); + g_error_free (error); + return EXIT_FAILURE; + } + + /* release working directory and filenames */ + g_free (working_directory); + g_strfreev (filenames); } - - if (path == NULL || file == NULL) + else { - fprintf (stderr, "%s: Failed to open `%s': %s\n", - argv[0], (argc > 1) ? argv[1] : xfce_get_homedir (), - error->message); - g_error_free (error); - return EXIT_FAILURE; + /* run in daemon mode, since we were started by the message bus */ + thunar_application_set_daemon (application, TRUE); } - /* open the first window */ - thunar_application_open_window (application, file, NULL); + /* do not enter the main loop, unless we have atleast one window or we are in daemon mode */ + if (thunar_application_has_windows (application) || thunar_application_get_daemon (application)) + { + /* attach the D-BUS service */ +#ifdef HAVE_DBUS + dbus_service = g_object_new (THUNAR_TYPE_DBUS_SERVICE, NULL); +#endif - g_object_unref (G_OBJECT (file)); + /* enter the main loop */ + gtk_main (); - gtk_main (); + /* detach the D-BUS service */ +#ifdef HAVE_DBUS + g_object_unref (G_OBJECT (dbus_service)); +#endif + } /* release the application reference */ g_object_unref (G_OBJECT (application)); diff --git a/thunar/thunar-application.c b/thunar/thunar-application.c index 6a164f714..296eda782 100644 --- a/thunar/thunar-application.c +++ b/thunar/thunar-application.c @@ -27,10 +27,6 @@ #include <thunar/thunar-preferences.h> #include <thunar/thunar-progress-dialog.h> -#ifdef HAVE_DBUS -#include <thunar/thunar-dbus-service.h> -#endif - /* Prototype for the Thunar-VFS job launchers */ @@ -40,9 +36,26 @@ typedef ThunarVfsJob *(*Launcher) (GList *source_path_list, +/* Property identifiers */ +enum +{ + PROP_0, + PROP_DAEMON, +}; + + + static void thunar_application_class_init (ThunarApplicationClass *klass); static void thunar_application_init (ThunarApplication *application); static void thunar_application_finalize (GObject *object); +static void thunar_application_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec); +static void thunar_application_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec); static void thunar_application_collect_and_launch (ThunarApplication *application, GtkWidget *widget, const gchar *icon_name, @@ -78,9 +91,7 @@ struct _ThunarApplication ThunarPreferences *preferences; GList *windows; -#ifdef HAVE_DBUS - ThunarDBusService *dbus_service; -#endif + gboolean daemon; gint show_dialogs_timer_id; }; @@ -130,6 +141,24 @@ thunar_application_class_init (ThunarApplicationClass *klass) gobject_class = G_OBJECT_CLASS (klass); gobject_class->finalize = thunar_application_finalize; + gobject_class->get_property = thunar_application_get_property; + gobject_class->set_property = thunar_application_set_property; + + /** + * ThunarApplication:daemon: + * + * %TRUE if the application should be run in daemon mode, + * in which case it will never terminate. %FALSE if the + * application should terminate once the last window is + * closed. + **/ + g_object_class_install_property (gobject_class, + PROP_DAEMON, + g_param_spec_boolean ("daemon", + "daemon", + "daemon", + FALSE, + EXO_PARAM_READWRITE)); } @@ -139,11 +168,6 @@ thunar_application_init (ThunarApplication *application) { application->preferences = thunar_preferences_get (); application->show_dialogs_timer_id = -1; - - /* start the D-BUS service if built with D-BUS support */ -#ifdef HAVE_DBUS - application->dbus_service = g_object_new (THUNAR_TYPE_DBUS_SERVICE, NULL); -#endif } @@ -154,11 +178,6 @@ thunar_application_finalize (GObject *object) ThunarApplication *application = THUNAR_APPLICATION (object); GList *lp; - /* stop the D-BUS service if built with D-BUS support */ -#ifdef HAVE_DBUS - g_object_unref (G_OBJECT (application->dbus_service)); -#endif - /* drop any running "show dialogs" timer */ if (G_UNLIKELY (application->show_dialogs_timer_id >= 0)) g_source_remove (application->show_dialogs_timer_id); @@ -179,6 +198,50 @@ thunar_application_finalize (GObject *object) +static void +thunar_application_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + ThunarApplication *application = THUNAR_APPLICATION (object); + + switch (prop_id) + { + case PROP_DAEMON: + g_value_set_boolean (value, thunar_application_get_daemon (application)); + break; + + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + + + +static void +thunar_application_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + ThunarApplication *application = THUNAR_APPLICATION (object); + + switch (prop_id) + { + case PROP_DAEMON: + thunar_application_set_daemon (application, g_value_get_boolean (value)); + break; + + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + + + static void thunar_application_collect_and_launch (ThunarApplication *application, GtkWidget *widget, @@ -292,13 +355,10 @@ thunar_application_window_destroyed (GtkWidget *window, application->windows = g_list_remove (application->windows, window); /* terminate the application if we don't have any more - * windows and we don't manage the desktop. + * windows and we are not in daemon mode. */ - if (G_UNLIKELY (application->windows == NULL - /*&& application->desktop_view == NULL*/)) - { - gtk_main_quit (); - } + if (G_UNLIKELY (application->windows == NULL && !application->daemon)) + gtk_main_quit (); } @@ -361,6 +421,45 @@ thunar_application_get (void) +/** + * thunar_application_get_daemon: + * @application : a #ThunarApplication. + * + * Returns %TRUE if @application is in daemon mode. + * + * Return value: %TRUE if @application is in daemon mode. + **/ +gboolean +thunar_application_get_daemon (ThunarApplication *application) +{ + g_return_val_if_fail (THUNAR_IS_APPLICATION (application), FALSE); + return application->daemon; +} + + + +/** + * thunar_application_set_daemon: + * @application : a #ThunarApplication. + * @daemon : %TRUE to set @application into daemon mode. + * + * If @daemon is %TRUE, @application will be set into daemon mode. + **/ +void +thunar_application_set_daemon (ThunarApplication *application, + gboolean daemon) +{ + g_return_if_fail (THUNAR_IS_APPLICATION (application)); + + if (application->daemon != daemon) + { + application->daemon = daemon; + g_object_notify (G_OBJECT (application), "daemon"); + } +} + + + /** * thunar_application_get_windows: * @application : a #ThunarApplication. @@ -387,6 +486,22 @@ thunar_application_get_windows (ThunarApplication *application) } +/** + * thunar_application_has_windows: + * @application : a #ThunarApplication. + * + * Returns %TRUE if @application controls atleast one window. + * + * Return value: %TRUE if @application controls atleast one window. + **/ +gboolean +thunar_application_has_windows (ThunarApplication *application) +{ + g_return_val_if_fail (THUNAR_IS_APPLICATION (application), FALSE); + return (application->windows != NULL); +} + + /** * thunar_application_take_window: @@ -455,6 +570,102 @@ thunar_application_open_window (ThunarApplication *application, +/** + * thunar_application_process_filenames: + * @application : a #ThunarApplication. + * @working_directory : the working directory relative to which the @filenames should + * be interpreted. + * @filenames : a list of file:-URIs or filenames. If a filename is specified + * it can be either an absolute path or a path relative to the + * @working_directory. + * @screen : the #GdkScreen on which to process the @filenames, or %NULL to + * use the default screen. + * @error : return location for errors or %NULL. + * + * Tells @application to process the given @filenames and launch them appropriately. + * + * Return value: %TRUE on success, %FALSE if @error is set. + **/ +gboolean +thunar_application_process_filenames (ThunarApplication *application, + const gchar *working_directory, + gchar **filenames, + GdkScreen *screen, + GError **error) +{ + ThunarVfsPath *path; + ThunarFile *file; + GError *derror = NULL; + gchar *filename; + GList *file_list = NULL; + GList *lp; + gint n; + + g_return_val_if_fail (THUNAR_IS_APPLICATION (application), FALSE); + g_return_val_if_fail (working_directory != NULL, FALSE); + g_return_val_if_fail (filenames != NULL, FALSE); + g_return_val_if_fail (*filenames != NULL, FALSE); + g_return_val_if_fail (screen == NULL || GDK_IS_SCREEN (screen), FALSE); + g_return_val_if_fail (error == NULL || *error == NULL, FALSE); + + /* try to process all filenames and convert them to the appropriate file objects */ + for (n = 0; filenames[n] != NULL; ++n) + { + /* check if the filename is an absolute path or a file:-URI */ + if (g_path_is_absolute (filenames[n]) || g_str_has_prefix (filenames[n], "file:")) + { + /* determine the path for the filename directly */ + path = thunar_vfs_path_new (filenames[n], &derror); + } + else + { + /* translate the filename into an absolute path first */ + filename = g_build_filename (working_directory, filenames[n], NULL); + path = thunar_vfs_path_new (filename, &derror); + g_free (filename); + } + + /* determine the file for the path */ + file = (path != NULL) ? thunar_file_get_for_path (path, &derror) : NULL; + + /* release the path (if any) */ + if (G_LIKELY (path != NULL)) + thunar_vfs_path_unref (path); + + /* verify that we have a valid file */ + if (G_LIKELY (file != NULL)) + file_list = g_list_append (file_list, file); + else + goto failure; + } + + /* ok, let's try to launch the given files then */ + for (lp = file_list; lp != NULL; lp = lp->next) + { + /* try to launch this file, display an error dialog if that fails */ + if (!thunar_file_launch (lp->data, screen, &derror)) + { + /* tell the user that we were unable to launch the file specified on the cmdline */ + thunar_dialogs_show_error (screen, derror, _("Failed to open \"%s\""), thunar_file_get_display_name (lp->data)); + g_error_free (derror); + break; + } + } + + /* release all files */ + thunar_file_list_free (file_list); + + return TRUE; + +failure: + g_set_error (error, derror->domain, derror->code, _("Failed to open \"%s\": %s"), filenames[n], derror->message); + thunar_file_list_free (file_list); + g_error_free (derror); + return FALSE; +} + + + /** * thunar_application_copy_to: * @application : a #ThunarApplication. diff --git a/thunar/thunar-application.h b/thunar/thunar-application.h index 9194b9494..5e29215cf 100644 --- a/thunar/thunar-application.h +++ b/thunar/thunar-application.h @@ -35,56 +35,68 @@ typedef struct _ThunarApplication ThunarApplication; #define THUNAR_IS_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), THUNAR_TYPE_APPLICATION)) #define THUNAR_APPLICATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), THUNAR_TYPE_APPLICATION, ThunarApplicationClass)) -GType thunar_application_get_type (void) G_GNUC_CONST; - -ThunarApplication *thunar_application_get (void); - -GList *thunar_application_get_windows (ThunarApplication *application); - -void thunar_application_take_window (ThunarApplication *application, - GtkWindow *window); - -void thunar_application_open_window (ThunarApplication *application, - ThunarFile *directory, - GdkScreen *screen); - -void thunar_application_copy_to (ThunarApplication *application, - GtkWidget *widget, - GList *source_path_list, - GList *target_path_list, - GClosure *new_files_closure); - -void thunar_application_copy_into (ThunarApplication *application, - GtkWidget *widget, - GList *source_path_list, - ThunarVfsPath *target_path, - GClosure *new_files_closure); - -void thunar_application_link_into (ThunarApplication *application, - GtkWidget *widget, - GList *source_path_list, - ThunarVfsPath *target_path, - GClosure *new_files_closure); - -void thunar_application_move_into (ThunarApplication *application, - GtkWidget *widget, - GList *source_path_list, - ThunarVfsPath *target_path, - GClosure *new_files_closure); - -void thunar_application_unlink (ThunarApplication *application, - GtkWidget *widget, - GList *path_list); - -void thunar_application_creat (ThunarApplication *application, - GtkWidget *widget, - GList *path_list, - GClosure *new_files_closure); - -void thunar_application_mkdir (ThunarApplication *application, - GtkWidget *widget, - GList *path_list, - GClosure *new_files_closure); +GType thunar_application_get_type (void) G_GNUC_CONST; + +ThunarApplication *thunar_application_get (void); + +gboolean thunar_application_get_daemon (ThunarApplication *application); +void thunar_application_set_daemon (ThunarApplication *application, + gboolean daemon); + +GList *thunar_application_get_windows (ThunarApplication *application); + +gboolean thunar_application_has_windows (ThunarApplication *application); + +void thunar_application_take_window (ThunarApplication *application, + GtkWindow *window); + +void thunar_application_open_window (ThunarApplication *application, + ThunarFile *directory, + GdkScreen *screen); + +gboolean thunar_application_process_filenames (ThunarApplication *application, + const gchar *working_directory, + gchar **filenames, + GdkScreen *screen, + GError **error); + +void thunar_application_copy_to (ThunarApplication *application, + GtkWidget *widget, + GList *source_path_list, + GList *target_path_list, + GClosure *new_files_closure); + +void thunar_application_copy_into (ThunarApplication *application, + GtkWidget *widget, + GList *source_path_list, + ThunarVfsPath *target_path, + GClosure *new_files_closure); + +void thunar_application_link_into (ThunarApplication *application, + GtkWidget *widget, + GList *source_path_list, + ThunarVfsPath *target_path, + GClosure *new_files_closure); + +void thunar_application_move_into (ThunarApplication *application, + GtkWidget *widget, + GList *source_path_list, + ThunarVfsPath *target_path, + GClosure *new_files_closure); + +void thunar_application_unlink (ThunarApplication *application, + GtkWidget *widget, + GList *path_list); + +void thunar_application_creat (ThunarApplication *application, + GtkWidget *widget, + GList *path_list, + GClosure *new_files_closure); + +void thunar_application_mkdir (ThunarApplication *application, + GtkWidget *widget, + GList *path_list, + GClosure *new_files_closure); G_END_DECLS; diff --git a/thunar/thunar-dbus-client.c b/thunar/thunar-dbus-client.c new file mode 100644 index 000000000..0f5586e3f --- /dev/null +++ b/thunar/thunar-dbus-client.c @@ -0,0 +1,123 @@ +/* $Id$ */ +/*- + * Copyright (c) 2006 Benedikt Meurer <benny@xfce.org> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <dbus/dbus.h> +#include <dbus/dbus-glib-lowlevel.h> + +#include <thunar/thunar-dbus-client.h> + + + +/** + * thunar_dbus_client_launch_files: + * @working_directory : the directory relative to which @filenames may be looked up. + * @filenames : the list of @filenames to launch. + * @screen : the #GdkScreen on which to launch the @filenames or %NULL + * to use the default #GdkScreen. + * @error : return location for errors or %NULL. + * + * Tries to invoke the LaunchFiles() method on a running Thunar instance, that is + * registered with the current D-BUS session bus. Returns %TRUE if the method was + * successfully invoked, else %FALSE. + * + * If %TRUE is returned, the current process may afterwards just terminate, as + * all @filenames will be handled by the remote instance. Else, if %FALSE is + * returned the current process should try to launch the @filenames itself. + * + * Return value: %TRUE on success, else %FALSE. + **/ +gboolean +thunar_dbus_client_launch_files (const gchar *working_directory, + gchar **filenames, + GdkScreen *screen, + GError **error) +{ + DBusConnection *connection; + DBusMessage *message; + DBusMessage *result; + DBusError derror; + gchar *display_name; + + g_return_val_if_fail (g_path_is_absolute (working_directory), FALSE); + g_return_val_if_fail (filenames != NULL && *filenames != NULL, FALSE); + g_return_val_if_fail (screen == NULL || GDK_IS_SCREEN (screen), FALSE); + g_return_val_if_fail (error == NULL || *error == NULL, FALSE); + + /* initialize the DBusError struct */ + dbus_error_init (&derror); + + /* fallback to default screen if no other is specified */ + if (G_LIKELY (screen == NULL)) + screen = gdk_screen_get_default (); + + /* try to connect to the session bus */ + connection = dbus_bus_get (DBUS_BUS_SESSION, &derror); + if (G_UNLIKELY (connection == NULL)) + { + dbus_set_g_error (error, &derror); + dbus_error_free (&derror); + return FALSE; + } + + /* determine the display name for the screen */ + display_name = gdk_screen_make_display_name (screen); + + /* generate the LaunchFiles() method (disable activation!) */ + message = dbus_message_new_method_call ("org.xfce.Thunar", "/org/xfce/FileManager", "org.xfce.Thunar", "LaunchFiles"); + dbus_message_set_auto_start (message, FALSE); + dbus_message_append_args (message, + DBUS_TYPE_STRING, &working_directory, + DBUS_TYPE_ARRAY, DBUS_TYPE_STRING, &filenames, g_strv_length (filenames), + DBUS_TYPE_STRING, &display_name, + DBUS_TYPE_INVALID); + + /* release the display name */ + g_free (display_name); + + /* send the message and release our references on connection and message */ + result = dbus_connection_send_with_reply_and_block (connection, message, 2000, &derror); + dbus_message_unref (message); + + /* check if no reply was received */ + if (G_UNLIKELY (result == NULL)) + { + dbus_set_g_error (error, &derror); + dbus_error_free (&derror); + return FALSE; + } + + /* but maybe we received an error */ + if (dbus_message_get_type (result) == DBUS_MESSAGE_TYPE_ERROR) + { + dbus_set_error_from_message (&derror, result); + dbus_set_g_error (error, &derror); + dbus_message_unref (result); + dbus_error_free (&derror); + return FALSE; + } + + /* let's asume that it worked */ + dbus_message_unref (result); + return TRUE; +} + diff --git a/thunar/thunar-dbus-client.h b/thunar/thunar-dbus-client.h new file mode 100644 index 000000000..e053ab3c9 --- /dev/null +++ b/thunar/thunar-dbus-client.h @@ -0,0 +1,34 @@ +/* $Id$ */ +/*- + * Copyright (c) 2006 Benedikt Meurer <benny@xfce.org> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __THUNAR_DBUS_CLIENT_H__ +#define __THUNAR_DBUS_CLIENT_H__ + +#include <gdk/gdk.h> + +G_BEGIN_DECLS; + +gboolean thunar_dbus_client_launch_files (const gchar *working_directory, + gchar **filenames, + GdkScreen *screen, + GError **error); + +G_END_DECLS; + +#endif /* !__THUNAR_DBUS_CLIENT_H__ */ diff --git a/thunar/thunar-dbus-service-infos.xml b/thunar/thunar-dbus-service-infos.xml index 50a452d2b..64cd668c8 100644 --- a/thunar/thunar-dbus-service-infos.xml +++ b/thunar/thunar-dbus-service-infos.xml @@ -21,6 +21,12 @@ --> <node name="/org/xfce/FileManager"> + <!-- + org.xfce.FileManager + + The generic Xfce File Manager interface, implemented by all Xfce + File Managers. + --> <interface name="org.xfce.FileManager"> <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="thunar_dbus_service" /> @@ -73,4 +79,36 @@ <arg direction="in" name="display" type="s" /> </method> </interface> + + <!-- + org.xfce.Thunar + + The Thunar specific interface, which provides Thunar specific + methods, and which should not be implemented by any other + file manager. + + This interface is also subject to change. So, unless you know + what you are doing, and you want to limit yourself to Thunar, + do not use this interface, but use org.xfce.FileManager instead. + --> + <interface name="org.xfce.Thunar"> + <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="thunar_dbus_service" /> + + <!-- + LaunchFiles (working-directory : STRING, filenames : ARRAY OF STRING, display : STRING) : VOID + + working-directory : the directory, relative to which filenames should + be interpreted. + filenames : an array of file names to launch. The file names may + be either file:-URIs, absolute paths or paths relative + to the working-directory. + display : the screen on which to launch the filenames or "" + to use the default screen of the file manager. + --> + <method name="LaunchFiles"> + <arg direction="in" name="working-directory" type="s" /> + <arg direction="in" name="filenames" type="as" /> + <arg direction="in" name="display" type="s" /> + </method> + </interface> </node> diff --git a/thunar/thunar-dbus-service.c b/thunar/thunar-dbus-service.c index 119ab2a4a..da4bef656 100644 --- a/thunar/thunar-dbus-service.c +++ b/thunar/thunar-dbus-service.c @@ -58,6 +58,11 @@ static gboolean thunar_dbus_service_launch (ThunarDBusServi static gboolean thunar_dbus_service_display_preferences_dialog (ThunarDBusService *dbus_service, const gchar *display, GError **error); +static gboolean thunar_dbus_service_launch_files (ThunarDBusService *dbus_service, + const gchar *working_directory, + gchar **filenames, + const gchar *display, + GError **error); @@ -138,6 +143,9 @@ thunar_dbus_service_init (ThunarDBusService *dbus_service) /* register the /org/xfce/FileManager object for Thunar */ dbus_g_connection_register_g_object (dbus_service->connection, "/org/xfce/FileManager", G_OBJECT (dbus_service)); + /* request the org.xfce.Thunar name for Thunar */ + dbus_bus_request_name (dbus_g_connection_get_connection (dbus_service->connection), "org.xfce.Thunar", DBUS_NAME_FLAG_REPLACE_EXISTING, NULL); + /* request the org.xfce.FileManager name for Thunar */ dbus_bus_request_name (dbus_g_connection_get_connection (dbus_service->connection), "org.xfce.FileManager", DBUS_NAME_FLAG_REPLACE_EXISTING, NULL); } @@ -325,4 +333,49 @@ thunar_dbus_service_display_preferences_dialog (ThunarDBusService *dbus_service, +static gboolean +thunar_dbus_service_launch_files (ThunarDBusService *dbus_service, + const gchar *working_directory, + gchar **filenames, + const gchar *display, + GError **error) +{ + ThunarApplication *application; + GdkScreen *screen; + gboolean result = FALSE; + + /* verify that a valid working directory is given */ + if (G_UNLIKELY (!g_path_is_absolute (working_directory))) + { + /* LaunchFiles() invoked without a valid working directory */ + g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_INVAL, _("The working directory must be an absolute path")); + return FALSE; + } + + /* verify that atleast one filename is given */ + if (G_UNLIKELY (filenames == NULL || *filenames == NULL)) + { + /* LaunchFiles() invoked with an empty filename list */ + g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_INVAL, _("Atleast one filename must be specified")); + return FALSE; + } + + /* try to open the screen for the display name */ + screen = thunar_gdk_screen_open (display, error); + if (G_LIKELY (screen != NULL)) + { + /* let the application process the filenames */ + application = thunar_application_get (); + result = thunar_application_process_filenames (application, working_directory, filenames, screen, error); + g_object_unref (G_OBJECT (application)); + + /* release the screen */ + g_object_unref (G_OBJECT (screen)); + } + + return result; +} + + + #include <thunar/thunar-dbus-service-infos.h> diff --git a/thunar/thunar-dialogs.c b/thunar/thunar-dialogs.c index 6b2314e04..b1e9039dd 100644 --- a/thunar/thunar-dialogs.c +++ b/thunar/thunar-dialogs.c @@ -1,6 +1,6 @@ /* $Id$ */ /*- - * Copyright (c) 2005 Benedikt Meurer <benny@xfce.org> + * Copyright (c) 2005-2006 Benedikt Meurer <benny@xfce.org> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free @@ -33,7 +33,9 @@ /** * thunar_dialogs_show_error: - * @widget : a #GtkWidget on which the error dialog should be shown or %NULL. + * @parent : a #GtkWidget on which the error dialog should be shown, or a #GdkScreen + * if no #GtkWidget is known. May also be %NULL, in which case the default + * #GdkScreen will be used. * @error : a #GError, which gives a more precise description of the problem or %NULL. * @format : the printf()-style format for the primary problem description. * @... : argument list for the @format. @@ -45,20 +47,48 @@ * that the toplevel window is visible prior to displaying the error dialog. **/ void -thunar_dialogs_show_error (GtkWidget *widget, +thunar_dialogs_show_error (gpointer parent, const GError *error, const gchar *format, ...) { GtkWidget *dialog; - GtkWidget *window; + GtkWidget *window = NULL; + GdkScreen *screen; va_list args; gchar *primary_text; - /* determine the toplevel window and make sure it's shown */ - window = (widget != NULL) ? gtk_widget_get_toplevel (widget) : NULL; - if (G_LIKELY (window != NULL)) - gtk_widget_show_now (window); + g_return_if_fail (parent == NULL || GDK_IS_SCREEN (parent) || GTK_IS_WIDGET (parent)); + + /* determine the proper parent */ + if (parent == NULL) + { + /* just use the default screen then */ + screen = gdk_screen_get_default (); + } + else if (GDK_IS_SCREEN (parent)) + { + /* yep, that's a screen */ + screen = GDK_SCREEN (parent); + } + else + { + /* parent is a widget, so let's determine the toplevel window */ + window = gtk_widget_get_toplevel (GTK_WIDGET (parent)); + if (GTK_WIDGET_TOPLEVEL (window)) + { + /* make sure the toplevel window is shown */ + gtk_widget_show_now (window); + } + else + { + /* no toplevel, not usable then */ + window = NULL; + } + + /* determine the screen for the widget */ + screen = gtk_widget_get_screen (GTK_WIDGET (parent)); + } /* determine the primary error text */ va_start (args, format); @@ -73,6 +103,10 @@ thunar_dialogs_show_error (GtkWidget *widget, GTK_BUTTONS_CLOSE, _("%s."), primary_text); + /* move the dialog to the appropriate screen */ + if (window == NULL && screen != NULL) + gtk_window_set_screen (GTK_WINDOW (dialog), screen); + /* set secondary text if an error is provided */ if (G_LIKELY (error != NULL)) gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), _("%s."), error->message); diff --git a/thunar/thunar-dialogs.h b/thunar/thunar-dialogs.h index 5bc655a4c..2f988d82f 100644 --- a/thunar/thunar-dialogs.h +++ b/thunar/thunar-dialogs.h @@ -1,6 +1,6 @@ /* $Id$ */ /*- - * Copyright (c) 2005 Benedikt Meurer <benny@xfce.org> + * Copyright (c) 2005-2006 Benedikt Meurer <benny@xfce.org> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free @@ -24,7 +24,7 @@ G_BEGIN_DECLS; -void thunar_dialogs_show_error (GtkWidget *widget, +void thunar_dialogs_show_error (gpointer parent, const GError *error, const gchar *format, ...) G_GNUC_INTERNAL G_GNUC_PRINTF (3, 4); -- GitLab