From: Alexander Butenko Date: Sat, 3 Jul 2010 07:28:03 +0000 (-0400) Subject: Introduce midori_browser_set_current_page_smartly() as public API X-Git-Url: https://spindle.queued.net/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=62930be0820a17d114fd5cf1de1212ab967228f1;p=midori Introduce midori_browser_set_current_page_smartly() as public API --- diff --git a/midori/midori-browser.c b/midori/midori-browser.c index ceb3e704..3f3808b0 100644 --- a/midori/midori-browser.c +++ b/midori/midori-browser.c @@ -425,9 +425,9 @@ _midori_browser_set_statusbar_text (MidoriBrowser* browser, } } -static void -_midori_browser_set_current_page_smartly (MidoriBrowser* browser, - gint n) +void +midori_browser_set_current_page_smartly (MidoriBrowser* browser, + gint n) { if (!katze_object_get_boolean (browser->settings, "open-tabs-in-the-background")) @@ -2697,7 +2697,7 @@ _action_trash_activate_item_alt (GtkAction* action, n = midori_browser_add_uri (browser, katze_item_get_uri (item)); - _midori_browser_set_current_page_smartly (browser, n); + midori_browser_set_current_page_smartly (browser, n); katze_array_remove_item (browser->trash, item); _midori_browser_update_actions (browser); @@ -3419,7 +3419,7 @@ midori_browser_bookmark_homepage_button_press_cb (GtkToolItem* button, g_object_get (browser->settings, "homepage", &homepage, NULL); n = midori_browser_add_uri (browser, homepage); g_free (homepage); - _midori_browser_set_current_page_smartly (browser, n); + midori_browser_set_current_page_smartly (browser, n); return TRUE; } @@ -3781,7 +3781,7 @@ midori_browser_bookmark_open_in_tab_activate_cb (GtkWidget* menuitem, if ((uri = katze_item_get_uri (child)) && *uri) { n = midori_browser_add_item (browser, child); - _midori_browser_set_current_page_smartly (browser, n); + midori_browser_set_current_page_smartly (browser, n); } i++; } @@ -3791,7 +3791,7 @@ midori_browser_bookmark_open_in_tab_activate_cb (GtkWidget* menuitem, if ((uri = katze_item_get_uri (item)) && *uri) { n = midori_browser_add_item (browser, item); - _midori_browser_set_current_page_smartly (browser, n); + midori_browser_set_current_page_smartly (browser, n); } } } @@ -6234,7 +6234,7 @@ midori_bookmarkbar_item_button_press_event_cb (GtkWidget* toolitem, if (katze_item_get_uri (item)) { n = midori_browser_add_uri (browser, katze_item_get_uri (item)); - _midori_browser_set_current_page_smartly (browser, n); + midori_browser_set_current_page_smartly (browser, n); return TRUE; } diff --git a/midori/midori-browser.h b/midori/midori-browser.h index 7129bcc8..7b0d98c0 100644 --- a/midori/midori-browser.h +++ b/midori/midori-browser.h @@ -116,6 +116,9 @@ midori_browser_set_current_uri (MidoriBrowser* browser, const gchar* midori_browser_get_current_uri (MidoriBrowser* browser); +void +midori_browser_set_current_page_smartly (MidoriBrowser* browser, + gint n); void midori_browser_set_current_page (MidoriBrowser* browser, gint n); diff --git a/panels/midori-bookmarks.c b/panels/midori-bookmarks.c index 0a1e7b36..e27df97e 100644 --- a/panels/midori-bookmarks.c +++ b/panels/midori-bookmarks.c @@ -666,14 +666,10 @@ midori_bookmarks_open_in_tab_activate_cb (GtkWidget* menuitem, if ((uri = katze_item_get_uri (child)) && *uri) { MidoriBrowser* browser; - MidoriWebSettings* settings; browser = midori_browser_get_for_widget (GTK_WIDGET (bookmarks)); n = midori_browser_add_item (browser, child); - settings = katze_object_get_object (browser, "settings"); - if (!katze_object_get_boolean (settings, "open-tabs-in-the-background")) - midori_browser_set_current_page (browser, n); - g_object_unref (settings); + midori_browser_set_current_page_smartly (browser, n); } i++; } @@ -681,14 +677,10 @@ midori_bookmarks_open_in_tab_activate_cb (GtkWidget* menuitem, else if ((uri = katze_item_get_uri (item)) && *uri) { MidoriBrowser* browser; - MidoriWebSettings* settings; browser = midori_browser_get_for_widget (GTK_WIDGET (bookmarks)); n = midori_browser_add_item (browser, item); - settings = katze_object_get_object (browser, "settings"); - if (!katze_object_get_boolean (settings, "open-tabs-in-the-background")) - midori_browser_set_current_page (browser, n); - g_object_unref (settings); + midori_browser_set_current_page_smartly (browser, n); } } diff --git a/panels/midori-history.c b/panels/midori-history.c index 83b52b71..bfe469d7 100644 --- a/panels/midori-history.c +++ b/panels/midori-history.c @@ -655,14 +655,10 @@ midori_history_open_in_tab_activate_cb (GtkWidget* menuitem, if ((uri = katze_item_get_uri (child)) && *uri) { MidoriBrowser* browser; - MidoriWebSettings* settings; browser = midori_browser_get_for_widget (GTK_WIDGET (history)); n = midori_browser_add_item (browser, child); - settings = katze_object_get_object (browser, "settings"); - if (!katze_object_get_boolean (settings, "open-tabs-in-the-background")) - midori_browser_set_current_page (browser, n); - g_object_unref (settings); + midori_browser_set_current_page_smartly (browser, n); } } } @@ -671,14 +667,10 @@ midori_history_open_in_tab_activate_cb (GtkWidget* menuitem, if ((uri = katze_item_get_uri (item)) && *uri) { MidoriBrowser* browser; - MidoriWebSettings* settings; browser = midori_browser_get_for_widget (GTK_WIDGET (history)); n = midori_browser_add_item (browser, item); - settings = katze_object_get_object (browser, "settings"); - if (!katze_object_get_boolean (settings, "open-tabs-in-the-background")) - midori_browser_set_current_page (browser, n); - g_object_unref (settings); + midori_browser_set_current_page_smartly (browser, n); } } }