diff options
author | Benedikt Meurer <benny@xfce.org> | 2006-02-08 22:58:40 +0000 |
---|---|---|
committer | Benedikt Meurer <benny@xfce.org> | 2006-02-08 22:58:40 +0000 |
commit | 736ae7a33778f623e3f1d465435a8973aa298ef5 (patch) | |
tree | ee6628adf452511ed1b08e28c133e37f687c5bda /examples | |
parent | cbeec7da85e51bd3f10257d2c6415330af507342 (diff) | |
download | thunar-736ae7a33778f623e3f1d465435a8973aa298ef5.tar.gz |
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)
Diffstat (limited to 'examples')
-rw-r--r-- | examples/Makefile.am | 3 | ||||
-rwxr-xr-x | examples/xfce-file-manager.py | 66 |
2 files changed, 69 insertions, 0 deletions
diff --git a/examples/Makefile.am b/examples/Makefile.am index 38697d19..abebb194 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 00000000..87a1c32d --- /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('/', '') |