diff --git a/thunar/thunar-gio-extensions.c b/thunar/thunar-gio-extensions.c index a3ce0dae7..36365b3c6 100644 --- a/thunar/thunar-gio-extensions.c +++ b/thunar/thunar-gio-extensions.c @@ -549,6 +549,7 @@ thunar_g_app_info_launch (GAppInfo *info, GFile *working_directory, GList *path_list, GAppLaunchContext *context, + gboolean skip_update, GError **error) { ThunarFile *file; @@ -623,7 +624,7 @@ thunar_g_app_info_launch (GAppInfo *info, } /* emit "changed" on the file if we successfully changed the last used application */ - if (update_app_info && g_app_info_set_as_last_used_for_type (info, content_type, NULL)) + if (!skip_update && update_app_info && g_app_info_set_as_last_used_for_type (info, content_type, NULL)) thunar_file_changed (file); g_object_unref (file); diff --git a/thunar/thunar-gio-extensions.h b/thunar/thunar-gio-extensions.h index 053faa6ce..c3c3aba42 100644 --- a/thunar/thunar-gio-extensions.h +++ b/thunar/thunar-gio-extensions.h @@ -82,6 +82,7 @@ gboolean thunar_g_app_info_launch (GAppInfo *info, GFile *working_directory, GList *path_list, GAppLaunchContext *context, + gboolean skip_update, GError **error); gboolean thunar_g_app_info_should_show (GAppInfo *info); diff --git a/thunar/thunar-launcher.c b/thunar/thunar-launcher.c index 6443a8bda..102d276ff 100644 --- a/thunar/thunar-launcher.c +++ b/thunar/thunar-launcher.c @@ -91,6 +91,10 @@ static void thunar_launcher_execute_files (Thuna static void thunar_launcher_open_files (ThunarLauncher *launcher, GList *files); static void thunar_launcher_open_paths (GAppInfo *app_info, + GList *file_list, + ThunarLauncher *launcher, + gboolean skip_update); +static void thunar_launcher_open_paths_wrapper (GAppInfo *app_info, GList *file_list, ThunarLauncher *launcher); static void thunar_launcher_open_windows (ThunarLauncher *launcher, @@ -638,7 +642,7 @@ thunar_launcher_open_files (ThunarLauncher *launcher, } /* run all collected applications */ - g_hash_table_foreach (applications, (GHFunc) thunar_launcher_open_paths, launcher); + g_hash_table_foreach (applications, (GHFunc) thunar_launcher_open_paths_wrapper, launcher); /* drop the applications hash table */ g_hash_table_destroy (applications); @@ -646,10 +650,21 @@ thunar_launcher_open_files (ThunarLauncher *launcher, +static void +thunar_launcher_open_paths_wrapper (GAppInfo *app_info, + GList *path_list, + ThunarLauncher *launcher) +{ + thunar_launcher_open_paths (app_info, path_list, launcher, FALSE); +} + + + static void thunar_launcher_open_paths (GAppInfo *app_info, GList *path_list, - ThunarLauncher *launcher) + ThunarLauncher *launcher, + gboolean skip_update) { GdkAppLaunchContext *context; GdkScreen *screen; @@ -673,7 +688,7 @@ thunar_launcher_open_paths (GAppInfo *app_info, working_directory = thunar_file_get_file (launcher->current_directory); /* try to execute the application with the given URIs */ - if (!thunar_g_app_info_launch (app_info, working_directory, path_list, G_APP_LAUNCH_CONTEXT (context), &error)) + if (!thunar_g_app_info_launch (app_info, working_directory, path_list, G_APP_LAUNCH_CONTEXT (context), skip_update, &error)) { /* figure out the appropriate error message */ n = g_list_length (path_list); @@ -1368,9 +1383,11 @@ G_GNUC_END_IGNORE_DEPRECATIONS app_info = g_object_get_qdata (G_OBJECT (action), thunar_launcher_handler_quark); if (G_LIKELY (app_info != NULL)) { + gpointer *skip_update = g_object_get_data (G_OBJECT (action), "skip-update"); + /* try to open the selected files using the given application */ selected_paths = thunar_file_list_to_thunar_g_file_list (launcher->selected_files); - thunar_launcher_open_paths (app_info, selected_paths, launcher); + thunar_launcher_open_paths (app_info, selected_paths, launcher, skip_update != NULL); thunar_g_file_list_free (selected_paths); } else if (launcher->selected_files != NULL) @@ -1772,6 +1789,7 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS /* allocate a new action for the device */ action = gtk_action_new (name, device_name, tooltip, NULL); g_object_set_qdata_full (G_OBJECT (action), thunar_launcher_handler_quark, lp->data, g_object_unref); + g_object_set_data (G_OBJECT (action), "skip-update", GUINT_TO_POINTER (1)); g_signal_connect (G_OBJECT (action), "activate", G_CALLBACK (thunar_launcher_action_sendto_device), launcher); gtk_action_group_add_action (launcher->action_group, action); gtk_ui_manager_add_ui (launcher->ui_manager, launcher->ui_addons_merge_id, @@ -1829,6 +1847,7 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS action = gtk_action_new (name, label, tooltip, NULL); gtk_action_set_gicon (action, g_app_info_get_icon (lp->data)); g_object_set_qdata_full (G_OBJECT (action), thunar_launcher_handler_quark, lp->data, g_object_unref); + g_object_set_data (G_OBJECT (action), "skip-update", GUINT_TO_POINTER (1)); g_signal_connect (G_OBJECT (action), "activate", G_CALLBACK (thunar_launcher_action_open), launcher); gtk_action_group_add_action (launcher->action_group, action); gtk_ui_manager_add_ui (launcher->ui_manager, launcher->ui_addons_merge_id,