static void
midori_browser_new_history_item (MidoriBrowser* browser,
- KatzeItem* item);
+ KatzeItem** item);
static void
_midori_browser_set_toolbar_style (MidoriBrowser* browser,
else
{
katze_object_assign (item, katze_item_copy (proxy));
- midori_browser_new_history_item (browser, g_object_ref (item));
+ 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);
}
static void
midori_browser_new_history_item (MidoriBrowser* browser,
- KatzeItem* item)
+ KatzeItem** item)
{
KatzeArray* parent;
gint i;
gboolean found;
time_t now;
gint64 day;
- gint64 pday;
- gint64 newage;
gchar token[50];
now = time (NULL);
- katze_item_set_added (item, now);
+ katze_item_set_added (*item, now);
day = sokoke_time_t_to_julian (&now);
found = FALSE;
i = 0;
while ((parent = katze_array_get_nth_item (browser->history, i++)))
{
- pday = katze_item_get_added (KATZE_ITEM (parent));
- newage = day - pday;
- if (newage == 0)
+ gint64 pday = katze_item_get_added (KATZE_ITEM (parent));
+ if (day - pday == 0)
{
+ KatzeItem* _item;
+
found = TRUE;
- katze_array_add_item (parent, item);
+ if ((_item = katze_array_find_uri (parent, katze_item_get_uri (*item))))
+ *item = g_object_ref (_item);
+ else
+ katze_array_add_item (parent, *item);
}
}
if (!found)
katze_item_set_added (KATZE_ITEM (parent), day);
katze_item_set_name (KATZE_ITEM (parent), token);
katze_array_add_item (browser->history, parent);
- katze_array_add_item (parent, item);
+ katze_array_add_item (parent, *item);
}
}