diff --git a/midori/midori-browser.c b/midori/midori-browser.c index 19906888..d3fff69f 100644 --- a/midori/midori-browser.c +++ b/midori/midori-browser.c @@ -190,7 +190,7 @@ midori_bookmarkbar_clear (GtkWidget* toolbar); static void midori_browser_new_history_item (MidoriBrowser* browser, - KatzeItem** item); + KatzeItem* item); static void _midori_browser_set_toolbar_style (MidoriBrowser* browser, @@ -611,25 +611,21 @@ midori_view_notify_title_cb (GtkWidget* widget, if (midori_view_get_load_status (view) == MIDORI_LOAD_COMMITTED) { - KatzeItem* item; KatzeItem* proxy; - if (browser->history && browser->maximum_history_age) { - item = g_object_get_data (G_OBJECT (view), "history-item-added"); proxy = midori_view_get_proxy_item (view); - if (item && katze_item_get_added (item) == katze_item_get_added (proxy)) + if (katze_item_get_uri (proxy) && + (katze_item_get_meta_integer (proxy, "process") == -1)) { - katze_item_set_name (item, katze_item_get_name (proxy)); - midori_browser_update_history_title (browser, item); + midori_browser_new_history_item (browser, proxy); + katze_item_set_meta_integer (proxy, "process", 1); } - else + else if (katze_item_get_name (proxy) && + (katze_item_get_meta_integer (proxy, "process") == 1)) { - katze_object_assign (item, katze_item_copy (proxy)); - midori_browser_new_history_item (browser, &item); - g_object_ref (item); - g_object_set_data_full (G_OBJECT (view), "history-item-added", - item, (GDestroyNotify)g_object_unref); + midori_browser_update_history_title (browser, proxy); + katze_item_set_meta_integer (proxy, "process", 2); } } } @@ -5344,7 +5340,7 @@ midori_browser_realize_cb (GtkStyle* style, static void midori_browser_new_history_item (MidoriBrowser* browser, - KatzeItem** item) + KatzeItem* item) { time_t now; gint64 day; @@ -5352,7 +5348,7 @@ midori_browser_new_history_item (MidoriBrowser* browser, static sqlite3_stmt* stmt = NULL; now = time (NULL); - katze_item_set_added (*item, now); + katze_item_set_added (item, now); day = sokoke_time_t_to_julian (&now); db = g_object_get_data (G_OBJECT (browser->history), "db"); @@ -5363,9 +5359,9 @@ midori_browser_new_history_item (MidoriBrowser* browser, sqlcmd = "INSERT INTO history (uri, title, date, day) VALUES (?,?,?,?)"; sqlite3_prepare_v2 (db, sqlcmd, -1, &stmt, NULL); } - sqlite3_bind_text (stmt, 1, katze_item_get_uri (*item), -1, 0); - sqlite3_bind_text (stmt, 2, katze_item_get_name (*item), -1, 0); - sqlite3_bind_int64 (stmt, 3, katze_item_get_added (*item)); + sqlite3_bind_text (stmt, 1, katze_item_get_uri (item), -1, 0); + sqlite3_bind_text (stmt, 2, katze_item_get_name (item), -1, 0); + sqlite3_bind_int64 (stmt, 3, katze_item_get_added (item)); sqlite3_bind_int64 (stmt, 4, day); if (sqlite3_step (stmt) != SQLITE_DONE) diff --git a/midori/midori-view.c b/midori/midori-view.c index 7ee134ff..c5354b78 100644 --- a/midori/midori-view.c +++ b/midori/midori-view.c @@ -1006,54 +1006,15 @@ webkit_web_view_load_committed_cb (WebKitWebView* web_view, g_return_if_fail (uri != NULL); katze_assign (view->uri, sokoke_format_uri_for_display (uri)); katze_assign (view->icon_uri, NULL); - if (view->item) - { - #if 0 - /* Load back forward history from meta data. WebKit does not seem to - respect the order of items, so the feature is unusable. */ - if (!view->back_forward_set) - { - WebKitWebBackForwardList* list; - gchar* key; - guint i; - const gchar* data; - WebKitWebHistoryItem* item; - list = webkit_web_view_get_back_forward_list (web_view); + /* FIXME: Create a proxy item if we don't have one. + * We should either always create it, or not rely on it */ + if (!view->item) + midori_view_get_proxy_item (view); - key = g_strdup ("back4"); - for (i = 4; i > 0; i--) - { - key[4] = 48 + i; - if ((data = katze_item_get_meta_string (view->item, key))) - { - item = webkit_web_history_item_new_with_data (data, NULL); - webkit_web_back_forward_list_add_item (list, item); - g_object_unref (item); - } - } + katze_item_set_uri (view->item, uri); + katze_item_set_added (view->item, time (NULL)); - #if 0 - key[0] = 'f'; - key[1] = 'o'; - key[2] = 'r'; - key[3] = 'e'; - for (i = 4; i > 0; i--) - { - key[4] = 48 + i; - item = webkit_web_history_item_new_with_data (data, NULL); - webkit_web_back_forward_list_add_item (list, item); - g_object_unref (item); - } - #endif - g_free (key); - view->back_forward_set = TRUE; - } - #endif - - katze_item_set_uri (view->item, uri); - katze_item_set_added (view->item, time (NULL)); - } g_object_notify (G_OBJECT (view), "uri"); g_object_set (view, "title", NULL, NULL); @@ -4396,18 +4357,11 @@ midori_view_item_meta_data_changed (KatzeItem* item, KatzeItem* midori_view_get_proxy_item (MidoriView* view) { - const gchar* uri; - const gchar* title; - g_return_val_if_fail (MIDORI_IS_VIEW (view), NULL); if (!view->item) { view->item = katze_item_new (); - uri = midori_view_get_display_uri (view); - katze_item_set_uri (view->item, uri); - title = midori_view_get_display_title (view); - katze_item_set_name (view->item, title); g_signal_connect (view->item, "meta-data-changed", G_CALLBACK (midori_view_item_meta_data_changed), view); }