[kazehakase-svn] [3645] * src/bookmarks/kz-bookmark-bar.c: Use KzBookmarkFolder methods.

Zurück zum Archiv-Index

svnno****@sourc***** svnno****@sourc*****
Thu Feb 12 14:52:49 JST 2009


Revision: 3645
          http://svn.sourceforge.jp/view?root=kazehakase&view=rev&rev=3645
Author:   ikezoe
Date:     2009-02-12 14:52:49 +0900 (Thu, 12 Feb 2009)

Log Message:
-----------
	* src/bookmarks/kz-bookmark-bar.c: Use KzBookmarkFolder methods.

Modified Paths:
--------------
    kazehakase/trunk/ChangeLog
    kazehakase/trunk/src/bookmarks/kz-bookmark-bar.c

Modified: kazehakase/trunk/ChangeLog
===================================================================
--- kazehakase/trunk/ChangeLog	2009-02-12 05:47:56 UTC (rev 3644)
+++ kazehakase/trunk/ChangeLog	2009-02-12 05:52:49 UTC (rev 3645)
@@ -24,6 +24,7 @@
 	child of KzBookmark.
 	* src/bookmarks/kz-bookmark-folder.c (kz_bookmark_folder_remove): Do
 	not unref child before signal emission.
+	* src/bookmarks/kz-bookmark-bar.c: Use KzBookmarkFolder methods.
 
 2009-02-11  Hiroyuki Ikezoe  <poinc****@ikezo*****>
 

Modified: kazehakase/trunk/src/bookmarks/kz-bookmark-bar.c
===================================================================
--- kazehakase/trunk/src/bookmarks/kz-bookmark-bar.c	2009-02-12 05:47:56 UTC (rev 3644)
+++ kazehakase/trunk/src/bookmarks/kz-bookmark-bar.c	2009-02-12 05:52:49 UTC (rev 3645)
@@ -338,26 +338,24 @@
 	gtk_container_remove(GTK_CONTAINER(child->parent), child);
 }
 
+static void
+insert_tool_item (KzBookmark *bookmark, KzBookmarkBar *bar)
+{
+	GtkToolItem *toolitem;
+	
+	toolitem = create_tool_item(bar, bookmark);
+	gtk_toolbar_insert(GTK_TOOLBAR(bar->toolbar),
+			   toolitem, -1);
+}
 
 static void
 kz_bookmark_bar_refresh_all (KzBookmarkBar *bar)
 {
-	GList *children, *node;
-
 	gtk_container_foreach (GTK_CONTAINER (GTK_TOOLBAR(bar->toolbar)),
 			       remove_item, NULL);
 
-	children = kz_bookmark_folder_get_children(KZ_BOOKMARK_FOLDER(bar->folder));
-	for (node = children; node; node = g_list_next(node))
-	{
-		GtkToolItem *toolitem;
-		KzBookmark *bookmark = node->data;
-		
-		toolitem = create_tool_item(bar, bookmark);
-		gtk_toolbar_insert(GTK_TOOLBAR(bar->toolbar),
-				   toolitem, -1);
-	}
-	g_list_free(children);
+	kz_bookmark_folder_foreach_child(KZ_BOOKMARK_FOLDER(bar->folder),
+					 (GFunc)insert_tool_item, bar);
 
 	gtk_widget_queue_resize(GTK_WIDGET(bar));
 }
@@ -404,7 +402,6 @@
 	KzBookmarkBar *bar;
 	KzBookmark *bookmark = NULL, *sibling, *parent;
 	GtkWidget *src_widget;
-	GList *children;
 	gint index;
 	gboolean moved = FALSE, success = FALSE;
 
@@ -412,9 +409,7 @@
 	index = gtk_toolbar_get_drop_index(GTK_TOOLBAR(bar->toolbar),
 					   x, y);
 
-	children = kz_bookmark_folder_get_children(KZ_BOOKMARK_FOLDER(bar->folder));
-	sibling = g_list_nth_data(children, index);
-	g_list_free(children);
+	sibling = kz_bookmark_folder_get_nth_child(KZ_BOOKMARK_FOLDER(bar->folder), index);
 
 	switch (info)
 	{
@@ -547,18 +542,13 @@
 				KzBookmarkBar *bar)
 {
 	gint index = -1;
-	GList *children;
 	GtkToolItem *toolitem;
 	
 	g_return_if_fail(KZ_IS_BOOKMARK(child));
 	g_return_if_fail(KZ_IS_BOOKMARK_BAR(bar));
 
 	if (sibling)
-	{
-		children = kz_bookmark_folder_get_children(KZ_BOOKMARK_FOLDER(folder));
-		index = g_list_index(children, sibling); 
-		g_list_free(children);
-	}
+		index = kz_bookmark_folder_get_child_index(KZ_BOOKMARK_FOLDER(folder), sibling);
 
 	toolitem = create_tool_item(bar, child);
 	
@@ -573,17 +563,13 @@
 				KzBookmarkBar *bar)
 {
 	gint index;
-	GList *children;
 	GtkToolItem *toolitem;
 
 	g_return_if_fail(KZ_IS_BOOKMARK(child));
 	g_return_if_fail(KZ_IS_BOOKMARK_BAR(bar));
 
-	children = kz_bookmark_folder_get_children(KZ_BOOKMARK_FOLDER(folder));
-	index = g_list_index(children, child); 
-	g_list_free(children);
-
-	if (index == -1) return;
+	index = kz_bookmark_folder_get_child_index(KZ_BOOKMARK_FOLDER(folder), child);
+	if (index < 0) return;
 	
 	toolitem = gtk_toolbar_get_nth_item(GTK_TOOLBAR(bar->toolbar),
 					    index);




More information about the Kazehakase-cvs mailing list
Zurück zum Archiv-Index