[Xfce4-commits] <midori:master> Move app spawning to sokoke_spawn_app and use in MidoriView

Christian Dywan noreply at xfce.org
Sun Oct 10 14:02:01 CEST 2010


Updating branch refs/heads/master
         to 120c5bf40f09263d5578ba591c8aafa421af5608 (commit)
       from 0344792c2f534094891f5b1c369b17b132acd1cc (commit)

commit 120c5bf40f09263d5578ba591c8aafa421af5608
Author: Christian Dywan <christian at twotoasts.de>
Date:   Sun Oct 10 13:02:50 2010 +0200

    Move app spawning to sokoke_spawn_app and use in MidoriView

 midori/midori-browser.c |   24 ++----------------------
 midori/midori-view.c    |    2 +-
 midori/sokoke.c         |   14 ++++++++++++++
 midori/sokoke.h         |    3 +++
 4 files changed, 20 insertions(+), 23 deletions(-)

diff --git a/midori/midori-browser.c b/midori/midori-browser.c
index 73cf903..b9ed430 100644
--- a/midori/midori-browser.c
+++ b/midori/midori-browser.c
@@ -2134,31 +2134,11 @@ _action_tab_new_activate (GtkAction*     action,
 }
 
 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);
diff --git a/midori/midori-view.c b/midori/midori-view.c
index 4ab5344..cd53bd3 100644
--- a/midori/midori-view.c
+++ b/midori/midori-view.c
@@ -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
diff --git a/midori/sokoke.c b/midori/sokoke.c
index caac7f1..02a623a 100644
--- a/midori/sokoke.c
+++ b/midori/sokoke.c
@@ -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
diff --git a/midori/sokoke.h b/midori/sokoke.h
index 29a9cfb..a5c94be 100644
--- a/midori/sokoke.h
+++ b/midori/sokoke.h
@@ -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);
 



More information about the Xfce4-commits mailing list