]> spindle.queued.net Git - midori/commitdiff
Open all links in the current tab if Open new pages in: Current Tab is set
authorChristian Dywan <christian@twotoasts.de>
Tue, 10 Nov 2009 19:04:48 +0000 (20:04 +0100)
committerChristian Dywan <christian@twotoasts.de>
Tue, 10 Nov 2009 21:01:54 +0000 (22:01 +0100)
There is a small flaw in that we also open all windows opened by scripts
in the current tab and we don't treat popup windows specially.

midori/midori-browser.c
midori/midori-view.c

index 347eecdf8a1203ed0254568a8042a81b694d027e..08da67b1bbaf9cb205d7b82bfc42611e2e709dde 100644 (file)
@@ -1221,7 +1221,7 @@ midori_view_new_view_cb (GtkWidget*     view,
         midori_browser_add_tab (new_browser, new_view);
         midori_browser_set_current_tab (new_browser, new_view);
     }
-    else
+    else if (gtk_widget_get_parent (new_view) != browser->notebook)
     {
         gint n = midori_browser_add_tab (browser, new_view);
         if (where != MIDORI_NEW_VIEW_BACKGROUND)
index e05b8bc05358bbf5a0b662116f38b0a3ba3d86c0..d2419e36cc328f0883bc654f0435eca6a18c3c56 100644 (file)
@@ -2062,6 +2062,12 @@ webkit_web_view_web_view_ready_cb (GtkWidget*  web_view,
 {
     GtkWidget* new_view = gtk_widget_get_parent (web_view);
     MidoriNewView where = MIDORI_NEW_VIEW_TAB;
+
+    /* FIXME: Open windows opened by scripts in tabs if they otherwise
+        would be replacing the page the user opened. */
+    if (view->open_new_pages_in == MIDORI_NEW_PAGE_CURRENT)
+        return TRUE;
+
     if (view->open_new_pages_in == MIDORI_NEW_PAGE_TAB)
     {
         if (view->open_tabs_in_the_background)
@@ -2071,13 +2077,7 @@ webkit_web_view_web_view_ready_cb (GtkWidget*  web_view,
         where = MIDORI_NEW_VIEW_WINDOW;
 
     gtk_widget_show (new_view);
-    if (view->open_new_pages_in == MIDORI_NEW_PAGE_CURRENT)
-    {
-        g_debug ("Opening all pages in current tab not implemented");
-        g_signal_emit (view, signals[NEW_VIEW], 0, new_view, where);
-    }
-    else
-        g_signal_emit (view, signals[NEW_VIEW], 0, new_view, where);
+    g_signal_emit (view, signals[NEW_VIEW], 0, new_view, where);
 
     return TRUE;
 }
@@ -2087,14 +2087,21 @@ webkit_web_view_create_web_view_cb (GtkWidget*      web_view,
                                     WebKitWebFrame* web_frame,
                                     MidoriView*     view)
 {
-    GtkWidget* new_view = g_object_new (MIDORI_TYPE_VIEW,
-        "net", view->net,
-        "settings", view->settings,
-        NULL);
-    midori_view_construct_web_view (MIDORI_VIEW (new_view));
-    g_signal_connect (MIDORI_VIEW (new_view)->web_view, "web-view-ready",
-      G_CALLBACK (webkit_web_view_web_view_ready_cb), view);
-    return MIDORI_VIEW (new_view)->web_view;
+    MidoriView* new_view;
+
+    if (view->open_new_pages_in == MIDORI_NEW_PAGE_CURRENT)
+        new_view = view;
+    else
+    {
+        new_view = g_object_new (MIDORI_TYPE_VIEW,
+            "net", view->net,
+            "settings", view->settings,
+            NULL);
+        midori_view_construct_web_view (new_view);
+        g_signal_connect (new_view->web_view, "web-view-ready",
+                          G_CALLBACK (webkit_web_view_web_view_ready_cb), view);
+    }
+    return new_view->web_view;
 }
 
 static gboolean