summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorBenedikt Meurer <benny@xfce.org>2006-03-24 01:50:07 +0000
committerBenedikt Meurer <benny@xfce.org>2006-03-24 01:50:07 +0000
commita5c28c6c095fe5c1d551ec6a1abf414fddc810a6 (patch)
tree9e21d1e1fc14e00ac22f703b5a5a7603b2cc719e /examples
parent447b6a56793533d6c74c7938e32f3ff8f80ea948 (diff)
downloadthunar-a5c28c6c095fe5c1d551ec6a1abf414fddc810a6.tar.gz
2006-03-24 Benedikt Meurer <benny@xfce.org>
* thunar/thunar-file.{c,h}: Add wrapper method thunar_file_get_for_uri() which is a rather common operation. * thunar/thunar-dbus-service.c (thunar_dbus_service_parse_uri_and_display): Use the newly added method thunar_file_get_for_uri(). * thunar/thunar-launcher.c: If no current directory is set, directories will always be opened in new windows. * thunar/thunar-renamer-progress.{c,h}: Add support for explicit cancellation of the rename operation. * thunar/thunar-renamer-dialog-ui.xml,thunar/thunar-renamer-model.{c,h}, thunar/thunar-renamer-dialog.{c,h}, thunar/Makefile.am: Some polish on the dialog and the model. Allow users to add/remove files using the context menu. Add a standalone mode in which the bulk rename dialog appears as standalone application and which can be invoked through the D-BUS service. Bug #1597. * thunar/thunar-standard-view.c(thunar_standard_view_action_rename): Keep up with the ThunarRenamerDialog changes. * thunar/main.c, thunar/thunar-application.{c,h}, thunar/thunar-dbus-client.{c,h}, thunar/thunar-dbus-service-infos.xml, thunar/thunar-dbus-service.c: Add BulkRename() method to the D-BUS interface org.xfce.Thunar and add command line option -B to Thunar, which allows to open the bulk rename dialog directly. Bug #1597. * Thunar-folder-handler.desktop.in.in, Thunar.desktop.in.in, Makefile.am: Rearrange the .desktop file handling. * Makefile.am, Thunar-bulk-rename.desktop.in.in, ThunarBulkRename.in: Add launcher for the bulk rename utility. Bug #1597. * examples/thunar-file-manager.py, examples/Makefile.am: Add example for the usage of the org.xfce.Thunar interface. * thunarx/thunarx-renamer.{c,h}, thunarx/thunarx.symbols: Add new method get_actions() to ThunarxRenamer, as discussed with Jannis, to allow plugin writers to add custom actions to the renamers tree view context menu (i.e. "Edit Tags" for the thunar-media-tag-plugin). First part of bug #1602. * docs/reference/thunarx/: Update the API docs. * thunar/thunar-renamer-dialog.c(thunar_renamer_dialog_context_menu), thunar/thunar-renamer-dialog-ui.xml: Add custom actions provided by the active ThunarxRenamer to the file context menu in the renamer dialog. Second part of bug #1602. * po/POTFILES.in: Add new files. * po/Thunar.pot, po/*.po: Merge new strings. * po/de.po: Update german translations. (Old svn revision: 20526)
Diffstat (limited to 'examples')
-rw-r--r--examples/Makefile.am1
-rwxr-xr-xexamples/thunar-file-manager.py58
2 files changed, 59 insertions, 0 deletions
diff --git a/examples/Makefile.am b/examples/Makefile.am
index abebb194..8ced9db8 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -4,6 +4,7 @@ SUBDIRS = \
tex-open-terminal
EXTRA_DIST = \
+ thunar-file-manager.py \
xfce-file-manager.py
# vi:set ts=8 sw=8 noet ai nocindent syntax=automake:
diff --git a/examples/thunar-file-manager.py b/examples/thunar-file-manager.py
new file mode 100755
index 00000000..23991c29
--- /dev/null
+++ b/examples/thunar-file-manager.py
@@ -0,0 +1,58 @@
+#!/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 using the #
+# org.xfce.Thunar 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 Thunar object
+bus = dbus.SessionBus()
+thunar_object = bus.get_object('org.xfce.Thunar', '/org/xfce/FileManager')
+thunar = dbus.Interface(thunar_object, 'org.xfce.Thunar')
+
+# You can now invoke methods on the thunar object, for
+# example, to terminate a running Thunar instance (just
+# like Thunar -q), you can use:
+#
+# thunar.Terminate()
+#
+# or, if you want to open the bulk rename dialog in the
+# standalone version with an empty file list and /tmp
+# as default folder for the "Add Files" dialog, use:
+#
+# thunar.BulkRename('/tmp', [], True, '')
+#
+# See the thunar-dbus-service-infos.xml file for the exact
+# interface definition.
+#
+
+# We just popup the bulk rename dialog to
+# demonstrate that it works. ;-)
+thunar.BulkRename('/tmp', [], True, '')