]> spindle.queued.net Git - midori/commitdiff
Move app spawning to sokoke_spawn_app and use in MidoriView
authorChristian Dywan <christian@twotoasts.de>
Sun, 10 Oct 2010 11:02:50 +0000 (13:02 +0200)
committerChristian Dywan <christian@twotoasts.de>
Sun, 10 Oct 2010 11:02:50 +0000 (13:02 +0200)
midori/midori-browser.c
midori/midori-view.c
midori/sokoke.c
midori/sokoke.h

index 73cf903e3c7af0026c31a21f023a3090503246b4..b9ed43042834fa2d679d8dfb821bcbb35ed0f17d 100644 (file)
@@ -2133,32 +2133,12 @@ _action_tab_new_activate (GtkAction*     action,
     midori_browser_set_current_page (browser, n);
 }
 
-static void
-midori_browser_spawn_app (const gchar* uri)
-{
-    const gchar* executable = sokoke_get_argv (NULL)[0];
-    /* "midori"
-       "/usr/bin/midori"
-       "c:/Program Files/Midori/bin/midori.exe" */
-    gchar* quoted = g_shell_quote (executable);
-    gchar* command = g_strconcat (quoted, " -a", NULL);
-    g_free (quoted);
-    sokoke_spawn_program (command, uri, FALSE);
-    g_free (command);
-}
-
 static void
 _action_private_browsing_activate (GtkAction*     action,
                                    MidoriBrowser* browser)
 {
     const gchar* uri = midori_browser_get_current_uri (browser);
-    if (uri != NULL)
-    {
-        if (*uri != '\0')
-            midori_browser_spawn_app (uri);
-        else
-            midori_browser_spawn_app ("about:blank");
-    }
+    sokoke_spawn_app (uri && *uri ? uri : "about:blank");
 }
 
 static void
@@ -2761,7 +2741,7 @@ midori_browser_open_bookmark (MidoriBrowser* browser,
         uri_fixed = g_strdup (uri);
 
     if (katze_item_get_meta_boolean (item, "app"))
-        midori_browser_spawn_app (uri_fixed);
+        sokoke_spawn_app (uri_fixed);
     else
     {
         midori_browser_set_current_uri (browser, uri_fixed);
index 4ab5344c0eb0fa263406268fa1545f83f0ec0fe7..cd53bd3529a169b71f8afa014304c7ee0e2ef44a 100644 (file)
@@ -1699,7 +1699,7 @@ static void
 midori_web_view_menu_web_app_activate_cb (GtkWidget*  widget,
                                           MidoriView* view)
 {
-    sokoke_spawn_program ("midori -a", view->link_uri, FALSE);
+    sokoke_spawn_app (view->link_uri);
 }
 
 static void
index caac7f1ab28270fe5bae58709fb938b29c4c4926..02a623ac96c3d14f2e09ab9309332e6e4be0427a 100644 (file)
@@ -484,6 +484,20 @@ sokoke_spawn_program (const gchar* command,
     return TRUE;
 }
 
+void
+sokoke_spawn_app (const gchar* uri)
+{
+    const gchar* executable = sokoke_get_argv (NULL)[0];
+    /* "midori"
+       "/usr/bin/midori"
+       "c:/Program Files/Midori/bin/midori.exe" */
+    gchar* quoted = g_shell_quote (executable);
+    gchar* command = g_strconcat (quoted, " -a", NULL);
+    g_free (quoted);
+    sokoke_spawn_program (command, uri, FALSE);
+    g_free (command);
+}
+
 /**
  * sokoke_hostname_from_uri:
  * @uri: an URI string
index 29a9cfb3e44f1a9e62a11f4499ca4433e9637d10..a5c94be18cb1373b878a27d8a3ec6f300c33b714 100644 (file)
@@ -102,6 +102,9 @@ sokoke_spawn_program                    (const gchar*    command,
                                          const gchar*    argument,
                                          gboolean        quote);
 
+void
+sokoke_spawn_app                        (const gchar*    uri);
+
 gchar* sokoke_search_uri                (const gchar*    uri,
                                          const gchar*    keywords);