[Xfce4-commits] <thunar:migration-to-gio> Properly support startup notify when opening files or the bulk renamer.
Jannis Pohlmann
jannis at xfce.org
Fri Aug 21 16:32:01 CEST 2009
Updating branch refs/heads/migration-to-gio
to 62ad9ea08c84849d6e4384e03f58ec29295c2b5a (commit)
from 91a9e1cb861d4331164a886c032a83efc8862644 (commit)
commit 62ad9ea08c84849d6e4384e03f58ec29295c2b5a
Author: Jannis Pohlmann <jannis at xfce.org>
Date: Fri Aug 21 16:19:02 2009 +0200
Properly support startup notify when opening files or the bulk renamer.
When calling thunar from the command line, it now uses the
DESKTOP_STARTUP_ID environment variable and passes it to the functions
responsible to open/execute files and to open the bulk renamer.
An additional startup id paremeter is added to the functions
thunar_application_bulk_rename()
thunar_application_open_window()
thunar_application_process_filenames()
thunar_file_launch()
thunar_show_renamer_dialog()
thunar_dbus_client_launch_files()
thunar_dbus_service_launch_files()
as well as to the following D-Bus methods:
org.xfce.FileManager.Launch()
org.xfce.Thunar.BulkRename()
org.xfce.Thunar.LaunchFiles()
This was made possible by Nick who provided the entire patch.
thunar/main.c | 15 +++---
thunar/thunar-application.c | 91 +++++++++++++++++++--------------
thunar/thunar-application.h | 5 ++-
thunar/thunar-dbus-client.c | 16 ++++++
thunar/thunar-dbus-client.h | 2 +
thunar/thunar-dbus-service-infos.xml | 16 ++++--
thunar/thunar-dbus-service.c | 18 ++++---
thunar/thunar-file.c | 20 ++++---
thunar/thunar-file.h | 1 +
thunar/thunar-launcher.c | 2 +-
thunar/thunar-location-button.c | 2 +-
thunar/thunar-location-buttons.c | 2 +-
thunar/thunar-location-entry.c | 2 +-
thunar/thunar-renamer-dialog.c | 14 ++++--
thunar/thunar-renamer-dialog.h | 3 +-
thunar/thunar-shortcuts-view.c | 2 +-
thunar/thunar-standard-view.c | 2 +-
thunar/thunar-tree-view.c | 2 +-
thunar/thunar-window.c | 4 +-
19 files changed, 137 insertions(+), 82 deletions(-)
diff --git a/thunar/main.c b/thunar/main.c
index cdf1c96..6bec9bf 100644
--- a/thunar/main.c
+++ b/thunar/main.c
@@ -115,6 +115,7 @@ main (int argc, char **argv)
GError *error = NULL;
gchar *working_directory;
gchar **filenames = NULL;
+ const gchar *startup_id;
/* setup translation domain */
xfce_textdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR, "UTF-8");
@@ -132,6 +133,9 @@ main (int argc, char **argv)
/* initialize the GThread system */
if (!g_thread_supported ())
g_thread_init (NULL);
+
+ /* get the startup notification id */
+ startup_id = g_getenv ("DESKTOP_STARTUP_ID");
/* initialize Gtk+ */
if (!gtk_init_with_args (&argc, &argv, _("[FILES...]"), option_entries, GETTEXT_PACKAGE, &error))
@@ -216,12 +220,9 @@ main (int argc, char **argv)
#ifdef HAVE_DBUS
/* check if we can reuse an existing instance */
- if ((!opt_bulk_rename && filenames != NULL && thunar_dbus_client_launch_files (working_directory, filenames, NULL, NULL))
- || (opt_bulk_rename && thunar_dbus_client_bulk_rename (working_directory, filenames, TRUE, NULL, NULL)))
+ if ((!opt_bulk_rename && filenames != NULL && thunar_dbus_client_launch_files (working_directory, filenames, NULL, startup_id, NULL))
+ || (opt_bulk_rename && thunar_dbus_client_bulk_rename (working_directory, filenames, TRUE, NULL, startup_id, NULL)))
{
- /* stop any running startup notification */
- gdk_notify_startup_complete ();
-
/* that worked, let's get outa here */
g_free (working_directory);
g_strfreev (filenames);
@@ -247,10 +248,10 @@ main (int argc, char **argv)
if (G_UNLIKELY (opt_bulk_rename))
{
/* try to open the bulk rename dialog */
- if (!thunar_application_bulk_rename (application, working_directory, filenames, TRUE, NULL, &error))
+ if (!thunar_application_bulk_rename (application, working_directory, filenames, TRUE, NULL, startup_id, &error))
goto error0;
}
- else if (filenames != NULL && !thunar_application_process_filenames (application, working_directory, filenames, NULL, &error))
+ else if (filenames != NULL && !thunar_application_process_filenames (application, working_directory, filenames, NULL, startup_id, &error))
{
/* we failed to process the filenames or the bulk rename failed */
error0:
diff --git a/thunar/thunar-application.c b/thunar/thunar-application.c
index 4530e69..0d64a1d 100644
--- a/thunar/thunar-application.c
+++ b/thunar/thunar-application.c
@@ -91,10 +91,6 @@ static void thunar_application_launch (ThunarApplicati
GList *source_path_list,
GList *target_path_list,
GClosure *new_files_closure);
-static GtkWidget *thunar_application_open_window_with_role (ThunarApplication *application,
- const gchar *role,
- ThunarFile *directory,
- GdkScreen *screen);
static void thunar_application_window_destroyed (GtkWidget *window,
ThunarApplication *application);
static void thunar_application_drive_connected (GVolumeMonitor *volume_monitor,
@@ -147,6 +143,7 @@ struct _ThunarApplication
static GObjectClass *thunar_application_parent_class;
static GQuark thunar_application_screen_quark;
+static GQuark thunar_application_startup_id_quark;
@@ -187,6 +184,8 @@ thunar_application_class_init (ThunarApplicationClass *klass)
/* pre-allocate the required quarks */
thunar_application_screen_quark =
g_quark_from_static_string ("thunar-application-screen");
+ thunar_application_startup_id_quark =
+ g_quark_from_static_string ("thunar-application-startup-id");
/* determine the parent type class */
thunar_application_parent_class = g_type_class_peek_parent (klass);
@@ -466,37 +465,6 @@ thunar_application_launch (ThunarApplication *application,
-static GtkWidget*
-thunar_application_open_window_with_role (ThunarApplication *application,
- const gchar *role,
- ThunarFile *directory,
- GdkScreen *screen)
-{
- GtkWidget *window;
-
- if (G_UNLIKELY (screen == NULL))
- screen = gdk_screen_get_default ();
-
- /* allocate the window */
- window = g_object_new (THUNAR_TYPE_WINDOW,
- "role", role,
- "screen", screen,
- NULL);
-
- /* hook up the window */
- thunar_application_take_window (application, GTK_WINDOW (window));
-
- /* show the new window */
- gtk_widget_show (window);
-
- /* change the directory */
- thunar_window_set_current_directory (THUNAR_WINDOW (window), directory);
-
- return window;
-}
-
-
-
static void
thunar_application_window_destroyed (GtkWidget *window,
ThunarApplication *application)
@@ -935,6 +903,8 @@ thunar_application_take_window (ThunarApplication *application,
* @directory : the directory to open.
* @screen : the #GdkScreen on which to open the window or %NULL
* to open on the default screen.
+ * @startup_id : startup id from startup notification passed along
+ * with dbus to make focus stealing work properly.
*
* Opens a new #ThunarWindow for @application, displaying the
* given @directory.
@@ -944,7 +914,8 @@ thunar_application_take_window (ThunarApplication *application,
GtkWidget*
thunar_application_open_window (ThunarApplication *application,
ThunarFile *directory,
- GdkScreen *screen)
+ GdkScreen *screen,
+ const gchar *startup_id)
{
GtkWidget *window;
gchar *role;
@@ -953,11 +924,34 @@ thunar_application_open_window (ThunarApplication *application,
_thunar_return_val_if_fail (THUNAR_IS_FILE (directory), NULL);
_thunar_return_val_if_fail (screen == NULL || GDK_IS_SCREEN (screen), NULL);
+ if (G_UNLIKELY (screen == NULL))
+ screen = gdk_screen_get_default ();
+
/* generate a unique role for the new window (for session management) */
role = g_strdup_printf ("Thunar-%u-%u", (guint) time (NULL), (guint) g_random_int ());
- window = thunar_application_open_window_with_role (application, role, directory, screen);
+
+ /* allocate the window */
+ window = g_object_new (THUNAR_TYPE_WINDOW,
+ "role", role,
+ "screen", screen,
+ NULL);
+
+ /* cleanup */
g_free (role);
+ /* set the startup id */
+ if (startup_id != NULL)
+ gtk_window_set_startup_id (GTK_WINDOW (window), startup_id);
+
+ /* hook up the window */
+ thunar_application_take_window (application, GTK_WINDOW (window));
+
+ /* show the new window */
+ gtk_widget_show (window);
+
+ /* change the directory */
+ thunar_window_set_current_directory (THUNAR_WINDOW (window), directory);
+
return window;
}
@@ -975,6 +969,8 @@ thunar_application_open_window (ThunarApplication *application,
* application.
* @screen : the #GdkScreen on which to rename the @filenames or %NULL
* to use the default #GdkScreen.
+ * @startup_id : startup notification id to properly finish startup notification
+ * and focus the window when focus stealing is enabled or %NULL.
* @error : return location for errors or %NULL.
*
* Tries to popup the bulk rename dialog.
@@ -987,6 +983,7 @@ thunar_application_bulk_rename (ThunarApplication *application,
gchar **filenames,
gboolean standalone,
GdkScreen *screen,
+ const gchar *startup_id,
GError **error)
{
ThunarFile *current_directory = NULL;
@@ -1038,7 +1035,7 @@ thunar_application_bulk_rename (ThunarApplication *application,
if (G_LIKELY (filenames[n] == NULL))
{
/* popup the bulk rename dialog */
- thunar_show_renamer_dialog (screen, current_directory, file_list, standalone);
+ thunar_show_renamer_dialog (screen, current_directory, file_list, standalone, startup_id);
/* we succeed */
result = TRUE;
@@ -1062,6 +1059,7 @@ thunar_application_process_files_finish (GObject *object,
ThunarFile *file;
GdkScreen *screen;
GError *error = NULL;
+ const gchar *startup_id;
_thunar_return_if_fail (G_IS_FILE (object));
_thunar_return_if_fail (G_IS_ASYNC_RESULT (result));
@@ -1086,13 +1084,20 @@ thunar_application_process_files_finish (GObject *object,
screen = g_object_get_qdata (G_OBJECT (file), thunar_application_screen_quark);
g_object_set_qdata (G_OBJECT (file), thunar_application_screen_quark, NULL);
+ /* determine and the startup id of the file */
+ startup_id = g_object_get_qdata (G_OBJECT (file), thunar_application_startup_id_quark);
+
/* check if mounting succeeded */
if (error == NULL)
{
/* try to open the file or directory */
- thunar_file_launch (file, screen, &error);
+ thunar_file_launch (file, screen, startup_id, &error);
}
+ /* unset the startup id */
+ if (startup_id != NULL)
+ g_object_set_qdata (G_OBJECT (file), thunar_application_startup_id_quark, NULL);
+
if (error != NULL)
{
/* tell the user that we were unable to launch the file specified */
@@ -1165,6 +1170,8 @@ thunar_application_process_files (ThunarApplication *application)
* @working_directory.
* @screen : the #GdkScreen on which to process the @filenames, or %NULL to
* use the default screen.
+ * @startup_id : startup id to finish startup notification and properly focus the
+ * window when focus stealing is enabled or %NULL.
* @error : return location for errors or %NULL.
*
* Tells @application to process the given @filenames and launch them appropriately.
@@ -1176,6 +1183,7 @@ thunar_application_process_filenames (ThunarApplication *application,
const gchar *working_directory,
gchar **filenames,
GdkScreen *screen,
+ const gchar *startup_id,
GError **error)
{
ThunarFile *file;
@@ -1236,6 +1244,11 @@ thunar_application_process_filenames (ThunarApplication *application,
/* remember the screen to launch the file on */
g_object_set_qdata (G_OBJECT (lp->data), thunar_application_screen_quark, screen);
+ /* remember the startup id to set on the window */
+ if (G_LIKELY (startup_id != NULL && *startup_id != '\0'))
+ g_object_set_qdata_full (G_OBJECT (lp->data), thunar_application_startup_id_quark,
+ g_strdup (startup_id), (GDestroyNotify) g_free);
+
/* append the file to the list of files we need to launch */
application->files_to_launch = g_list_append (application->files_to_launch,
lp->data);
diff --git a/thunar/thunar-application.h b/thunar/thunar-application.h
index 33e877e..d90dd28 100644
--- a/thunar/thunar-application.h
+++ b/thunar/thunar-application.h
@@ -53,19 +53,22 @@ void thunar_application_take_window (ThunarApplication *appl
GtkWidget *thunar_application_open_window (ThunarApplication *application,
ThunarFile *directory,
- GdkScreen *screen);
+ GdkScreen *screen,
+ const gchar *startup_id);
gboolean thunar_application_bulk_rename (ThunarApplication *application,
const gchar *working_directory,
gchar **filenames,
gboolean standalone,
GdkScreen *screen,
+ const gchar *startup_id,
GError **error);
gboolean thunar_application_process_filenames (ThunarApplication *application,
const gchar *working_directory,
gchar **filenames,
GdkScreen *screen,
+ const gchar *startup_id,
GError **error);
gboolean thunar_application_is_processing (ThunarApplication *application);
diff --git a/thunar/thunar-dbus-client.c b/thunar/thunar-dbus-client.c
index e5bc460..83d8174 100644
--- a/thunar/thunar-dbus-client.c
+++ b/thunar/thunar-dbus-client.c
@@ -37,6 +37,8 @@
* @standalone : whether to run the bulk renamer in standalone mode.
* @screen : the #GdkScreen on which to display the dialog or %NULL to
* use the default #GdkScreen.
+ * @startup_id : startup id to properly finish startup notification and set
+ * the window timestamp or %NULL.
* @error : return location for errors or %NULL.
*
* Tries to invoke the BulkRename() method on a running Thunar instance, that is
@@ -53,6 +55,7 @@ thunar_dbus_client_bulk_rename (const gchar *working_directory,
gchar **filenames,
gboolean standalone,
GdkScreen *screen,
+ const gchar *startup_id,
GError **error)
{
DBusConnection *connection;
@@ -85,6 +88,10 @@ thunar_dbus_client_bulk_rename (const gchar *working_directory,
/* determine the display name for the screen */
display_name = gdk_screen_make_display_name (screen);
+ /* dbus does not like null values */
+ if (startup_id == NULL)
+ startup_id = "";
+
/* generate the BulkRename() method (disable activation!) */
message = dbus_message_new_method_call ("org.xfce.Thunar", "/org/xfce/FileManager", "org.xfce.Thunar", "BulkRename");
dbus_message_set_auto_start (message, FALSE);
@@ -93,6 +100,7 @@ thunar_dbus_client_bulk_rename (const gchar *working_directory,
DBUS_TYPE_ARRAY, DBUS_TYPE_STRING, &filenames, g_strv_length (filenames),
DBUS_TYPE_BOOLEAN, &standalone,
DBUS_TYPE_STRING, &display_name,
+ DBUS_TYPE_STRING, &startup_id,
DBUS_TYPE_INVALID);
/* release the display name */
@@ -133,6 +141,8 @@ thunar_dbus_client_bulk_rename (const gchar *working_directory,
* @filenames : the list of @filenames to launch.
* @screen : the #GdkScreen on which to launch the @filenames or %NULL
* to use the default #GdkScreen.
+ * @startup_id : startup id to properly finish startup notification and set
+ * the window timestamp or %NULL.
* @error : return location for errors or %NULL.
*
* Tries to invoke the LaunchFiles() method on a running Thunar instance, that is
@@ -149,6 +159,7 @@ gboolean
thunar_dbus_client_launch_files (const gchar *working_directory,
gchar **filenames,
GdkScreen *screen,
+ const gchar *startup_id,
GError **error)
{
DBusConnection *connection;
@@ -181,6 +192,10 @@ thunar_dbus_client_launch_files (const gchar *working_directory,
/* determine the display name for the screen */
display_name = gdk_screen_make_display_name (screen);
+ /* dbus does not like null values */
+ if (startup_id == NULL)
+ startup_id = "";
+
/* 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);
@@ -188,6 +203,7 @@ thunar_dbus_client_launch_files (const gchar *working_directory,
DBUS_TYPE_STRING, &working_directory,
DBUS_TYPE_ARRAY, DBUS_TYPE_STRING, &filenames, g_strv_length (filenames),
DBUS_TYPE_STRING, &display_name,
+ DBUS_TYPE_STRING, &startup_id,
DBUS_TYPE_INVALID);
/* release the display name */
diff --git a/thunar/thunar-dbus-client.h b/thunar/thunar-dbus-client.h
index acc9add..6542c88 100644
--- a/thunar/thunar-dbus-client.h
+++ b/thunar/thunar-dbus-client.h
@@ -28,11 +28,13 @@ gboolean thunar_dbus_client_bulk_rename (const gchar *working_directory,
gchar **filenames,
gboolean standalone,
GdkScreen *screen,
+ const gchar *startup_id,
GError **error);
gboolean thunar_dbus_client_launch_files (const gchar *working_directory,
gchar **filenames,
GdkScreen *screen,
+ const gchar *startup_id,
GError **error);
gboolean thunar_dbus_client_terminate (GError **error);
diff --git a/thunar/thunar-dbus-service-infos.xml b/thunar/thunar-dbus-service-infos.xml
index a45211d..c2c01c7 100644
--- a/thunar/thunar-dbus-service-infos.xml
+++ b/thunar/thunar-dbus-service-infos.xml
@@ -105,9 +105,9 @@
<!--
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.
+ 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" />
@@ -219,7 +219,7 @@
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="thunar_dbus_service" />
<!--
- BulkRename (working-directory : STRING, filenames : ARRAY OF STRING, standalone : BOOLEAN, display : STRING) : VOID
+ 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
@@ -239,16 +239,19 @@
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>
<!--
- LaunchFiles (working-directory : STRING, filenames : ARRAY OF STRING, display : STRING) : VOID
+ 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.
@@ -257,11 +260,14 @@
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>
<!--
diff --git a/thunar/thunar-dbus-service.c b/thunar/thunar-dbus-service.c
index 16a8394..a1dfc5f 100644
--- a/thunar/thunar-dbus-service.c
+++ b/thunar/thunar-dbus-service.c
@@ -102,11 +102,13 @@ static gboolean thunar_dbus_service_bulk_rename (ThunarDBusServi
gchar **filenames,
gboolean standalone,
const gchar *display,
+ const gchar *startup_id,
GError **error);
static gboolean thunar_dbus_service_launch_files (ThunarDBusService *dbus_service,
const gchar *working_directory,
gchar **filenames,
const gchar *display,
+ const gchar *startup_id,
GError **error);
static gboolean thunar_dbus_service_terminate (ThunarDBusService *dbus_service,
GError **error);
@@ -361,7 +363,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);
+ thunar_application_open_window (application, file, screen, NULL);
g_object_unref (G_OBJECT (application));
/* cleanup */
@@ -400,7 +402,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);
+ window = thunar_application_open_window (application, folder, screen, NULL);
g_object_unref (application);
/* determine the path for the filename relative to the folder */
@@ -480,7 +482,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, error);
+ result = thunar_file_launch (file, screen, NULL, error);
/* cleanup */
g_object_unref (G_OBJECT (screen));
@@ -509,7 +511,7 @@ 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_widget_show (dialog);
+ gtk_window_present (GTK_WINDOW (dialog));
/* ...and let the application take care of it */
application = thunar_application_get ();
@@ -542,7 +544,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);
+ thunar_application_open_window (application, dbus_service->trash_bin, screen, NULL);
g_object_unref (G_OBJECT (application));
/* release the screen */
@@ -669,6 +671,7 @@ thunar_dbus_service_bulk_rename (ThunarDBusService *dbus_service,
gchar **filenames,
gboolean standalone,
const gchar *display,
+ const gchar *startup_id,
GError **error)
{
ThunarApplication *application;
@@ -687,7 +690,7 @@ thunar_dbus_service_bulk_rename (ThunarDBusService *dbus_service,
{
/* tell the application to display the bulk rename dialog */
application = thunar_application_get ();
- result = thunar_application_bulk_rename (application, cwd, filenames, standalone, screen, error);
+ result = thunar_application_bulk_rename (application, cwd, filenames, standalone, screen, startup_id, error);
g_object_unref (G_OBJECT (application));
/* release the screen */
@@ -707,6 +710,7 @@ thunar_dbus_service_launch_files (ThunarDBusService *dbus_service,
const gchar *working_directory,
gchar **filenames,
const gchar *display,
+ const gchar *startup_id,
GError **error)
{
ThunarApplication *application;
@@ -735,7 +739,7 @@ thunar_dbus_service_launch_files (ThunarDBusService *dbus_service,
{
/* let the application process the filenames */
application = thunar_application_get ();
- result = thunar_application_process_filenames (application, working_directory, filenames, screen, error);
+ result = thunar_application_process_filenames (application, working_directory, filenames, screen, startup_id, error);
g_object_unref (G_OBJECT (application));
/* release the screen */
diff --git a/thunar/thunar-file.c b/thunar/thunar-file.c
index 53010c4..bc3722e 100644
--- a/thunar/thunar-file.c
+++ b/thunar/thunar-file.c
@@ -1128,11 +1128,12 @@ thunar_file_execute (ThunarFile *file,
/**
* thunar_file_launch:
- * @file : a #ThunarFile instance.
- * @parent : a #GtkWidget or a #GdkScreen on which to launch the @file.
- * May also be %NULL in which case the default #GdkScreen will
- * be used.
- * @error : return location for errors or %NULL.
+ * @file : a #ThunarFile instance.
+ * @parent : a #GtkWidget or a #GdkScreen on which to launch the @file.
+ * May also be %NULL in which case the default #GdkScreen will
+ * be used.
+ * @startup_id : startup id for the new window (send over for dbus) or %NULL.
+ * @error : return location for errors or %NULL.
*
* If @file is an executable file, tries to execute it. Else if @file is
* a directory, opens a new #ThunarWindow to display the directory. Else,
@@ -1147,9 +1148,10 @@ thunar_file_execute (ThunarFile *file,
* Return value: %TRUE on success, else %FALSE.
**/
gboolean
-thunar_file_launch (ThunarFile *file,
- gpointer parent,
- GError **error)
+thunar_file_launch (ThunarFile *file,
+ gpointer parent,
+ const gchar *startup_id,
+ GError **error)
{
GdkAppLaunchContext *context;
ThunarApplication *application;
@@ -1174,7 +1176,7 @@ thunar_file_launch (ThunarFile *file,
if (thunar_file_is_directory (file))
{
application = thunar_application_get ();
- thunar_application_open_window (application, file, screen);
+ thunar_application_open_window (application, file, screen, startup_id);
g_object_unref (G_OBJECT (application));
return TRUE;
}
diff --git a/thunar/thunar-file.h b/thunar/thunar-file.h
index 891e051..683b888 100644
--- a/thunar/thunar-file.h
+++ b/thunar/thunar-file.h
@@ -146,6 +146,7 @@ gboolean thunar_file_execute (ThunarFile *file
gboolean thunar_file_launch (ThunarFile *file,
gpointer parent,
+ const gchar *startup_id,
GError **error);
gboolean thunar_file_rename (ThunarFile *file,
diff --git a/thunar/thunar-launcher.c b/thunar/thunar-launcher.c
index a9c6feb..ac167f9 100644
--- a/thunar/thunar-launcher.c
+++ b/thunar/thunar-launcher.c
@@ -748,7 +748,7 @@ thunar_launcher_open_windows (ThunarLauncher *launcher,
/* open all requested windows */
for (lp = directories; lp != NULL; lp = lp->next)
- thunar_application_open_window (application, lp->data, screen);
+ thunar_application_open_window (application, lp->data, screen, NULL);
/* release the application object */
g_object_unref (G_OBJECT (application));
diff --git a/thunar/thunar-location-button.c b/thunar/thunar-location-button.c
index d639364..d34b18d 100644
--- a/thunar/thunar-location-button.c
+++ b/thunar/thunar-location-button.c
@@ -603,7 +603,7 @@ thunar_location_button_button_release_event (GtkWidget *button,
{
/* open a new window for the folder */
application = thunar_application_get ();
- thunar_application_open_window (application, location_button->file, gtk_widget_get_screen (GTK_WIDGET (location_button)));
+ thunar_application_open_window (application, location_button->file, gtk_widget_get_screen (GTK_WIDGET (location_button)), NULL);
g_object_unref (G_OBJECT (application));
}
}
diff --git a/thunar/thunar-location-buttons.c b/thunar/thunar-location-buttons.c
index 490e687..5a62c76 100644
--- a/thunar/thunar-location-buttons.c
+++ b/thunar/thunar-location-buttons.c
@@ -1437,7 +1437,7 @@ thunar_location_buttons_action_open_in_new_window (GtkAction *action
{
/* open a new window for the directory */
application = thunar_application_get ();
- thunar_application_open_window (application, directory, gtk_widget_get_screen (GTK_WIDGET (buttons)));
+ thunar_application_open_window (application, directory, gtk_widget_get_screen (GTK_WIDGET (buttons)), NULL);
g_object_unref (G_OBJECT (application));
}
}
diff --git a/thunar/thunar-location-entry.c b/thunar/thunar-location-entry.c
index 265b586..03af3fc 100644
--- a/thunar/thunar-location-entry.c
+++ b/thunar/thunar-location-entry.c
@@ -429,7 +429,7 @@ thunar_location_entry_open_or_launch (ThunarLocationEntry *location_entry,
else
{
/* try to launch the selected file */
- thunar_file_launch (file, location_entry->path_entry, &error);
+ thunar_file_launch (file, location_entry->path_entry, NULL, &error);
/* be sure to reset the current file of the path entry */
if (G_LIKELY (location_entry->current_directory != NULL))
diff --git a/thunar/thunar-renamer-dialog.c b/thunar/thunar-renamer-dialog.c
index 02be6c3..96ca63a 100644
--- a/thunar/thunar-renamer-dialog.c
+++ b/thunar/thunar-renamer-dialog.c
@@ -1861,15 +1861,17 @@ thunar_renamer_dialog_set_standalone (ThunarRenamerDialog *renamer_dialog,
* @files : the list of #ThunarFile<!---->s to rename.
* @standalone : whether the dialog should appear like a standalone
* application instead of an integrated renamer dialog.
+ * @startup_id : startup id to set on the window or %NULL.
*
* Convenience function to display a #ThunarRenamerDialog with
* the given parameters.
**/
void
-thunar_show_renamer_dialog (gpointer parent,
- ThunarFile *current_directory,
- GList *files,
- gboolean standalone)
+thunar_show_renamer_dialog (gpointer parent,
+ ThunarFile *current_directory,
+ GList *files,
+ gboolean standalone,
+ const gchar *startup_id)
{
ThunarApplication *application;
GdkScreen *screen;
@@ -1904,6 +1906,10 @@ thunar_show_renamer_dialog (gpointer parent,
"standalone", standalone,
NULL);
+ /* set the dialogs startup id if available */
+ if (startup_id != NULL && *startup_id != '\0')
+ gtk_window_set_startup_id (GTK_WINDOW (dialog), startup_id);
+
/* check if we have a toplevel window */
if (G_LIKELY (window != NULL && GTK_WIDGET_TOPLEVEL (window)))
{
diff --git a/thunar/thunar-renamer-dialog.h b/thunar/thunar-renamer-dialog.h
index d7ff846..66ab323 100644
--- a/thunar/thunar-renamer-dialog.h
+++ b/thunar/thunar-renamer-dialog.h
@@ -51,7 +51,8 @@ void thunar_renamer_dialog_set_standalone (ThunarRenamerDialog *re
void thunar_show_renamer_dialog (gpointer parent,
ThunarFile *current_directory,
GList *files,
- gboolean standalone);
+ gboolean standalone,
+ const gchar *startup_id);
G_END_DECLS;
diff --git a/thunar/thunar-shortcuts-view.c b/thunar/thunar-shortcuts-view.c
index 91be180..f5895df 100644
--- a/thunar/thunar-shortcuts-view.c
+++ b/thunar/thunar-shortcuts-view.c
@@ -1222,7 +1222,7 @@ thunar_shortcuts_view_poke_file_finish (ThunarBrowser *browser,
/* open a new window for the target folder */
application = thunar_application_get ();
thunar_application_open_window (application, target_file,
- gtk_widget_get_screen (GTK_WIDGET (browser)));
+ gtk_widget_get_screen (GTK_WIDGET (browser)), NULL);
g_object_unref (application);
}
else
diff --git a/thunar/thunar-standard-view.c b/thunar/thunar-standard-view.c
index 2aa6b8f..f30d66c 100644
--- a/thunar/thunar-standard-view.c
+++ b/thunar/thunar-standard-view.c
@@ -2282,7 +2282,7 @@ thunar_standard_view_action_rename (GtkAction *action,
file = thunar_navigator_get_current_directory (THUNAR_NAVIGATOR (standard_view));
/* display the bulk rename dialog */
- thunar_show_renamer_dialog (GTK_WIDGET (standard_view), file, standard_view->selected_files, FALSE);
+ thunar_show_renamer_dialog (GTK_WIDGET (standard_view), file, standard_view->selected_files, FALSE, NULL);
}
}
diff --git a/thunar/thunar-tree-view.c b/thunar/thunar-tree-view.c
index c94e3d4..83dc7e2 100644
--- a/thunar/thunar-tree-view.c
+++ b/thunar/thunar-tree-view.c
@@ -2050,7 +2050,7 @@ thunar_tree_view_open_selection_in_new_window (ThunarTreeView *view)
/* open a new window for the selected folder */
application = thunar_application_get ();
thunar_application_open_window (application, file,
- gtk_widget_get_screen (GTK_WIDGET (view)));
+ gtk_widget_get_screen (GTK_WIDGET (view)), NULL);
g_object_unref (application);
g_object_unref (file);
}
diff --git a/thunar/thunar-window.c b/thunar/thunar-window.c
index 3d837a2..ef54215 100644
--- a/thunar/thunar-window.c
+++ b/thunar/thunar-window.c
@@ -1398,7 +1398,7 @@ thunar_window_open_or_launch (ThunarWindow *window,
else
{
/* try to launch the selected file */
- if (!thunar_file_launch (file, window, &error))
+ if (!thunar_file_launch (file, window, NULL, &error))
{
thunar_dialogs_show_error (window, error, _("Failed to launch \"%s\""),
thunar_file_get_display_name (file));
@@ -1497,7 +1497,7 @@ thunar_window_action_open_new_window (GtkAction *action,
/* popup a new window */
application = thunar_application_get ();
new_window = thunar_application_open_window (application, window->current_directory,
- gtk_widget_get_screen (GTK_WIDGET (window)));
+ gtk_widget_get_screen (GTK_WIDGET (window)), NULL);
g_object_unref (G_OBJECT (application));
/* determine the first visible file in the current window */
More information about the Xfce4-commits
mailing list