[Xfce4-commits] <xfdesktop:master> Refactor FileManager/Trash D-Bus client code a bit.

Jannis Pohlmann noreply at xfce.org
Tue Nov 2 01:14:03 CET 2010


Updating branch refs/heads/master
         to 7e55973654974af3d5b6ac3dfd7bdaa90a6dc51e (commit)
       from ab94a214ff2fc29d79fbe6c747202f3174f2cdcc (commit)

commit 7e55973654974af3d5b6ac3dfd7bdaa90a6dc51e
Author: Jannis Pohlmann <jannis at xfce.org>
Date:   Sun Oct 17 16:33:15 2010 +0200

    Refactor FileManager/Trash D-Bus client code a bit.

 src/Makefile.am                                    |   37 ++-
 src/xfdesktop-clipboard-manager.c                  |    6 +-
 src/xfdesktop-clipboard-manager.h                  |    4 +
 src/xfdesktop-dbus-bindings-filemanager.xml        |  100 -------
 src/xfdesktop-file-icon-manager.c                  |   46 ++--
 src/xfdesktop-file-manager-dbus.xml                |  277 ++++++++++++++++++++
 src/xfdesktop-file-utils.c                         |   14 +-
 src/xfdesktop-special-file-icon.c                  |   29 ++-
 src/xfdesktop-thunar-dbus.xml                      |   81 ++++++
 ...bindings-trash.xml => xfdesktop-trash-dbus.xml} |   35 ++-
 10 files changed, 468 insertions(+), 161 deletions(-)

diff --git a/src/Makefile.am b/src/Makefile.am
index 9f8fc3d..7e391ab 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -41,8 +41,6 @@ desktop_menu_sources = \
 desktop_file_icon_sources = \
 	xfdesktop-clipboard-manager.c \
 	xfdesktop-clipboard-manager.h \
-	xfdesktop-dbus-bindings-filemanager.h \
-	xfdesktop-dbus-bindings-trash.h \
 	xfdesktop-file-icon.c \
 	xfdesktop-file-icon.h \
 	xfdesktop-file-icon-manager.c \
@@ -187,14 +185,33 @@ xfce-desktop-enum-types.c: $(enum_headers) Makefile
 if ENABLE_FILE_ICONS
 
 xfdesktop_built_sources += \
-	xfdesktop-dbus-bindings-filemanager.h \
-	xfdesktop-dbus-bindings-trash.h
-
-xfdesktop-dbus-bindings-filemanager.h: $(srcdir)/xfdesktop-dbus-bindings-filemanager.xml Makefile
-	$(AM_V_GEN) dbus-binding-tool --mode=glib-client --prefix=org_xfce_FileManager $(srcdir)/xfdesktop-dbus-bindings-filemanager.xml > xfdesktop-dbus-bindings-filemanager.h
-
-xfdesktop-dbus-bindings-trash.h: $(srcdir)/xfdesktop-dbus-bindings-trash.xml Makefile
-	$(AM_V_GEN) dbus-binding-tool --mode=glib-client --prefix=org_xfce_Trash $(srcdir)/xfdesktop-dbus-bindings-trash.xml > xfdesktop-dbus-bindings-trash.h
+	xfdesktop-file-manager-proxy.h \
+	xfdesktop-thunar-proxy.h \
+	xfdesktop-trash-proxy.h
+
+xfdesktop-file-manager-proxy.h: $(srcdir)/xfdesktop-file-manager-dbus.xml Makefile
+	$(AM_V_GEN) ( \
+		dbus-binding-tool --mode=glib-client \
+			$(srcdir)/xfdesktop-file-manager-dbus.xml > xfdesktop-file-manager-proxy.h \
+		&& sed -i -e 's/org_xfce_FileManager/xfdesktop_file_manager_proxy/g' \
+			xfdesktop-file-manager-proxy.h \
+	)
+			
+xfdesktop-thunar-proxy.h: $(srcdir)/xfdesktop-thunar-dbus.xml Makefile
+	$(AM_V_GEN) ( \
+		dbus-binding-tool --mode=glib-client \
+			$(srcdir)/xfdesktop-thunar-dbus.xml > xfdesktop-thunar-proxy.h \
+		&& sed -i -e 's/org_xfce_Thunar/xfdesktop_thunar_proxy/g' \
+			xfdesktop-thunar-proxy.h \
+	)
+
+xfdesktop-trash-proxy.h: $(srcdir)/xfdesktop-trash-dbus.xml Makefile
+	$(AM_V_GEN) ( \
+		dbus-binding-tool --mode=glib-client \
+			$(srcdir)/xfdesktop-trash-dbus.xml > xfdesktop-trash-proxy.h \
+		&& sed -i -e 's/org_xfce_Trash/xfdesktop_trash_proxy/g' \
+			xfdesktop-trash-proxy.h \
+	)
 
 endif
 
