[Xfce4-commits] <midori:master> Rebase browser_set_current_tab on _set_current_page

Christian Dywan noreply at xfce.org
Fri Dec 9 22:24:01 CET 2011


Updating branch refs/heads/master
         to a57850e533deec401120c6851af3ea4cee22875b (commit)
       from 9c11fb1219414c457f3c73ffc316af25ae0e94d9 (commit)

commit a57850e533deec401120c6851af3ea4cee22875b
Author: Christian Dywan <christian at twotoasts.de>
Date:   Fri Dec 9 21:11:01 2011 +0100

    Rebase browser_set_current_tab on _set_current_page
    
    The behavior should really match.

 midori/midori-browser.c |   22 ++++++++--------------
 1 files changed, 8 insertions(+), 14 deletions(-)

diff --git a/midori/midori-browser.c b/midori/midori-browser.c
index 6581138..5117d6f 100644
--- a/midori/midori-browser.c
+++ b/midori/midori-browser.c
@@ -7315,20 +7315,23 @@ void
 midori_browser_set_current_page (MidoriBrowser* browser,
                                  gint           n)
 {
-    gint n_pages;
     GtkWidget* view;
 
     g_return_if_fail (MIDORI_IS_BROWSER (browser));
 
-    n_pages = gtk_notebook_get_n_pages (GTK_NOTEBOOK (browser->notebook));
-    g_return_if_fail (n < n_pages);
+    view = gtk_notebook_get_nth_page (GTK_NOTEBOOK (browser->notebook), n);
+    g_return_if_fail (view != NULL);
 
     gtk_notebook_set_current_page (GTK_NOTEBOOK (browser->notebook), n);
-    view = gtk_notebook_get_nth_page (GTK_NOTEBOOK (browser->notebook), n);
     if (midori_view_is_blank (MIDORI_VIEW (view)))
         gtk_action_activate (_action_by_name (browser, "Location"));
     else
         gtk_widget_grab_focus (view);
+
+    g_object_freeze_notify (G_OBJECT (browser));
+    g_object_notify (G_OBJECT (browser), "uri");
+    g_object_notify (G_OBJECT (browser), "tab");
+    g_object_thaw_notify (G_OBJECT (browser));
 }
 
 /**
@@ -7392,16 +7395,7 @@ midori_browser_set_current_tab (MidoriBrowser* browser,
     g_return_if_fail (GTK_IS_WIDGET (view));
 
     n = gtk_notebook_page_num (GTK_NOTEBOOK (browser->notebook), view);
-    gtk_notebook_set_current_page (GTK_NOTEBOOK (browser->notebook), n);
-    if (midori_view_is_blank (MIDORI_VIEW (view)))
-        gtk_action_activate (_action_by_name (browser, "Location"));
-    else
-        gtk_widget_grab_focus (view);
-
-    g_object_freeze_notify (G_OBJECT (browser));
-    g_object_notify (G_OBJECT (browser), "uri");
-    g_object_notify (G_OBJECT (browser), "tab");
-    g_object_thaw_notify (G_OBJECT (browser));
+    midori_browser_set_current_page (browser, n);
 }
 
 /**


More information about the Xfce4-commits mailing list