[Xfce4-commits] [xfce/thunar] 02/05: Remember the last used application when opening files
noreply at xfce.org
noreply at xfce.org
Tue May 12 20:52:18 CEST 2015
This is an automated email from the git hooks/post-receive script.
hjudt pushed a commit to branch master
in repository xfce/thunar.
commit 5df98970639d472733910a391ddf186497bf8d03
Author: Harald Judt <h.judt at gmx.at>
Date: Tue May 12 17:41:09 2015 +0200
Remember the last used application when opening files
Remembering the last used application will move it to the top of the
list of alternatives.
---
thunar/thunar-gio-extensions.c | 28 +++++++++++++++++++++++++---
1 file changed, 25 insertions(+), 3 deletions(-)
diff --git a/thunar/thunar-gio-extensions.c b/thunar/thunar-gio-extensions.c
index 69b110d..d365d20 100644
--- a/thunar/thunar-gio-extensions.c
+++ b/thunar/thunar-gio-extensions.c
@@ -526,9 +526,12 @@ thunar_g_app_info_launch (GAppInfo *info,
GAppLaunchContext *context,
GError **error)
{
- gboolean result = FALSE;
- gchar *new_path = NULL;
- gchar *old_path = NULL;
+ ThunarFile *file;
+ GList *lp;
+ const gchar *content_type;
+ gboolean result = FALSE;
+ gchar *new_path = NULL;
+ gchar *old_path = NULL;
_thunar_return_val_if_fail (G_IS_APP_INFO (info), FALSE);
_thunar_return_val_if_fail (working_directory == NULL || G_IS_FILE (working_directory), FALSE);
@@ -554,6 +557,25 @@ thunar_g_app_info_launch (GAppInfo *info,
/* launch the paths with the specified app info */
result = g_app_info_launch (info, path_list, context, error);
+ /* if successful, remember the application as last used for the file types */
+ if (result == TRUE)
+ {
+ for (lp = path_list; lp != NULL; lp = lp->next)
+ {
+ file = thunar_file_get (lp->data, NULL);
+ if (file != NULL)
+ {
+ content_type = thunar_file_get_content_type (file);
+
+ /* emit "changed" on the file if we successfully changed the last used application */
+ if (g_app_info_set_as_last_used_for_type (info, content_type, NULL))
+ thunar_file_changed (file);
+
+ g_object_unref (file);
+ }
+ }
+ }
+
/* check if we need to reset the working directory to the one Thunar was
* opened from */
if (old_path != NULL)
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list