[Xfce4-commits] <thunar:master> Add startup-id to more D-Bus methods. Move LaunchFiles to org.xfce.FM.

Jannis Pohlmann noreply at xfce.org
Tue Aug 31 10:46:01 CEST 2010


Updating branch refs/heads/master
         to 43b57a28732cdfd4e7028ff23d79dc2d270ceef6 (commit)
       from 7b409b55b1a43263a52ca38496474b0c4487c31f (commit)

commit 43b57a28732cdfd4e7028ff23d79dc2d270ceef6
Author: Jannis Pohlmann <jannis at xfce.org>
Date:   Sun Aug 29 20:54:18 2010 +0200

    Add startup-id to more D-Bus methods. Move LaunchFiles to org.xfce.FM.

 thunar/thunar-application.c          |    4 +-
 thunar/thunar-application.h          |    3 +-
 thunar/thunar-dbus-client.c          |    2 +-
 thunar/thunar-dbus-service-infos.xml |  117 +++++++++++++++++++++-------------
 thunar/thunar-dbus-service.c         |   35 ++++++++--
 thunar/thunar-location-buttons.c     |    2 +-
 thunar/thunar-shortcuts-view.c       |    2 +-
 thunar/thunar-tree-view.c            |    2 +-
 thunar/thunar-window.c               |    2 +-
 9 files changed, 111 insertions(+), 58 deletions(-)

