]> spindle.queued.net Git - midori/commitdiff
Introduce midori_browser_set_current_page_smartly() as public API
authorAlexander Butenko <a.butenka@gmail.com>
Sat, 3 Jul 2010 07:28:03 +0000 (03:28 -0400)
committerChristian Dywan <christian@twotoasts.de>
Sun, 4 Jul 2010 22:14:06 +0000 (00:14 +0200)
midori/midori-browser.c
midori/midori-browser.h
panels/midori-bookmarks.c
panels/midori-history.c

index ceb3e704b750ebb67ac854a3beccf52326de052f..3f3808b0b71bbdf3663e6848e1d04bbe617c035b 100644 (file)
@@ -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;
         }
index 7129bcc81ae6d76a0715bb26829dc64159636620..7b0d98c0d314cf3bc787dfe36010855a76cd9af8 100644 (file)
@@ -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);
index 0a1e7b360f3f5fb17a5b4536847a098338ff1f83..e27df97ea28a8ece311d8dfb740b3b447740a8d2 100644 (file)
@@ -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);
     }
 }
 
index 83b52b715476b5bd07771109b6186e46d776c4b8..bfe469d79f7550aeb424e5551c99e5d431616f3b 100644 (file)
@@ -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);
         }
     }
 }