Introduce midori_browser_set_current_page_smartly() as public API

This commit is contained in:
Alexander Butenko 2010-07-03 03:28:03 -04:00 committed by Christian Dywan
parent e70bc2cb75
commit 62930be082
4 changed files with 15 additions and 28 deletions

View file

@ -425,9 +425,9 @@ _midori_browser_set_statusbar_text (MidoriBrowser* browser,
} }
} }
static void void
_midori_browser_set_current_page_smartly (MidoriBrowser* browser, midori_browser_set_current_page_smartly (MidoriBrowser* browser,
gint n) gint n)
{ {
if (!katze_object_get_boolean (browser->settings, if (!katze_object_get_boolean (browser->settings,
"open-tabs-in-the-background")) "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)); 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); katze_array_remove_item (browser->trash, item);
_midori_browser_update_actions (browser); _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); g_object_get (browser->settings, "homepage", &homepage, NULL);
n = midori_browser_add_uri (browser, homepage); n = midori_browser_add_uri (browser, homepage);
g_free (homepage); g_free (homepage);
_midori_browser_set_current_page_smartly (browser, n); midori_browser_set_current_page_smartly (browser, n);
return TRUE; return TRUE;
} }
@ -3781,7 +3781,7 @@ midori_browser_bookmark_open_in_tab_activate_cb (GtkWidget* menuitem,
if ((uri = katze_item_get_uri (child)) && *uri) if ((uri = katze_item_get_uri (child)) && *uri)
{ {
n = midori_browser_add_item (browser, child); n = midori_browser_add_item (browser, child);
_midori_browser_set_current_page_smartly (browser, n); midori_browser_set_current_page_smartly (browser, n);
} }
i++; i++;
} }
@ -3791,7 +3791,7 @@ midori_browser_bookmark_open_in_tab_activate_cb (GtkWidget* menuitem,
if ((uri = katze_item_get_uri (item)) && *uri) if ((uri = katze_item_get_uri (item)) && *uri)
{ {
n = midori_browser_add_item (browser, item); 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)) if (katze_item_get_uri (item))
{ {
n = midori_browser_add_uri (browser, 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; return TRUE;
} }

View file

@ -116,6 +116,9 @@ midori_browser_set_current_uri (MidoriBrowser* browser,
const gchar* const gchar*
midori_browser_get_current_uri (MidoriBrowser* browser); midori_browser_get_current_uri (MidoriBrowser* browser);
void
midori_browser_set_current_page_smartly (MidoriBrowser* browser,
gint n);
void void
midori_browser_set_current_page (MidoriBrowser* browser, midori_browser_set_current_page (MidoriBrowser* browser,
gint n); gint n);

View file

@ -666,14 +666,10 @@ midori_bookmarks_open_in_tab_activate_cb (GtkWidget* menuitem,
if ((uri = katze_item_get_uri (child)) && *uri) if ((uri = katze_item_get_uri (child)) && *uri)
{ {
MidoriBrowser* browser; MidoriBrowser* browser;
MidoriWebSettings* settings;
browser = midori_browser_get_for_widget (GTK_WIDGET (bookmarks)); browser = midori_browser_get_for_widget (GTK_WIDGET (bookmarks));
n = midori_browser_add_item (browser, child); n = midori_browser_add_item (browser, child);
settings = katze_object_get_object (browser, "settings"); midori_browser_set_current_page_smartly (browser, n);
if (!katze_object_get_boolean (settings, "open-tabs-in-the-background"))
midori_browser_set_current_page (browser, n);
g_object_unref (settings);
} }
i++; i++;
} }
@ -681,14 +677,10 @@ midori_bookmarks_open_in_tab_activate_cb (GtkWidget* menuitem,
else if ((uri = katze_item_get_uri (item)) && *uri) else if ((uri = katze_item_get_uri (item)) && *uri)
{ {
MidoriBrowser* browser; MidoriBrowser* browser;
MidoriWebSettings* settings;
browser = midori_browser_get_for_widget (GTK_WIDGET (bookmarks)); browser = midori_browser_get_for_widget (GTK_WIDGET (bookmarks));
n = midori_browser_add_item (browser, item); n = midori_browser_add_item (browser, item);
settings = katze_object_get_object (browser, "settings"); midori_browser_set_current_page_smartly (browser, n);
if (!katze_object_get_boolean (settings, "open-tabs-in-the-background"))
midori_browser_set_current_page (browser, n);
g_object_unref (settings);
} }
} }

View file

@ -655,14 +655,10 @@ midori_history_open_in_tab_activate_cb (GtkWidget* menuitem,
if ((uri = katze_item_get_uri (child)) && *uri) if ((uri = katze_item_get_uri (child)) && *uri)
{ {
MidoriBrowser* browser; MidoriBrowser* browser;
MidoriWebSettings* settings;
browser = midori_browser_get_for_widget (GTK_WIDGET (history)); browser = midori_browser_get_for_widget (GTK_WIDGET (history));
n = midori_browser_add_item (browser, child); n = midori_browser_add_item (browser, child);
settings = katze_object_get_object (browser, "settings"); midori_browser_set_current_page_smartly (browser, n);
if (!katze_object_get_boolean (settings, "open-tabs-in-the-background"))
midori_browser_set_current_page (browser, n);
g_object_unref (settings);
} }
} }
} }
@ -671,14 +667,10 @@ midori_history_open_in_tab_activate_cb (GtkWidget* menuitem,
if ((uri = katze_item_get_uri (item)) && *uri) if ((uri = katze_item_get_uri (item)) && *uri)
{ {
MidoriBrowser* browser; MidoriBrowser* browser;
MidoriWebSettings* settings;
browser = midori_browser_get_for_widget (GTK_WIDGET (history)); browser = midori_browser_get_for_widget (GTK_WIDGET (history));
n = midori_browser_add_item (browser, item); n = midori_browser_add_item (browser, item);
settings = katze_object_get_object (browser, "settings"); midori_browser_set_current_page_smartly (browser, n);
if (!katze_object_get_boolean (settings, "open-tabs-in-the-background"))
midori_browser_set_current_page (browser, n);
g_object_unref (settings);
} }
} }
} }