[frogr/frogr-0.6.x: 1/9] Just use 'open' always for opening URLs in the Mac



commit 9428c119241f74d0d46e709f6e2afc81caa06609
Author: Mario Sanchez Prada <msanchez igalia com>
Date:   Sat Aug 13 01:20:01 2011 +0200

    Just use 'open' always for opening URLs in the Mac

 src/frogr-util.c |   42 +++++++++++++++++++++++++++++++++++-------
 1 files changed, 35 insertions(+), 7 deletions(-)
---
diff --git a/src/frogr-util.c b/src/frogr-util.c
index 4c73ca8..e1fac6f 100644
--- a/src/frogr-util.c
+++ b/src/frogr-util.c
@@ -146,12 +146,7 @@ _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)
@@ -165,8 +160,30 @@ _open_uris_with_app_info (GList *uris_list, GAppInfo *app_info)
     }
 }
 
-void
-frogr_util_open_uri (const gchar *uri)
+#ifdef MAC_INTEGRATION
+static void
+_open_uri_for_mac (const gchar *uri)
+{
+  GError *error = NULL;
+  gchar *command = NULL;
+
+  /* In MacOSX use 'open' instead of 'gnome-open' */
+  command = g_strdup_printf ("open %s", uri);
+  _spawn_command (command);
+
+  if (error)
+    {
+      DEBUG ("Error opening URI %s: %s", uri, error->message);
+      g_error_free (error);
+    }
+
+  g_free (command);
+}
+#endif
+
+#ifndef MAC_INTEGRATION
+static void
+_open_uri_for_gnome (const gchar *uri)
 {
   static GAppInfo *http_app_info = NULL;
   static GAppInfo *help_app_info = NULL;
@@ -203,6 +220,17 @@ frogr_util_open_uri (const gchar *uri)
 
   g_list_free (uris_list);
 }
+#endif
+
+void
+frogr_util_open_uri (const gchar *uri)
+{
+#ifdef MAC_INTEGRATION
+  _open_uri_for_mac (uri);
+#else
+  _open_uri_for_gnome (uri);
+#endif
+}
 
 void
 frogr_util_open_images_in_viewer (GList *uris_list)



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