]> spindle.queued.net Git - midori/commitdiff
Switch to already open tab of external URI if possible
authorChristian Dywan <christian@twotoasts.de>
Wed, 21 Sep 2011 22:26:49 +0000 (00:26 +0200)
committerChristian Dywan <christian@twotoasts.de>
Wed, 21 Sep 2011 22:26:49 +0000 (00:26 +0200)
midori/midori-app.c

index bb9b5b654325316edf0f8b1f63fbfda9de26aa5c..26b81ce1a669fe86389dc03d0ab30760c6190dea 100644 (file)
@@ -500,8 +500,25 @@ midori_app_command_received (MidoriApp*   app,
                         first = FALSE;
                     }
                     else
-                        midori_browser_set_current_page (browser,
-                            midori_browser_add_uri (browser, fixed_uri));
+                    {
+                        /* Switch to already open tab if possible */
+                        guint i = 0;
+                        GtkWidget* tab;
+                        gboolean found = FALSE;
+                        while ((tab = midori_browser_get_nth_tab (browser, i++)))
+                            if (g_str_equal (
+                                midori_view_get_display_uri (MIDORI_VIEW (tab)),
+                                fixed_uri))
+                            {
+                                found = TRUE;
+                                break;
+                            }
+                        if (found)
+                            midori_browser_set_current_tab (browser, tab);
+                        else
+                            midori_browser_set_current_page (browser,
+                                midori_browser_add_uri (browser, fixed_uri));
+                    }
                 }
                 g_free (fixed_uri);
                 uris++;