diff --git a/src/xfdesktop-clipboard-manager.c b/src/xfdesktop-clipboard-manager.c
index 8635d3b..eb08ca7 100644
--- a/src/xfdesktop-clipboard-manager.c
+++ b/src/xfdesktop-clipboard-manager.c
@@ -32,10 +32,14 @@
 
 #include <gtk/gtk.h>
 
+#ifdef HAVE_THUNAR_VFS
+#include <thunar-vfs/thunar-vfs.h>
+#endif
+
+#include "xfdesktop-clipboard-manager.h"
 #include "xfdesktop-file-icon.h"
 #include "xfdesktop-file-icon-manager.h"
 #include "xfdesktop-file-utils.h"
-#include "xfdesktop-clipboard-manager.h"
 
 #ifndef I_
 #define I_(str)  g_intern_static_string(str)
diff --git a/src/xfdesktop-clipboard-manager.h b/src/xfdesktop-clipboard-manager.h
index 4c2d2bc..f29659b 100644
--- a/src/xfdesktop-clipboard-manager.h
+++ b/src/xfdesktop-clipboard-manager.h
@@ -22,6 +22,10 @@
 #ifndef __XFDESKTOP_CLIPBOARD_MANAGER_H__
 #define __XFDESKTOP_CLIPBOARD_MANAGER_H__
 
+#ifdef HAVE_THUNAR_VFS
+#include <thunar-vfs/thunar-vfs.h>
+#endif
+
 G_BEGIN_DECLS;
 
 /* fwd decl */
diff --git a/src/xfdesktop-dbus-bindings-filemanager.xml b/src/xfdesktop-dbus-bindings-filemanager.xml
deleted file mode 100644
index b76fa74..0000000
--- a/src/xfdesktop-dbus-bindings-filemanager.xml
+++ /dev/null
@@ -1,100 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-   $Id: thunar-dbus-service-infos.xml 22583 2006-07-30 22:49:35Z benny $
-   
-   Copyright (c) 2006 Benedikt Meurer <benny at 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
--->
-
-<!--
-   NB: modified by Brian Tarricone <bjt23 at cornell.edu> to remove methods
-   that xfdesktop does not use.  This means that this file does not
-   necessarily define the full org.xfce.FileManager interface and should
-   not be used as a reference for implementation.
--->
-
-<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" />
-
-    <!--
-      DisplayChooserDialog (uri : STRING, open : BOOLEAN, display : STRING) : VOID
-
-      uri     : either a file:-URI or an absolute path.
-      open    : TRUE to let the user open the file identified by the
-                uri after choosing an application, FALSE to only update
-                the mime database.
-      display : the screen on which to display the chooser dialog or
-                "" to use the default screen of the file manager.
-
-      Displays the chooser dialog, which lets the user select an application
-      to handle the file identified by the uri (and all other files of the
-      same mime type). If open is TRUE the user will also be able to open
-      the file after choosing an application.
-    -->
-    <method name="DisplayChooserDialog">
-      <arg direction="in" name="uri" type="s" />
-      <arg direction="in" name="open" type="b" />
-      <arg direction="in" name="display" type="s" />
-    </method>
-
-
-    <!--
-      DisplayFolder (uri : STRING, display : STRING) : VOID
-
-      uri     : either a file:-URI or an absolute path.
-      display : the screen on which to display the folder or ""
-                to use the default screen of the file manager.
-    -->
-    <method name="DisplayFolder">
-      <arg direction="in" name="uri" type="s" />
-      <arg direction="in" name="display" type="s" />
-    </method>
-
-
-    <!--
-      DisplayFileProperties (uri : STRING, display : STRING) : VOID
-
-      uri     : either a file:-URI or an absolute path.
-      display : the screen on which to display the file properties
-                or "" to use the default screen of the file manager.
-    -->
-    <method name="DisplayFileProperties">
-      <arg direction="in" name="uri" type="s" />
-      <arg direction="in" name="display" type="s" />
-    </method>
-
-
-    <!--
-      Launch (uri : STRING, display : STRING) : VOID
-
-      uri     : either a file:-URI or an absolute path.
-      display : the screen on which to launch the file or ""
-                to use the default screen of the file manager.
-    -->
-    <method name="Launch">
-      <arg direction="in" name="uri" type="s" />
-      <arg direction="in" name="display" type="s" />
-    </method>
-  </interface>
-</node>
diff --git a/src/xfdesktop-file-icon-manager.c b/src/xfdesktop-file-icon-manager.c
index be4a810..472367e 100644
--- a/src/xfdesktop-file-icon-manager.c
+++ b/src/xfdesktop-file-icon-manager.c
@@ -58,19 +58,19 @@
 #include <thunarx/thunarx.h>
 #endif
 