diff --git a/thunar/thunar-application.c b/thunar/thunar-application.c
index cbc1f2d..f0de840 100644
--- a/thunar/thunar-application.c
+++ b/thunar/thunar-application.c
@@ -1630,7 +1630,8 @@ thunar_application_mkdir (ThunarApplication *application,
  **/
 void
 thunar_application_empty_trash (ThunarApplication *application,
-                                gpointer           parent)
+                                gpointer           parent,
+                                const gchar       *startup_id)
 {
   GtkWidget *dialog;
   GtkWindow *window;
@@ -1653,6 +1654,7 @@ thunar_application_empty_trash (ThunarApplication *application,
                                    _("Remove all files and folders from the Trash?"));
   if (G_UNLIKELY (window == NULL && screen != NULL))
     gtk_window_set_screen (GTK_WINDOW (dialog), screen);
+  gtk_window_set_startup_id (GTK_WINDOW (dialog), startup_id);
   gtk_dialog_add_buttons (GTK_DIALOG (dialog),
                           GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
                           _("_Empty Trash"), GTK_RESPONSE_YES,
diff --git a/thunar/thunar-application.h b/thunar/thunar-application.h
index 53e3e3e..7b1ceab 100644
--- a/thunar/thunar-application.h
+++ b/thunar/thunar-application.h
@@ -119,7 +119,8 @@ void               thunar_application_mkdir               (ThunarApplication *ap
                                                            GClosure          *new_files_closure);
 
 void               thunar_application_empty_trash         (ThunarApplication *application,
-                                                           gpointer           parent);
+                                                           gpointer           parent,
+                                                           const gchar       *startup_id);
 
 void               thunar_application_restore_files       (ThunarApplication *application,
                                                            gpointer           parent,
diff --git a/thunar/thunar-dbus-client.c b/thunar/thunar-dbus-client.c
index 83d8174..687eeb5 100644
--- a/thunar/thunar-dbus-client.c
+++ b/thunar/thunar-dbus-client.c
@@ -197,7 +197,7 @@ thunar_dbus_client_launch_files (const gchar *working_directory,
     startup_id = "";
 
   /* generate the LaunchFiles() method (disable activation!) */
-  message = dbus_message_new_method_call ("org.xfce.Thunar", "/org/xfce/FileManager", "org.xfce.Thunar", "LaunchFiles");
+  message = dbus_message_new_method_call ("org.xfce.Thunar", "/org/xfce/FileManager", "org.xfce.FileManager", "LaunchFiles");
   dbus_message_set_auto_start (message, FALSE);
   dbus_message_append_args (message,
                             DBUS_TYPE_STRING, &working_directory,
diff --git a/thunar/thunar-dbus-service-infos.xml b/thunar/thunar-dbus-service-infos.xml
index ca7c0c4..a379660 100644
--- a/thunar/thunar-dbus-service-infos.xml
+++ b/thunar/thunar-dbus-service-infos.xml
@@ -33,12 +33,14 @@
     <!--
       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.
+      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
@@ -49,19 +51,23 @@
       <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.
+      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>
 
 
@@ -76,6 +82,8 @@
                    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
@@ -86,19 +94,23 @@
       <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.
+      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>
 
 
@@ -108,21 +120,27 @@
       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.
+      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>
 
 
@@ -232,6 +250,27 @@
       <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>
 
 
@@ -247,38 +286,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.
@@ -286,6 +333,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>
 
     <!--
@@ -358,25 +406,6 @@
       <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>
 
     <!--
       Terminate () : VOID
diff --git a/thunar/thunar-dbus-service.c b/thunar/thunar-dbus-service.c
index 93bb34e..312da62 100644
--- a/thunar/thunar-dbus-service.c
+++ b/thunar/thunar-dbus-service.c
@@ -80,36 +80,45 @@ static gboolean thunar_dbus_service_display_chooser_dialog      (ThunarDBusServi
                                                                  const gchar            *uri,
                                                                  gboolean                open,
                                                                  const gchar            *display,
+                                                                 const gchar            *startup_id,
                                                                  GError                **error);
 static gboolean thunar_dbus_service_display_folder              (ThunarDBusService      *dbus_service,
                                                                  const gchar            *uri,
                                                                  const gchar            *display,
+                                                                 const gchar            *startup_id,
                                                                  GError                **error);
 static gboolean thunar_dbus_service_display_folder_and_select   (ThunarDBusService      *dbus_service,
                                                                  const gchar            *uri,
                                                                  const gchar            *filename,
                                                                  const gchar            *display,
+                                                                 const gchar            *startup_id,
                                                                  GError                **error);
 static gboolean thunar_dbus_service_display_file_properties     (ThunarDBusService      *dbus_service,
                                                                  const gchar            *uri,
                                                                  const gchar            *display,
+                                                                 const gchar            *startup_id,
                                                                  GError                **error);
 static gboolean thunar_dbus_service_launch                      (ThunarDBusService      *dbus_service,
                                                                  const gchar            *uri,
                                                                  const gchar            *display,
+                                                                 const gchar            *startup_id,
                                                                  GError                **error);
 static gboolean thunar_dbus_service_display_preferences_dialog  (ThunarDBusService      *dbus_service,
                                                                  const gchar            *display,
+                                                                 const gchar            *startup_id,
                                                                  GError                **error);
 static gboolean thunar_dbus_service_display_trash               (ThunarDBusService      *dbus_service,
                                                                  const gchar            *display,
+                                                                 const gchar            *startup_id,
                                                                  GError                **error);
 static gboolean thunar_dbus_service_empty_trash                 (ThunarDBusService      *dbus_service,
                                                                  const gchar            *display,
+                                                                 const gchar            *startup_id,
                                                                  GError                **error);
 static gboolean thunar_dbus_service_move_to_trash               (ThunarDBusService      *dbus_service,
                                                                  gchar                 **filenames,
                                                                  const gchar            *display,
+                                                                 const gchar            *startup_id,
                                                                  GError                **error);
 static gboolean thunar_dbus_service_query_trash                 (ThunarDBusService      *dbus_service,
                                                                  gboolean               *empty,
@@ -351,6 +360,7 @@ thunar_dbus_service_display_chooser_dialog (ThunarDBusService *dbus_service,
                                             const gchar       *uri,
                                             gboolean           open,
                                             const gchar       *display,
+                                            const gchar       *startup_id,
                                             GError           **error)
 {
   ThunarFile *file;
@@ -361,6 +371,7 @@ thunar_dbus_service_display_chooser_dialog (ThunarDBusService *dbus_service,
     return FALSE;
 
   /* popup the chooser dialog */
+  /* TODO use the startup id! */
   thunar_show_chooser_dialog (screen, file, open);
 
   /* cleanup */
@@ -376,6 +387,7 @@ static gboolean
 thunar_dbus_service_display_folder (ThunarDBusService *dbus_service,
                                     const gchar       *uri,
                                     const gchar       *display,
+                                    const gchar       *startup_id,
                                     GError           **error)
 {
   ThunarApplication *application;
@@ -388,7 +400,7 @@ thunar_dbus_service_display_folder (ThunarDBusService *dbus_service,
 
   /* popup a new window for the folder */
   application = thunar_application_get ();
-  thunar_application_open_window (application, file, screen, NULL);
+  thunar_application_open_window (application, file, screen, startup_id);
   g_object_unref (G_OBJECT (application));
 
   /* cleanup */
@@ -405,6 +417,7 @@ thunar_dbus_service_display_folder_and_select (ThunarDBusService *dbus_service,
                                                const gchar       *uri,
                                                const gchar       *filename,
                                                const gchar       *display,
+                                               const gchar       *startup_id,
                                                GError           **error)
 {
   ThunarApplication *application;
@@ -427,7 +440,7 @@ thunar_dbus_service_display_folder_and_select (ThunarDBusService *dbus_service,
 
   /* popup a new window for the folder */
   application = thunar_application_get ();
-  window = thunar_application_open_window (application, folder, screen, NULL);
+  window = thunar_application_open_window (application, folder, screen, startup_id);
   g_object_unref (application);
 
   /* determine the path for the filename relative to the folder */
@@ -462,6 +475,7 @@ static gboolean
 thunar_dbus_service_display_file_properties (ThunarDBusService *dbus_service,
                                              const gchar       *uri,
                                              const gchar       *display,
+                                             const gchar       *startup_id,
                                              GError           **error)
 {
   ThunarApplication *application;
@@ -476,8 +490,9 @@ thunar_dbus_service_display_file_properties (ThunarDBusService *dbus_service,
   /* popup the file properties dialog */
   dialog = thunar_properties_dialog_new ();
   gtk_window_set_screen (GTK_WINDOW (dialog), screen);
+  gtk_window_set_startup_id (GTK_WINDOW (dialog), startup_id);
   thunar_properties_dialog_set_file (THUNAR_PROPERTIES_DIALOG (dialog), file);
-  gtk_widget_show (dialog);
+  gtk_window_present (GTK_WINDOW (dialog));
 
   /* let the application take control over the dialog */
   application = thunar_application_get ();
@@ -497,6 +512,7 @@ static gboolean
 thunar_dbus_service_launch (ThunarDBusService *dbus_service,
                             const gchar       *uri,
                             const gchar       *display,
+                            const gchar       *startup_id,
                             GError           **error)
 {
   ThunarFile *file;
@@ -507,7 +523,7 @@ thunar_dbus_service_launch (ThunarDBusService *dbus_service,
   if (thunar_dbus_service_parse_uri_and_display (dbus_service, uri, display, &file, &screen, error))
     {
       /* try to launch the file on the given screen */
-      result = thunar_file_launch (file, screen, NULL, error);
+      result = thunar_file_launch (file, screen, startup_id, error);
 
       /* cleanup */
       g_object_unref (G_OBJECT (screen));
@@ -522,6 +538,7 @@ thunar_dbus_service_launch (ThunarDBusService *dbus_service,
 static gboolean
 thunar_dbus_service_display_preferences_dialog (ThunarDBusService *dbus_service,
                                                 const gchar       *display,
+                                                const gchar       *startup_id,
                                                 GError           **error)
 {
   ThunarApplication *application;
@@ -536,7 +553,8 @@ thunar_dbus_service_display_preferences_dialog (ThunarDBusService *dbus_service,
   /* popup the preferences dialog... */
   dialog = thunar_preferences_dialog_new (NULL);
   gtk_window_set_screen (GTK_WINDOW (dialog), screen);
-  gtk_window_present (GTK_WINDOW (dialog));
+  gtk_window_set_startup_id (GTK_WINDOW (dialog), startup_id);
+  gtk_widget_show (GTK_WIDGET (dialog));
 
   /* ...and let the application take care of it */
   application = thunar_application_get ();
@@ -554,6 +572,7 @@ thunar_dbus_service_display_preferences_dialog (ThunarDBusService *dbus_service,
 static gboolean
 thunar_dbus_service_display_trash (ThunarDBusService *dbus_service,
                                    const gchar       *display,
+                                   const gchar       *startup_id,
                                    GError           **error)
 {
   ThunarApplication *application;
@@ -569,7 +588,7 @@ thunar_dbus_service_display_trash (ThunarDBusService *dbus_service,
     {
       /* tell the application to display the trash bin */
       application = thunar_application_get ();
-      thunar_application_open_window (application, dbus_service->trash_bin, screen, NULL);
+      thunar_application_open_window (application, dbus_service->trash_bin, screen, startup_id);
       g_object_unref (G_OBJECT (application));
 
       /* release the screen */
@@ -585,6 +604,7 @@ thunar_dbus_service_display_trash (ThunarDBusService *dbus_service,
 static gboolean
 thunar_dbus_service_empty_trash (ThunarDBusService *dbus_service,
                                  const gchar       *display,
+                                 const gchar       *startup_id,
                                  GError           **error)
 {
   ThunarApplication *application;
@@ -596,7 +616,7 @@ thunar_dbus_service_empty_trash (ThunarDBusService *dbus_service,
     {
       /* tell the application to empty the trash bin */
       application = thunar_application_get ();
-      thunar_application_empty_trash (application, screen);
+      thunar_application_empty_trash (application, screen, startup_id);
       g_object_unref (G_OBJECT (application));
 
       /* release the screen */
@@ -613,6 +633,7 @@ static gboolean
 thunar_dbus_service_move_to_trash (ThunarDBusService *dbus_service,
                                    gchar            **filenames,
                                    const gchar       *display,
+                                   const gchar       *startup_id,
                                    GError           **error)
 {
   ThunarApplication *application;
diff --git a/thunar/thunar-location-buttons.c b/thunar/thunar-location-buttons.c
index 25225a7..f9a4310 100644
--- a/thunar/thunar-location-buttons.c
+++ b/thunar/thunar-location-buttons.c
@@ -1342,7 +1342,7 @@ thunar_location_buttons_action_empty_trash (GtkAction             *action,
 
   /* launch the operation */
   application = thunar_application_get ();
-  thunar_application_empty_trash (application, GTK_WIDGET (buttons));
+  thunar_application_empty_trash (application, GTK_WIDGET (buttons), NULL);
   g_object_unref (G_OBJECT (application));
 }
 
diff --git a/thunar/thunar-shortcuts-view.c b/thunar/thunar-shortcuts-view.c
index 58f291e..58afcec 100644
--- a/thunar/thunar-shortcuts-view.c
+++ b/thunar/thunar-shortcuts-view.c
@@ -1339,7 +1339,7 @@ thunar_shortcuts_view_empty_trash (ThunarShortcutsView *view)
 
   /* empty the trash bin (asking the user first) */
   application = thunar_application_get ();
-  thunar_application_empty_trash (application, GTK_WIDGET (view));
+  thunar_application_empty_trash (application, GTK_WIDGET (view), NULL);
   g_object_unref (G_OBJECT (application));
 }
 
diff --git a/thunar/thunar-tree-view.c b/thunar/thunar-tree-view.c
index 2128e54..532385f 100644
--- a/thunar/thunar-tree-view.c
+++ b/thunar/thunar-tree-view.c
@@ -1862,7 +1862,7 @@ thunar_tree_view_action_empty_trash (ThunarTreeView *view)
 
   /* empty the trash bin (asking the user first) */
   application = thunar_application_get ();
-  thunar_application_empty_trash (application, GTK_WIDGET (view));
+  thunar_application_empty_trash (application, GTK_WIDGET (view), NULL);
   g_object_unref (G_OBJECT (application));
 }
 
diff --git a/thunar/thunar-window.c b/thunar/thunar-window.c
index aebe3e7..6b1704e 100644
--- a/thunar/thunar-window.c
+++ b/thunar/thunar-window.c
@@ -1598,7 +1598,7 @@ thunar_window_action_empty_trash (GtkAction    *action,
 
   /* launch the operation */
   application = thunar_application_get ();
-  thunar_application_empty_trash (application, GTK_WIDGET (window));
+  thunar_application_empty_trash (application, GTK_WIDGET (window), NULL);
   g_object_unref (G_OBJECT (application));
 }
 



More information about the Xfce4-commits mailing list