]> www.fi.muni.cz Git - evince.git/commitdiff
Reuse g_app_info_launch_default_for_uri to save some code and fix bug
authorEmil Soleyman <emil@nishra.com>
Sat, 29 Mar 2008 21:24:55 +0000 (21:24 +0000)
committerNickolay V. Shmyrev <nshmyrev@src.gnome.org>
Sat, 29 Mar 2008 21:24:55 +0000 (21:24 +0000)
2008-03-30  Emil Soleyman  <emil@nishra.com>

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

Reuse g_app_info_launch_default_for_uri to
save some code and fix bug #525009.

svn path=/trunk/; revision=2983

ChangeLog
shell/ev-window.c

index aafbea0d7b20810bcd0af8b89b4cb1addcdac6ea..001f6f9c178856292f566a5c568ce5a08d78aeb1 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2008-03-30  Emil Soleyman  <emil@nishra.com>
+
+       * shell/ev-window.c: (launch_external_uri):
+       
+       Reuse g_app_info_launch_default_for_uri to
+       save some code and fix bug #525009.
+
 2008-03-24  Wouter Bolsterlee  <wbolster@svn.gnome.org>
 
        * shell/ev-window.c (image_save_dialog_response_cb):
@@ -10,7 +17,7 @@
 
        Add a configure option to enable/diable DBus. Patch by RĂ©mi
        Cardona. Fixes bug 521797.
-       
+
 2008-03-22  Carlos Garcia Campos  <carlosgc@gnome.org>
 
        * backend/pdf/ev-poppler.cc: (pdf_document_file_exporter_do_page):
index 5c3b58f1467b0450cd8a019904dadead1b49b861..4cd205a0226933aa5113e60dbfdb08422285ab59 100644 (file)
@@ -4577,29 +4577,11 @@ static void
 launch_external_uri (EvWindow *window, EvLinkAction *action)
 {
        const gchar *uri = ev_link_action_get_uri (action);
-       const char *content_type;
-       GFile *file;
-       GFileInfo *file_info;
-       GAppInfo *app;
-       GList *file_list = NULL;
        GError *error = NULL;
+       gboolean ret;
        
-       file = g_file_new_for_uri (uri);
-       file_info = g_file_query_info (file,
-                                      G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
-                                      0, NULL, NULL);
-       if (file_info == NULL) {
-               g_object_unref (file);
-               return;
-       }
-       
-       content_type = g_file_info_get_content_type (file_info);
-       app = g_app_info_get_default_for_type (content_type, TRUE);
-       g_object_unref (file_info);
-       
-       file_list = g_list_append (file_list, file);
-       
-       if (!g_app_info_launch (app, file_list, NULL, &error)) {
+       ret = g_app_info_launch_default_for_uri (uri, NULL, &error);
+       if (ret == FALSE) {
                GtkWidget *dialog;
        
                dialog = gtk_message_dialog_new (GTK_WINDOW (window),
@@ -4613,11 +4595,8 @@ launch_external_uri (EvWindow *window, EvLinkAction *action)
                                  G_CALLBACK (gtk_widget_destroy),
                                  NULL);
                gtk_widget_show (dialog);
+               g_error_free(error);
        }
-
-       g_object_unref (app);
-       g_object_unref (file);
-       g_list_free (file_list);
 }
 
 static void