-#include "xfdesktop-icon-view.h"
-#include "xfdesktop-file-utils.h"
+#include "xfce-desktop.h"
+#include "xfdesktop-clipboard-manager.h"
+#include "xfdesktop-common.h"
 #include "xfdesktop-file-icon.h"
+#include "xfdesktop-file-icon-manager.h"
+#include "xfdesktop-file-utils.h"
+#include "xfdesktop-file-manager-proxy.h"
+#include "xfdesktop-file-properties-dialog.h"
+#include "xfdesktop-icon-view.h"
 #include "xfdesktop-regular-file-icon.h"
 #include "xfdesktop-special-file-icon.h"
+#include "xfdesktop-trash-proxy.h"
 #include "xfdesktop-volume-icon.h"
-#include "xfdesktop-clipboard-manager.h"
-#include "xfdesktop-file-properties-dialog.h"
-#include "xfdesktop-dbus-bindings-trash.h"
-#include "xfdesktop-dbus-bindings-filemanager.h"
-#include "xfdesktop-file-icon-manager.h"
-#include "xfdesktop-common.h"
-#include "xfce-desktop.h"
 
 #include <libxfce4util/libxfce4util.h>
 #include <libxfce4ui/libxfce4ui.h>
@@ -795,7 +795,7 @@ xfdesktop_file_icon_manager_trash_files(XfdesktopFileIconManager *fmanager,
 {
     DBusGProxy *trash_proxy = xfdesktop_file_utils_peek_trash_proxy();
     DBusGProxyCall *call;
-    gchar **uris, *display_name;
+    gchar **uris, *display_name, *startup_id;
     GList *l;
     gint i, nfiles;
     const ThunarVfsInfo *info;
@@ -816,13 +816,15 @@ xfdesktop_file_icon_manager_trash_files(XfdesktopFileIconManager *fmanager,
     uris[nfiles] = NULL;
     
     display_name = gdk_screen_make_display_name(fmanager->priv->gscreen);
+
+    startup_id = g_strdup_printf("_TIME%d", gtk_get_current_event_time());
     
     tdata = g_new(XfdesktopTrashFilesData, 1);
-    call = org_xfce_Trash_move_to_trash_async(trash_proxy, (const char **)uris,
-                                              display_name,
-                                              xfdesktop_file_icon_manager_trash_files_cb,
-                                              tdata);
-    
+    call = xfdesktop_trash_proxy_move_to_trash_async(trash_proxy, (const char **)uris,
+                                                     display_name, startup_id,
+                                                     xfdesktop_file_icon_manager_trash_files_cb, 
+                                                     tdata);
+
     if(call) {
         tdata->fmanager = fmanager;
         tdata->proxy = g_object_ref(G_OBJECT(trash_proxy));
@@ -833,6 +835,7 @@ xfdesktop_file_icon_manager_trash_files(XfdesktopFileIconManager *fmanager,
     } else
         g_free(tdata);
     
+    g_free(startup_id);
     g_strfreev(uris);
     g_free(display_name);
     
@@ -1023,12 +1026,13 @@ xfdesktop_file_icon_menu_other_app(GtkWidget *widget,
     if(fileman_proxy) {
         gchar *uri = thunar_vfs_path_dup_uri(info->path);
         gchar *display_name = gdk_screen_make_display_name(fmanager->priv->gscreen);
+        gchar *startup_id = g_strdup_printf("_TIME%d", gtk_get_current_event_time());
         
-        if(!org_xfce_FileManager_display_chooser_dialog_async(fileman_proxy,
-                                                              uri, TRUE,
-                                                              display_name,
-                                                              xfdesktop_file_icon_manager_display_chooser_cb,
-                                                              fmanager))
+        if(!xfdesktop_file_manager_proxy_display_chooser_dialog_async(fileman_proxy,
+                                                                      uri, TRUE,
+                                                                      display_name, startup_id,
+                                                                      xfdesktop_file_icon_manager_display_chooser_cb,
+                                                                      fmanager))
         {
             xfdesktop_file_icon_manager_display_chooser_error(fmanager);
         } else {
@@ -1036,6 +1040,8 @@ xfdesktop_file_icon_menu_other_app(GtkWidget *widget,
             xfdesktop_file_utils_set_window_cursor(GTK_WINDOW(toplevel),
                                                    GDK_WATCH);
         }
+
+        g_free(startup_id);
         g_free(uri);
         g_free(display_name);
     }
diff --git a/src/xfdesktop-file-manager-dbus.xml b/src/xfdesktop-file-manager-dbus.xml
new file mode 100644
index 0000000..76b00b4
--- /dev/null
+++ b/src/xfdesktop-file-manager-dbus.xml
@@ -0,0 +1,277 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+   $Id$
+   
+   Copyright (c) 2006 Benedikt Meurer <benny at 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
+-->
+
+<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" />
+
+    <!--
+      DisplayChooserDialog (uri : STRING, open : BOOLEAN, display : STRING) : VOID
+
+      uri        : either a file:-URI or an absolute path.
+      open       : TRUE to let the user open the file identified by the
+                   uri after choosing an application, FALSE to only update
+                   the mime database.
+      display    : the screen on which to display the chooser dialog or
+                   "" to use the default screen of the file manager.
+      startup_id : the DESKTOP_STARTUP_ID environment variable for properly
+                   handling startup notification and focus stealing.
+
+      Displays the chooser dialog, which lets the user select an application
+      to handle the file identified by the uri (and all other files of the
+      same mime type). If open is TRUE the user will also be able to open
+      the file after choosing an application.
+    -->
+    <method name="DisplayChooserDialog">
+      <arg direction="in" name="uri" type="s" />
+      <arg direction="in" name="open" type="b" />
+      <arg direction="in" name="display" type="s" />
+      <arg direction="in" name="startup_id" type="s" />
+    </method>
+
+
+    <!--
+      DisplayFolder (uri : STRING, display : STRING) : VOID
+
+      uri        : either a file:-URI or an absolute path.
+      display    : the screen on which to display the folder or ""
+                   to use the default screen of the file manager.
+      startup_id : the DESKTOP_STARTUP_ID environment variable for properly
+                   handling startup notification and focus stealing.
+    -->
+    <method name="DisplayFolder">
+      <arg direction="in" name="uri" type="s" />
+      <arg direction="in" name="display" type="s" />
+      <arg direction="in" name="startup_id" type="s" />
+    </method>
+
+
+    <!--
+      DisplayFolderAndSelect (uri : STRING, filename : STRING, display : STRING) : VOID
+
+      uri        : either a file:-URI or an absolute path.
+      filename   : the name of the file in the folder which should
+                   be selected by the file manager after loading the
+                   folder. The file manager will also scroll the view
+                   to ensure that the file is visible. The filename
+                   must be a name relative to the folder URI.
+      display    : the screen on which to display the folder or ""
+                   to use the default screen of the file manager.
+      startup_id : the DESKTOP_STARTUP_ID environment variable for properly
+                   handling startup notification and focus stealing.
+
+      Note to implementors: Not all file managers may be able to
+      implement this method properly for whatever reasons. If you
+      cannot implement it properly, handle this method like an
+      invocation of DisplayFolder() and ignore the filename.
+    -->
+    <method name="DisplayFolderAndSelect">
+      <arg direction="in" name="uri" type="s" />
+      <arg direction="in" name="filename" type="s" />
+      <arg direction="in" name="display" type="s" />
+      <arg direction="in" name="startup_id" type="s" />
+    </method>
+
+
+    <!--
+      DisplayFileProperties (uri : STRING, display : STRING) : VOID
+
+      uri        : either a file:-URI or an absolute path.
+      display    : the screen on which to display the file properties
+                   or "" to use the default screen of the file manager.
+      startup_id : the DESKTOP_STARTUP_ID environment variable for properly
+                   handling startup notification and focus stealing.
+    -->
+    <method name="DisplayFileProperties">
+      <arg direction="in" name="uri" type="s" />
+      <arg direction="in" name="display" type="s" />
+      <arg direction="in" name="startup_id" type="s" />
+    </method>
+
+
+    <!--
+      Launch (uri : STRING, display : STRING) : VOID
+
+      uri        : either a file:-URI or an absolute path.
+      display    : the screen on which to launch the file or ""
+                   to use the default screen of the file manager.
+      startup_id : the DESKTOP_STARTUP_ID environment variable for properly
+                   handling startup notification and focus stealing.
+    -->
+    <method name="Launch">
+      <arg direction="in" name="uri" type="s" />
+      <arg direction="in" name="display" type="s" />
+      <arg direction="in" name="startup_id" type="s" />
+    </method>
+
+
+    <!--
+      DisplayPreferencesDialog (display : STRING) : VOID
+
+      display    : the screen on which to display the preferences dialog
+                   or "" to use the default screen of the file manager.
+      startup_id : the DESKTOP_STARTUP_ID environment variable for properly
+                   handling startup notification and focus stealing.
+    -->
+    <method name="DisplayPreferencesDialog">
+      <arg direction="in" name="display" type="s" />
+      <arg direction="in" name="startup_id" type="s" />
+    </method>
+
+
+    <!--
+      CopyTo (working_directory : STRING, source_filenames : ARRAY OF STRING, target_filenames : ARRAY OF STRING, display : STRING, startup_id : STRING) : VOID
+
+      working_directory : working directory used to resolve relative filenames.
+      source_filenames  : an array of file names to copy. The file names may
+                          be either file:-URIs, absolute paths or paths relative
+                          to the working_directory.
+      target_filenames  : the target filenames.
+      display           : the screen on which to launch the filenames or ""
+                          to use the default screen of the file manager.
+      startup_id        : the DESKTOP_STARTUP_ID environment variable for properly
+                          handling startup notification and focus stealing.
+    -->
+    <method name="CopyTo">
+      <arg direction="in" name="working_directory" type="s" />
+      <arg direction="in" name="source_filenames" type="as" />
+      <arg direction="in" name="target_filenames" type="as" />
+      <arg direction="in" name="display" type="s" />
+      <arg direction="in" name="startup_id" type="s" />
+    </method>
+
+
+    <!--
+      CopyInto (working_directory : STRING, source_filenames : ARRAY OF STRING, target_filename : STRING, display : STRING, startup_id : STRING) : VOID
+
+      working_directory : working directory used to resolve relative filenames.
+      source_filenames  : an array of file names to copy. The file names may
+                          be either file:-URIs, absolute paths or paths relative
+                          to the working_directory.
+      target_filename   : the target directory.
+      display           : the screen on which to launch the filenames or ""
+                          to use the default screen of the file manager.
+      startup_id        : the DESKTOP_STARTUP_ID environment variable for properly
+                          handling startup notification and focus stealing.
+    -->
+    <method name="CopyInto">
+      <arg direction="in" name="working_directory" type="s" />
+      <arg direction="in" name="source_filenames" type="as" />
+      <arg direction="in" name="target_filename" type="s" />
+      <arg direction="in" name="display" type="s" />
+      <arg direction="in" name="startup_id" type="s" />
+    </method>
+
+
+    <!--
+      MoveInto (working_directory : STRING, source_filenames : ARRAY OF STRING, target_filename : STRING, display : STRING, startup_id : STRING) : VOID
+
+      working_directory : working directory used to resolve relative filenames.
+      source_filenames  : an array of file names to move. The file names may
+                          be either file:-URIs, absolute paths or paths relative
+                          to the working_directory.
+      target_filename   : the target directory.
+      display           : the screen on which to launch the filenames or ""
+                          to use the default screen of the file manager.
+      startup_id        : the DESKTOP_STARTUP_ID environment variable for properly
+                           handling startup notification and focus stealing.
+    -->
+    <method name="MoveInto">
+      <arg direction="in" name="working_directory" type="s" />
+      <arg direction="in" name="source_filenames" type="as" />
+      <arg direction="in" name="target_filename" type="s" />
+      <arg direction="in" name="display" type="s" />
+      <arg direction="in" name="startup_id" type="s" />
+    </method>
+
+
+    <!--
+      LinkInto (working_directory : STRING, source_filenames : ARRAY OF STRING, target_filename : STRING, display : STRING, startup_id : STRING) : VOID
+
+      working_directory : working directory used to resolve relative filenames.
+      source_filenames  : an array of file names to link. The file names may
+                          be either file:-URIs, absolute paths or paths relative
+                          to the working_directory.
+      target_filename   : the target directory.
+      display           : the screen on which to launch the filenames or ""
+                          to use the default screen of the file manager.
+      startup_id        : the DESKTOP_STARTUP_ID environment variable for properly
+                           handling startup notification and focus stealing.
+    -->
+    <method name="LinkInto">
+      <arg direction="in" name="working_directory" type="s" />
+      <arg direction="in" name="source_filenames" type="as" />
+      <arg direction="in" name="target_filename" type="s" />
+      <arg direction="in" name="display" type="s" />
+      <arg direction="in" name="startup_id" type="s" />
+    </method>
+
+
+    <!--
+      UnlinkFiles (working_directory : STRING, filenames : ARRAY OF STRING, display : STRING, startup_id : STRING) : VOID
+
+      working_directory : working directory used to resolve relative filenames.
+      filenames         : an array of file names to delete. 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.
+      startup_id        : the DESKTOP_STARTUP_ID environment variable for properly
+                          handling startup notification and focus stealing.
+    -->
+    <method name="UnlinkFiles">
+      <arg direction="in" name="working_directory" type="s" />
+      <arg direction="in" name="filenames" type="as" />
+      <arg direction="in" name="display" type="s" />
+      <arg direction="in" name="startup_id" type="s" />
+    </method>
+
+
+    <!--
+      LaunchFiles (working_directory : STRING, filenames : ARRAY OF STRING, display : STRING, startup_id : 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.
+      startup_id        : the DESKTOP_STARTUP_ID environment variable for properly
+                           handling startup notification and focus stealing.
+    -->
+    <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" />
+      <arg direction="in" name="startup_id" type="s" />
+    </method>
+  </interface>
+</node>
+
+<!-- vi:set ts=2 sw=2 et ai: -->
diff --git a/src/xfdesktop-file-utils.c b/src/xfdesktop-file-utils.c
index 498e547..cdb1c18 100644
--- a/src/xfdesktop-file-utils.c
+++ b/src/xfdesktop-file-utils.c
@@ -40,9 +40,9 @@
 #include <thunarx/thunarx.h>
 #endif
 
-#include "xfdesktop-dbus-bindings-filemanager.h"
-#include "xfdesktop-file-icon.h"
 #include "xfdesktop-common.h"
+#include "xfdesktop-file-icon.h"
+#include "xfdesktop-file-manager-proxy.h"
 #include "xfdesktop-file-utils.h"
 
 ThunarVfsInteractiveJobResponse
@@ -416,20 +416,22 @@ xfdesktop_file_utils_open_folder(const ThunarVfsInfo *info,
         XfdesktopDisplayFolderData *dfdata = g_new(XfdesktopDisplayFolderData, 1);
         gchar *uri = thunar_vfs_path_dup_uri(info->path);
         gchar *display_name = gdk_screen_make_display_name(screen);
+        gchar *startup_id = g_strdup_printf("_TIME%d", gtk_get_current_event_time());
         
         dfdata->info = info;
         dfdata->screen = screen;
         dfdata->parent = parent;
-        if(!org_xfce_FileManager_display_folder_async(fileman_proxy,
-                                                      uri, display_name,
-                                                      xfdesktop_file_utils_display_folder_cb,
-                                                      dfdata))
+        if(!xfdesktop_file_manager_proxy_display_folder_async(fileman_proxy,
+                                                              uri, display_name, startup_id,
+                                                              xfdesktop_file_utils_display_folder_cb,
+                                                              dfdata))
         {
             xfdesktop_file_utils_launch_fallback(info, screen, parent);
             g_free(dfdata);
         } else
             xfdesktop_file_utils_set_window_cursor(parent, GDK_WATCH);
         
+        g_free(startup_id);
         g_free(uri);
         g_free(display_name);
     } else
diff --git a/src/xfdesktop-special-file-icon.c b/src/xfdesktop-special-file-icon.c
index e448a60..413bdbe 100644
--- a/src/xfdesktop-special-file-icon.c
+++ b/src/xfdesktop-special-file-icon.c
@@ -48,8 +48,8 @@
 #endif
 
 #include "xfdesktop-file-utils.h"
-#include "xfdesktop-dbus-bindings-trash.h"
 #include "xfdesktop-special-file-icon.h"
+#include "xfdesktop-trash-proxy.h"
 
 struct _XfdesktopSpecialFileIconPrivate
 {
@@ -572,11 +572,12 @@ xfdesktop_special_file_icon_trash_open(GtkWidget *w,
     
     if(G_LIKELY(file_icon->priv->dbus_proxy)) {
         gchar *display_name = gdk_screen_make_display_name(file_icon->priv->gscreen);
+        gchar *startup_id = g_strdup_printf("_TIME%d", gtk_get_current_event_time());
         
-        if(!org_xfce_Trash_display_trash_async(file_icon->priv->dbus_proxy,
-                                               display_name,
-                                               xfdesktop_special_file_icon_trash_open_cb,
-                                               file_icon))
+        if(!xfdesktop_trash_proxy_display_trash_async(file_icon->priv->dbus_proxy,
+                                                      display_name, startup_id,
+                                                      xfdesktop_special_file_icon_trash_open_cb,
+                                                      file_icon))
         {
             xfdesktop_special_file_icon_trash_handle_error(file_icon,
                                                            "DisplayTrash",
@@ -592,6 +593,7 @@ xfdesktop_special_file_icon_trash_open(GtkWidget *w,
                                                    GDK_WATCH);
         }
             
+        g_free(startup_id);
         g_free(display_name);
     }
 }
@@ -604,17 +606,20 @@ xfdesktop_special_file_icon_trash_empty(GtkWidget *w,
     
     if(G_LIKELY(file_icon->priv->dbus_proxy)) {
         gchar *display_name = gdk_screen_make_display_name(file_icon->priv->gscreen);
+        gchar *startup_id = g_strdup_printf("_TIME%d", gtk_get_current_event_time());
         
-        if(!org_xfce_Trash_empty_trash_async(file_icon->priv->dbus_proxy,
-                                             display_name,
-                                             xfdesktop_special_file_icon_trash_empty_cb,
-                                             file_icon))
+        if(!xfdesktop_trash_proxy_empty_trash_async(file_icon->priv->dbus_proxy,
+                                                    display_name, startup_id,
+                                                    xfdesktop_special_file_icon_trash_empty_cb,
+                                                    file_icon))
         {
             xfdesktop_special_file_icon_trash_handle_error(file_icon,
                                                            "EmptyTrash",
                                                             NULL);
         } else
             g_object_ref(G_OBJECT(file_icon));
+
+        g_free(startup_id);
         g_free(display_name);
     }
 }
@@ -764,9 +769,9 @@ xfdesktop_special_file_icon_new(XfdesktopSpecialFileIconType type,
                                         G_CALLBACK(xfdesktop_special_file_icon_trash_changed_cb),
                                         special_file_icon, NULL);
             
-            call = org_xfce_Trash_query_trash_async(special_file_icon->priv->dbus_proxy,
-                                                    xfdesktop_special_file_icon_query_trash_cb,
-                                                    special_file_icon);
+            call = xfdesktop_trash_proxy_query_trash_async(special_file_icon->priv->dbus_proxy,
+                                                           xfdesktop_special_file_icon_query_trash_cb,
+                                                           special_file_icon);
             if(!call) {
                 xfdesktop_special_file_icon_trash_handle_error(special_file_icon,
                                                                "QueryTrash",
diff --git a/src/xfdesktop-thunar-dbus.xml b/src/xfdesktop-thunar-dbus.xml
new file mode 100644
index 0000000..5dd13c5
--- /dev/null
+++ b/src/xfdesktop-thunar-dbus.xml
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+   $Id$
+   
+   Copyright (c) 2006 Benedikt Meurer <benny at 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
+-->
+
+<node name="/org/xfce/FileManager">
+  <!--
+    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" />
+
+    <!--
+      BulkRename (working_directory : STRING, filenames : ARRAY OF STRING, standalone : BOOLEAN, display : STRING, startup_id : STRING) : VOID
+
+      working_directory : the default directory for the "Add Files" dialog of the
+                          bulk rename window. May also be the empty string, in
+                          which case the current working directory of the file
+                          manager process will be used. This is also used to
+                          translated relative file paths in the filenames below
+                          to absolute paths.
+      filenames         : the list of file:-URIs or absolute paths that should
+                          appear in the bulk renamer list by default. May also
+                          be an empty list. any file that is neither an absolute
+                          path nor a file:-URI will be translated into an
+                          absolute path relative to the working_directory.
+      standalone        : TRUE if the bulk rename dialog should appear like a
+                          standalone application. This is usually what you want.
+                          It should only be FALSE when invoked from another file
+                          management tool and its obvious to the user that a
+                          bunch of selected files will be renamed.
+      display           : the screen on which to launch the filenames or ""
+                          to use the default screen of the file manager.
+      startup_id        : the DESKTOP_STARTUP_ID environment variable for properly
+                           handling startup notification and focus stealing.
+    -->
+    <method name="BulkRename">
+      <arg direction="in" name="working_directory" type="s" />
+      <arg direction="in" name="filenames" type="as" />
+      <arg direction="in" name="standalone" type="b" />
+      <arg direction="in" name="display" type="s" />
+      <arg direction="in" name="startup_id" type="s" />
+    </method>
+
+
+    <!--
+      Terminate () : VOID
+
+      Tells a running Thunar instance to terminate immediately.
+    -->
+    <method name="Terminate">
+    </method>
+  </interface>
+</node>
+
+<!-- vi:set ts=2 sw=2 et ai: -->
diff --git a/src/xfdesktop-dbus-bindings-trash.xml b/src/xfdesktop-trash-dbus.xml
similarity index 64%
rename from src/xfdesktop-dbus-bindings-trash.xml
rename to src/xfdesktop-trash-dbus.xml
index 589cf69..4a2415b 100644
--- a/src/xfdesktop-dbus-bindings-trash.xml
+++ b/src/xfdesktop-trash-dbus.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 
 <!--
-   $Id: thunar-dbus-service-infos.xml 22583 2006-07-30 22:49:35Z benny $
+   $Id$
    
    Copyright (c) 2006 Benedikt Meurer <benny at xfce.org>
   
@@ -33,38 +33,46 @@
     <!--
       DisplayTrash (display : STRING) : VOID
 
-      display : the screen on which to display the trash folder
-                contents or "" to use the default screen of the
-                file manager.
+      display    : the screen on which to display the trash folder
+                   contents or "" to use the default screen of the
+                   file manager.
+      startup_id : the DESKTOP_STARTUP_ID environment variable for properly
+                   handling startup notification and focus stealing.
 
       Opens a new file manager window showing the trash folder
       contents.
     -->
     <method name="DisplayTrash">
       <arg direction="in" name="display" type="s" />
+      <arg direction="in" name="startup_id" type="s" />
     </method>
 
     <!--
       EmptyTrash (display : STRING) : VOID
 
-      display : the screen on which to display the confirmation of
-                the operation and the progress status or "" to use
-                the default screen of the file manager.
+      display    : the screen on which to display the confirmation of
+                   the operation and the progress status or "" to use
+                   the default screen of the file manager.
+      startup_id : the DESKTOP_STARTUP_ID environment variable for properly
+                   handling startup notification and focus stealing.
 
       Tells the file manager to empty the trash bin.
     -->
     <method name="EmptyTrash">
       <arg direction="in" name="display" type="s" />
+      <arg direction="in" name="startup_id" type="s" />
     </method>
 
     <!--
       MoveToTrash (uris : ARRAY OF STRING, display : STRING) : VOID
 
-      filenames : an array of file:-URIs or absolute paths for the files
-                  that should be moved to the trash can.
-      display   : the screen on which to display the progress dialog
-                  and possible error messages and confirmation dialogs
-                  or "" to use the default screen of the file manager.
+      filenames  : an array of file:-URIs or absolute paths for the files
+                   that should be moved to the trash can.
+      display    : the screen on which to display the progress dialog
+                   and possible error messages and confirmation dialogs
+                   or "" to use the default screen of the file manager.
+      startup_id : the DESKTOP_STARTUP_ID environment variable for properly
+                   handling startup notification and focus stealing.
 
       Tells the file manager to move all files specified by the filenames
       to the trash bin.
@@ -72,6 +80,7 @@
     <method name="MoveToTrash">
       <arg direction="in" name="filenames" type="as" />
       <arg direction="in" name="display" type="s" />
+      <arg direction="in" name="startup_id" type="s" />
     </method>
 
     <!--
@@ -97,3 +106,5 @@
     <signal name="TrashChanged" />
   </interface>
 </node>
+
+<!-- vi:set ts=2 sw=2 et ai: -->



More information about the Xfce4-commits mailing list