[frogr] Fix 'Open in external viewer' for OSX



commit a5569ad6220f8de13005edbeb2125445aa130857
Author: Mario Sanchez Prada <msanchez igalia com>
Date:   Sat Apr 14 13:37:34 2012 +0200

    Fix 'Open in external viewer' for OSX

 src/frogr-util.c |   27 ++++++++++++++-------------
 1 files changed, 14 insertions(+), 13 deletions(-)
---
diff --git a/src/frogr-util.c b/src/frogr-util.c
index bda7bf0..daa92df 100644
--- a/src/frogr-util.c
+++ b/src/frogr-util.c
@@ -146,7 +146,13 @@ _open_uris_with_app_info (GList *uris_list, GAppInfo *app_info)
 
       uris = _get_uris_string_from_list (uris_list);
 
+#ifdef MAC_INTEGRATION
+      /* In MacOSX use 'open' instead of 'gnome-open' */
+      command = g_strdup_printf ("open %s", uris);
+#else
       command = g_strdup_printf ("gnome-open %s", uris);
+#endif
+
       _spawn_command (command);
 
       if (error)
@@ -164,20 +170,16 @@ _open_uris_with_app_info (GList *uris_list, GAppInfo *app_info)
 static void
 _open_uri_for_mac (const gchar *uri)
 {
-  GError *error = NULL;
-  gchar *command = NULL;
+  GList *uris_list = NULL;
 
-  /* In MacOSX use 'open' instead of 'gnome-open' */
-  command = g_strdup_printf ("open %s", uri);
-  _spawn_command (command);
+  /* Early return */
+  if (!uri)
+    return;
 
-  if (error)
-    {
-      DEBUG ("Error opening URI %s: %s", uri, error->message);
-      g_error_free (error);
-    }
+  uris_list = g_list_append (uris_list, g_strdup (uri));
+  _open_uris_with_app_info (uris_list, NULL);
 
-  g_free (command);
+  g_list_free (uris_list);
 }
 #endif
 
@@ -215,8 +217,7 @@ _open_uri_for_gnome (const gchar *uri)
       app_info = help_app_info;
     }
 
-  if (app_info)
-    _open_uris_with_app_info (uris_list, app_info);
+  _open_uris_with_app_info (uris_list, app_info);
 
   g_list_free (uris_list);
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]