svnno****@sourc*****
svnno****@sourc*****
Thu Feb 12 13:34:03 JST 2009
Revision: 3634 http://svn.sourceforge.jp/view?root=kazehakase&view=rev&rev=3634 Author: ikezoe Date: 2009-02-12 13:34:03 +0900 (Thu, 12 Feb 2009) Log Message: ----------- * src/kz-window.c, src/kz-xbel.c: Use kz_bookmark_folder_foreach_child. Modified Paths: -------------- kazehakase/trunk/ChangeLog kazehakase/trunk/src/bookmarks/kz-xbel.c kazehakase/trunk/src/kz-window.c Modified: kazehakase/trunk/ChangeLog =================================================================== --- kazehakase/trunk/ChangeLog 2009-02-12 04:21:43 UTC (rev 3633) +++ kazehakase/trunk/ChangeLog 2009-02-12 04:34:03 UTC (rev 3634) @@ -8,6 +8,8 @@ * src/kz-embed.[ch]: The second argument of set_history and get_history now is a KzBookmarkFolder. * src/bookmarks/kz-bookmark.[ch]: Remove KzBookmarkType. + * src/kz-window.c, src/kz-xbel.c: Use + kz_bookmark_folder_foreach_child. 2009-02-11 Hiroyuki Ikezoe <poinc****@ikezo*****> Modified: kazehakase/trunk/src/bookmarks/kz-xbel.c =================================================================== --- kazehakase/trunk/src/bookmarks/kz-xbel.c 2009-02-12 04:21:43 UTC (rev 3633) +++ kazehakase/trunk/src/bookmarks/kz-xbel.c 2009-02-12 04:34:03 UTC (rev 3634) @@ -1183,17 +1183,8 @@ data); /* for children */ - { - GList *node, *children; - - children = kz_bookmark_folder_get_children(KZ_BOOKMARK_FOLDER(bookmark)); - for (node = children; node; node = g_list_next(node)) - { - KzBookmark *child = node->data; - kz_xbel_connect_signals(child, data); - } - g_list_free(children); - } + kz_bookmark_folder_foreach_child(KZ_BOOKMARK_FOLDER(bookmark), + (GFunc)kz_xbel_connect_signals, data); } @@ -1215,17 +1206,8 @@ G_CALLBACK(cb_bookmark_remove_child), data); /* for children */ - { - GList *node, *children; - - children = kz_bookmark_folder_get_children(KZ_BOOKMARK_FOLDER(bookmark)); - for (node = children; node; node = g_list_next(node)) - { - KzBookmark *child = node->data; - kz_xbel_disconnect_signals(child, data); - } - g_list_free(children); - } + kz_bookmark_folder_foreach_child(KZ_BOOKMARK_FOLDER(bookmark), + (GFunc)kz_xbel_disconnect_signals, data); } @@ -1552,6 +1534,11 @@ } #endif +static void +insert_bookmark (KzBookmark *bookmark, KzBookmark *parent) +{ + kz_xbel_insert_xml_node (bookmark, parent, NULL); +} static void kz_xbel_insert_xml_node (KzBookmark *bookmark, @@ -1600,15 +1587,8 @@ if (kz_bookmark_is_folder(bookmark) && !KZ_IS_BOOKMARK_FILE(bookmark)) { - GList *node, *children; - - children = kz_bookmark_folder_get_children(KZ_BOOKMARK_FOLDER(bookmark)); - for (node = children; node; node = g_list_next(node)) - { - KzBookmark *child = node->data; - kz_xbel_insert_xml_node (child, bookmark, NULL); - } - g_list_free(children); + kz_bookmark_folder_foreach_child(KZ_BOOKMARK_FOLDER(bookmark), + (GFunc)insert_bookmark, bookmark); } } @@ -1622,15 +1602,8 @@ if (kz_bookmark_is_folder(bookmark)) { - GList *node, *children; - - children = kz_bookmark_folder_get_children(KZ_BOOKMARK_FOLDER(bookmark)); - for (node = children; node; node = g_list_next(node)) - { - KzBookmark *child = node->data; - kz_xbel_remove_xml_node (child); - } - g_list_free(children); + kz_bookmark_folder_foreach_child(KZ_BOOKMARK_FOLDER(bookmark), + (GFunc)kz_xbel_remove_xml_node, NULL); } node = g_object_get_qdata(G_OBJECT(bookmark), node_quark); Modified: kazehakase/trunk/src/kz-window.c =================================================================== --- kazehakase/trunk/src/kz-window.c 2009-02-12 04:21:43 UTC (rev 3633) +++ kazehakase/trunk/src/kz-window.c 2009-02-12 04:34:03 UTC (rev 3634) @@ -386,25 +386,27 @@ } static void +append_bookmark_bar_widget (KzBookmark *bookmark, KzWindow *kz) +{ + GtkWidget *bar = GTK_WIDGET(kz_bookmark_bar_new(kz, bookmark)); + kz->bookmark_bars = g_list_append(kz->bookmark_bars, bar); +} + +static void kz_window_init (KzWindow *kz) { GtkWidget *menu_box; GtkSettings *setting; - GList *children, *node; GtkSettings *settings; + GList *node; KzWindowPrivate *priv = KZ_WINDOW_GET_PRIVATE(kz); /* init member */ kz->top_vbox = gtk_vbox_new(FALSE, 0); kz->bookmark_bars_area = gtk_vbox_new(FALSE, 0); - children = kz_bookmark_folder_get_children(KZ_BOOKMARK_FOLDER(KZ_GET_BAR_BOOKMARK)); - for (node = children; node; node = g_list_next(node)) - { - GtkWidget *bar = GTK_WIDGET(kz_bookmark_bar_new(kz, node->data)); - kz->bookmark_bars = g_list_append(kz->bookmark_bars, bar); - } - g_list_free(children); + kz_bookmark_folder_foreach_child(KZ_BOOKMARK_FOLDER(KZ_GET_BAR_BOOKMARK), + (GFunc)append_bookmark_bar_widget, kz); kz->statusbar = kz_statusbar_new(kz); kz->notebook = kz_notebook_new(kz);