From ba9d7d48e58b6e117062e38d4a2b9c6838a55b90 Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Sun, 22 Feb 2009 13:52:04 +0100 Subject: [PATCH] Fix browser properties along with enabling the property test --- midori/midori-browser.c | 25 +++++++++++++++++++------ tests/properties.c | 5 +++-- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/midori/midori-browser.c b/midori/midori-browser.c index 0e491acf..b488052c 100644 --- a/midori/midori-browser.c +++ b/midori/midori-browser.c @@ -551,7 +551,7 @@ midori_browser_edit_bookmark_dialog_new (MidoriBrowser* browser, view = midori_browser_get_current_tab (browser); if (is_folder) { - bookmark = katze_array_new (KATZE_TYPE_ARRAY); + bookmark = (KatzeItem*)katze_array_new (KATZE_TYPE_ARRAY); katze_item_set_name (bookmark, midori_view_get_display_title (MIDORI_VIEW (view))); } @@ -1161,7 +1161,7 @@ midori_browser_class_init (MidoriBrowserClass* class) "uri", "URI", "The current URI", - "about:blank", + "", G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, @@ -4191,6 +4191,16 @@ midori_browser_get_property (GObject* object, case PROP_TAB: g_value_set_object (value, midori_browser_get_current_tab (browser)); break; + case PROP_LOAD_STATUS: + { + GtkWidget* view = midori_browser_get_current_tab (browser); + if (view) + g_value_set_enum (value, + midori_view_get_load_status (MIDORI_VIEW (view))); + else + g_value_set_enum (value, MIDORI_LOAD_FINISHED); + break; + } case PROP_STATUSBAR: g_value_set_object (value, browser->statusbar); break; @@ -4372,8 +4382,10 @@ midori_browser_set_current_uri (MidoriBrowser* browser, g_return_if_fail (MIDORI_IS_BROWSER (browser)); g_return_if_fail (uri != NULL); - view = midori_browser_get_current_tab (browser); - midori_view_set_uri (MIDORI_VIEW (view), uri); + if ((view = midori_browser_get_current_tab (browser))) + midori_view_set_uri (MIDORI_VIEW (view), uri); + else + midori_browser_add_uri (browser, uri); } /** @@ -4393,8 +4405,9 @@ midori_browser_get_current_uri (MidoriBrowser* browser) g_return_val_if_fail (MIDORI_IS_BROWSER (browser), NULL); - view = midori_browser_get_current_tab (browser); - return midori_view_get_display_uri (MIDORI_VIEW (view)); + if ((view = midori_browser_get_current_tab (browser))) + return midori_view_get_display_uri (MIDORI_VIEW (view)); + return NULL; } /** diff --git a/tests/properties.c b/tests/properties.c index 6866ce41..79a711d1 100644 --- a/tests/properties.c +++ b/tests/properties.c @@ -131,11 +131,12 @@ main (int argc, if (!g_thread_supported ()) g_thread_init (NULL); g_test_init (&argc, &argv, NULL); gtk_init_check (&argc, &argv); + sokoke_register_stock_items (); g_test_add_data_func ("/properties/app", (gconstpointer)MIDORI_TYPE_APP, properties_type_test); - /* g_test_add_data_func ("/properties/browser", - (gconstpointer)MIDORI_TYPE_BROWSER, properties_type_test); */ + g_test_add_data_func ("/properties/browser", + (gconstpointer)MIDORI_TYPE_BROWSER, properties_type_test); g_test_add_data_func ("/properties/extension", (gconstpointer)MIDORI_TYPE_EXTENSION, properties_type_test); g_test_add_data_func ("/properties/location-action", -- 2.39.5