[kazehakase-svn] [3556] * src/bookmarks/kz-bookmark.[ch]: Added

Zurück zum Archiv-Index

svnno****@sourc***** svnno****@sourc*****
Sat Jan 24 19:17:27 JST 2009


Revision: 3556
          http://svn.sourceforge.jp/view?root=kazehakase&view=rev&rev=3556
Author:   ikezoe
Date:     2009-01-24 19:17:27 +0900 (Sat, 24 Jan 2009)

Log Message:
-----------
	* src/bookmarks/kz-bookmark.[ch]: Added
	kz_bookmark_get_current_bookmark.c
	* src/kz-tab-label.c: Use kz_bookmark_get_current_bookmark.c

Modified Paths:
--------------
    kazehakase/trunk/ChangeLog
    kazehakase/trunk/src/bookmarks/kz-bookmark.c
    kazehakase/trunk/src/bookmarks/kz-bookmark.h
    kazehakase/trunk/src/kz-tab-label.c

Modified: kazehakase/trunk/ChangeLog
===================================================================
--- kazehakase/trunk/ChangeLog	2009-01-24 10:10:23 UTC (rev 3555)
+++ kazehakase/trunk/ChangeLog	2009-01-24 10:17:27 UTC (rev 3556)
@@ -8,6 +8,9 @@
 	handles favicon internally.
 	* src/kz-tab-label.c: Use KzProfile signal to obtain create_thumbnail
 	flag.
+	* src/bookmarks/kz-bookmark.[ch]: Added
+	kz_bookmark_get_current_bookmark.c
+	* src/kz-tab-label.c: Use kz_bookmark_get_current_bookmark.c
 
 2009-01-23  Hiroyuki Ikezoe  <poinc****@ikezo*****>
 

Modified: kazehakase/trunk/src/bookmarks/kz-bookmark.c
===================================================================
--- kazehakase/trunk/src/bookmarks/kz-bookmark.c	2009-01-24 10:10:23 UTC (rev 3555)
+++ kazehakase/trunk/src/bookmarks/kz-bookmark.c	2009-01-24 10:17:27 UTC (rev 3556)
@@ -1011,6 +1011,21 @@
 			   GUINT_TO_POINTER(pos));
 }
 
+KzBookmark *
+kz_bookmark_get_current_bookmark (KzBookmark *bookmark)
+{
+	GList *children;
+	gpointer *current_bookmark;
+
+	if (!kz_bookmark_is_folder(bookmark))
+		return NULL;
+
+	children = g_object_get_qdata(G_OBJECT(bookmark), children_quark);
+	current_bookmark = g_list_nth_data(children, kz_bookmark_get_current(bookmark));
+
+	return current_bookmark ? KZ_BOOKMARK(current_bookmark) : NULL;
+}
+
 gboolean
 kz_bookmark_get_lock (KzBookmark  *bookmark)
 {

Modified: kazehakase/trunk/src/bookmarks/kz-bookmark.h
===================================================================
--- kazehakase/trunk/src/bookmarks/kz-bookmark.h	2009-01-24 10:10:23 UTC (rev 3555)
+++ kazehakase/trunk/src/bookmarks/kz-bookmark.h	2009-01-24 10:17:27 UTC (rev 3556)
@@ -164,7 +164,8 @@
 void		kz_bookmark_register_sort_func	(const gchar *type,
 						 GCompareFunc *func);
 
-KzBookmark *    kz_bookmark_find_bookmark_from_uri (KzBookmark *bookmark,
+KzBookmark     *kz_bookmark_get_current_bookmark (KzBookmark *bookmark);
+KzBookmark     *kz_bookmark_find_bookmark_from_uri (KzBookmark *bookmark,
 						    const gchar *key_uri);
 G_END_DECLS
 

Modified: kazehakase/trunk/src/kz-tab-label.c
===================================================================
--- kazehakase/trunk/src/kz-tab-label.c	2009-01-24 10:10:23 UTC (rev 3555)
+++ kazehakase/trunk/src/kz-tab-label.c	2009-01-24 10:17:27 UTC (rev 3556)
@@ -880,17 +880,11 @@
 static void
 cb_location_changed (KzEmbed *embed, KzTabLabel *kztab)
 {
-	KzBookmark *bookmark = NULL;
-	guint cur;
-	GList *children;
+	KzBookmark *bookmark;
 
 	g_return_if_fail(KZ_IS_TAB_LABEL(kztab));
 
-	cur = kz_bookmark_get_current(kztab->history);
-	children = kz_bookmark_get_children(kztab->history);
-	bookmark = KZ_BOOKMARK(g_list_nth_data(children, cur));
-	g_list_free(children);
-
+	bookmark = kz_bookmark_get_current_bookmark(kztab->history);
 	if (bookmark)
 		kz_bookmark_set_link(bookmark, kz_embed_get_location(embed));
 }
@@ -927,15 +921,10 @@
 	}
 	else
 	{
-		KzBookmark *bookmark = NULL;
-		guint cur, last_modified, last_visited = 0;
-		GList *children;
+		KzBookmark *bookmark;
+		guint last_modified, last_visited = 0;
 	
-		cur = kz_bookmark_get_current(kztab->history);
-		children = kz_bookmark_get_children(kztab->history);
-		bookmark = KZ_BOOKMARK(g_list_nth_data(children, cur));
-		g_list_free(children);
-
+		bookmark = kz_bookmark_get_current_bookmark(kztab->history);
 		if (bookmark)
 			last_visited = kz_bookmark_get_last_visited(bookmark);
 		last_modified = kz_embed_get_last_modified(embed);
@@ -1173,19 +1162,13 @@
 static void
 kz_tab_label_set_visited (KzTabLabel *kztab)
 {
-	KzBookmark *bookmark = NULL;
+	KzBookmark *bookmark;
 	const gchar *uri;
 	GTimeVal now;
-	guint cur;
-	GList *children;
 	
 	g_get_current_time(&now);
 
-	cur = kz_bookmark_get_current(kztab->history);
-	children = kz_bookmark_get_children(kztab->history);
-	bookmark = KZ_BOOKMARK(g_list_nth_data(children, cur));
-	g_list_free(children);
-
+	bookmark = kz_bookmark_get_current_bookmark(kztab->history);
 	if (bookmark)
 		kz_bookmark_set_last_visited(bookmark, now.tv_sec);
 



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