]> www.fi.muni.cz Git - evince.git/commitdiff
Fix launching external applications for launch actions which seems to be
authorCarlos Garcia Campos <carlosgc@gnome.org>
Sat, 4 Oct 2008 17:20:23 +0000 (17:20 +0000)
committerCarlos Garcia Campos <carlosgc@src.gnome.org>
Sat, 4 Oct 2008 17:20:23 +0000 (17:20 +0000)
2008-10-04  Carlos Garcia Campos  <carlosgc@gnome.org>

* shell/ev-window.c: (launch_action):

Fix launching external applications for launch actions which seems
to be broken since the gio port. Fixes bug #554500.

svn path=/trunk/; revision=3213

ChangeLog
shell/ev-window.c

index 6a2ae61b0078d1ad854af1cc1346f3d28553bc9f..76bbcb7f25212690d62686e09d218753a4a828ec 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2008-10-04  Carlos Garcia Campos  <carlosgc@gnome.org>
+
+       * shell/ev-window.c: (launch_action):
+
+       Fix launching external applications for launch actions which seems
+       to be broken since the gio port. Fixes bug #554500.
+       
 2008-09-28  Carlos Garcia Campos  <carlosgc@gnome.org>
 
        * backend/dvi/Makefile.am:
index fc8cc8dc2ba3838002b529af113903e9fbc0517a..75120ba89646189fd8facd2358d521fe01c8e935 100644 (file)
@@ -4833,12 +4833,11 @@ static void
 launch_action (EvWindow *window, EvLinkAction *action)
 {
        const char *filename = ev_link_action_get_filename (action);
-       const char *content_type;
        GAppInfo *app_info;
-       GFileInfo *file_info;
        GFile *file;
-       GList *file_list = NULL;
-       
+       GList file_list = {NULL};
+       GError *error = NULL;
+
        if (filename == NULL)
                return;
 
@@ -4846,34 +4845,35 @@ launch_action (EvWindow *window, EvLinkAction *action)
                file = g_file_new_for_path (filename);
        } else {
                GFile *base_file;
+               gchar *dir;
+
+               dir = g_path_get_dirname (window->priv->uri);
+               base_file = g_file_new_for_uri (dir);
+               g_free (dir);
                
-               base_file = g_file_new_for_uri (window->priv->uri);
-               file = g_file_resolve_relative_path (base_file,
-                                                    filename);
-               
+               file = g_file_resolve_relative_path (base_file, filename);
                g_object_unref (base_file);
        }
-       
-       file_info = g_file_query_info (file,
-                                      G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
-                                      0, NULL, NULL);
-       if (file_info == NULL) {
+
+       app_info = g_file_query_default_handler (file, NULL, &error);
+       if (!app_info) {
+               /* FIXME: use ev_window_error_message */
+               g_warning ("%s", error->message);
                g_object_unref (file);
+
                return;
        }
        
-       content_type = g_file_info_get_content_type (file_info);
-       app_info = g_app_info_get_default_for_type (content_type, TRUE);
-       
-       file_list = g_list_append (file_list, file);
+       file_list.data = file;
 
        /* FIXME: should we use a GAppLaunchContext? */
-       g_app_info_launch (app_info, file_list,
-                          NULL, NULL);
+       if (!g_app_info_launch (app_info, &file_list, NULL, &error)) {
+               /* FIXME: use ev_window_error_message */
+               g_warning ("%s", error->message);
+               g_error_free (error);
+       }
        
-       g_list_free (file_list);
        g_object_unref (app_info);
-       g_object_unref (file_info);
        g_object_unref (file);
 
        /* According to the PDF spec filename can be an executable. I'm not sure