svnno****@sourc*****
svnno****@sourc*****
Wed Feb 4 12:12:09 JST 2009
Revision: 3610 http://svn.sourceforge.jp/view?root=kazehakase&view=rev&rev=3610 Author: ikezoe Date: 2009-02-04 12:12:09 +0900 (Wed, 04 Feb 2009) Log Message: ----------- * module/embed/ie/kz-ie.c: Now set_history has begun to work. Modified Paths: -------------- kazehakase/trunk/ChangeLog kazehakase/trunk/module/embed/ie/kz-ie.c Modified: kazehakase/trunk/ChangeLog =================================================================== --- kazehakase/trunk/ChangeLog 2009-02-04 02:38:57 UTC (rev 3609) +++ kazehakase/trunk/ChangeLog 2009-02-04 03:12:09 UTC (rev 3610) @@ -15,6 +15,7 @@ * module/embed/webkit-gtk/kz-webkit-gtk.c (copy_page): The current item passed to webkit_web_view_go_to_back_forward_item should be an item obtained from its parent web view. + * module/embed/ie/kz-ie.c: Now set_history has begun to work. 2009-02-03 Hiroyuki Ikezoe <poinc****@ikezo*****> Modified: kazehakase/trunk/module/embed/ie/kz-ie.c =================================================================== --- kazehakase/trunk/module/embed/ie/kz-ie.c 2009-02-04 02:38:57 UTC (rev 3609) +++ kazehakase/trunk/module/embed/ie/kz-ie.c 2009-02-04 03:12:09 UTC (rev 3610) @@ -123,15 +123,8 @@ KzBookmark *history); static void set_history (KzEmbed *kzembed, KzBookmark *history); - static void copy_page (KzEmbed *src_embed, - KzEmbed *dest_embed, - KzEmbedCopyType type); -static gboolean shistory_copy (KzEmbed *src_embed, - KzEmbed *dest_embed, - gboolean back_history, - gboolean forward_history, - gboolean set_current); + KzEmbed *dest_embed); static gboolean shistory_get_pos (KzEmbed *kzembed, gint *pos, gint *count); @@ -257,7 +250,6 @@ iface->selection_is_collapsed = NULL; iface->get_links = NULL; iface->copy_page = copy_page; - iface->shistory_copy = shistory_copy; iface->shistory_get_pos = shistory_get_pos; iface->shistory_get_nth = shistory_get_nth; iface->reload = kz_ie_reload; @@ -884,6 +876,13 @@ } static void +history_list_free (GList *list) +{ + g_list_foreach(list, (GFunc)g_object_unref, NULL); + g_list_free(list); +} + +static void get_history (KzEmbed *kzembed, KzBookmark *history) { GList *children, *bookmark_node; @@ -911,9 +910,9 @@ if (children) g_list_free(children); if (backward_history) - g_list_free(backward_history); + history_list_free(backward_history); if (forward_history) - g_list_free(forward_history); + history_list_free(forward_history); kz_bookmark_set_current(history, current_position); } @@ -925,7 +924,7 @@ GList *history_item_list = NULL; children = kz_bookmark_get_children(history); - if (children) + if (!children) return NULL; for (node = children; node; node = g_list_next(node)) @@ -938,7 +937,6 @@ history_item_list = g_list_append(history_item_list, item); } - g_list_free(children); return history_item_list; @@ -958,48 +956,32 @@ gtk_ie_embed_set_whole_history(GTK_IE_EMBED(kzembed), history_item_list, current_position); - g_list_foreach(history_item_list, (GFunc)g_object_unref, NULL); - g_list_free(history_item_list); + history_list_free(history_item_list); } static void -copy_page (KzEmbed *src_embed, KzEmbed *dest_embed, KzEmbedCopyType type) +copy_page (KzEmbed *src_embed, KzEmbed *dest_embed) { - gtk_ie_embed_load_url(GTK_IE_EMBED(dest_embed), - KZ_IE_GET_PRIVATE(src_embed)->location); -} + GList *backward_history_list, *forward_history_list; + GList *history_list = NULL; + GtkIEEmbedHistoryItem *current_item; + gint current_position; + GtkIEEmbed *src_ie = GTK_IE_EMBED(src_embed); -static gboolean -shistory_copy (KzEmbed *src_embed, KzEmbed *dest_embed, - gboolean back_history, gboolean forward_history, - gboolean set_current) -{ - GList *backward_history_list, *forward_history_list; + backward_history_list = gtk_ie_embed_get_backward_history(src_ie); + forward_history_list = gtk_ie_embed_get_forward_history(src_ie); + current_item = gtk_ie_embed_get_history_item_at_relative_position(src_ie, 0); + current_position = backward_history_list ? g_list_length(backward_history_list) : 0; - if (back_history) - { - backward_history_list = gtk_ie_embed_get_backward_history(GTK_IE_EMBED(src_embed)); - gtk_ie_embed_set_backward_history(GTK_IE_EMBED(dest_embed), backward_history_list); - if (backward_history_list) - g_list_free(backward_history_list); - } + if (current_item) + history_list = g_list_append(backward_history_list, current_item); + history_list = g_list_concat(history_list, forward_history_list); - copy_page(src_embed, dest_embed, KZ_EMBED_COPY_NORMAL); - - if (forward_history) - { - forward_history_list = gtk_ie_embed_get_forward_history(GTK_IE_EMBED(src_embed)); - gtk_ie_embed_set_forward_history(GTK_IE_EMBED(dest_embed), forward_history_list); - if (forward_history_list) - g_list_free(forward_history_list); - } - - if (set_current) - { - /* FIXME */ - } - - return TRUE; + gtk_ie_embed_set_whole_history(GTK_IE_EMBED(dest_embed), + history_list, current_position + 1); + history_list_free(history_list); + if (current_item) + g_object_unref(current_item); } static gboolean