[kazehakase-svn] [3666] * src/bookmarks/kz-bookmark.[ch], src/bookmarks/ kz-bookmark-file.[ch],

Zurück zum Archiv-Index

svnno****@sourc***** svnno****@sourc*****
Fri Feb 13 12:12:39 JST 2009


Revision: 3666
          http://svn.sourceforge.jp/view?root=kazehakase&view=rev&rev=3666
Author:   ikezoe
Date:     2009-02-13 12:12:39 +0900 (Fri, 13 Feb 2009)

Log Message:
-----------
	* src/bookmarks/kz-bookmark.[ch], src/bookmarks/kz-bookmark-file.[ch],
	src/bookmarks/kz-bookmark-menu-item.c, src/bookmarks/kz-rss.c,
	src/actions/kz-actions.c, src/kz-navi.c:
	kz_bookmark_(set|get)_document_title ->
	kz_bookmark_file_(set|get)_document_title.

Modified Paths:
--------------
    kazehakase/trunk/ChangeLog
    kazehakase/trunk/src/actions/kz-actions.c
    kazehakase/trunk/src/bookmarks/kz-bookmark-file.c
    kazehakase/trunk/src/bookmarks/kz-bookmark-file.h
    kazehakase/trunk/src/bookmarks/kz-bookmark-menu-item.c
    kazehakase/trunk/src/bookmarks/kz-bookmark.c
    kazehakase/trunk/src/bookmarks/kz-bookmark.h
    kazehakase/trunk/src/bookmarks/kz-rss.c
    kazehakase/trunk/src/kz-navi.c
    kazehakase/trunk/test/test-bookmark-file.c
    kazehakase/trunk/test/test-bookmark.c

Modified: kazehakase/trunk/ChangeLog
===================================================================
--- kazehakase/trunk/ChangeLog	2009-02-13 01:49:42 UTC (rev 3665)
+++ kazehakase/trunk/ChangeLog	2009-02-13 03:12:39 UTC (rev 3666)
@@ -16,6 +16,11 @@
 	src/bookmarks/kz-root-bookmark.c, src/bookmarks/kz-ns-bookmark.c,
 	src/bookmarks/kz-xbel.c, src/kz-embed.c src/kz-window.c:
 	kz_bookmark_folder_new() now needs its title.
+	* src/bookmarks/kz-bookmark.[ch], src/bookmarks/kz-bookmark-file.[ch],
+	src/bookmarks/kz-bookmark-menu-item.c, src/bookmarks/kz-rss.c,
+	src/actions/kz-actions.c, src/kz-navi.c:
+	kz_bookmark_(set|get)_document_title ->
+	kz_bookmark_file_(set|get)_document_title.
 
 2009-02-12  Hiroyuki Ikezoe  <poinc****@ikezo*****>
 

Modified: kazehakase/trunk/src/actions/kz-actions.c
===================================================================
--- kazehakase/trunk/src/actions/kz-actions.c	2009-02-13 01:49:42 UTC (rev 3665)
+++ kazehakase/trunk/src/actions/kz-actions.c	2009-02-13 03:12:39 UTC (rev 3666)
@@ -1126,7 +1126,6 @@
 {
 	KzBookmark *folder, *bookmark;
 	KzBookmark *file;
-	const gchar *id;
 	gboolean has_xmlrpc;
 
 	g_return_if_fail(KZ_IS_WINDOW(kz));
@@ -1137,7 +1136,6 @@
 	folder = kz_bookmark_get_parent(bookmark);
 	g_return_if_fail(KZ_IS_BOOKMARK(folder));
 
-	id = kz_bookmark_get_id(bookmark);
 	if (KZ_IS_BOOKMARK_FILE(folder))
 		file = folder;
 	else

Modified: kazehakase/trunk/src/bookmarks/kz-bookmark-file.c
===================================================================
--- kazehakase/trunk/src/bookmarks/kz-bookmark-file.c	2009-02-13 01:49:42 UTC (rev 3665)
+++ kazehakase/trunk/src/bookmarks/kz-bookmark-file.c	2009-02-13 03:12:39 UTC (rev 3666)
@@ -53,6 +53,7 @@
 
 enum {
 	PROP_0,
+	PROP_DOCUMENT_TITLE,
 	PROP_BOOKMARK_FILE_LOCATION,
 	PROP_FILE_TYPE,
 	PROP_INTERVAL,
@@ -102,6 +103,7 @@
 
 static GList *file_types = NULL;
 
+static GQuark document_title_quark    = 0;
 static GQuark location_quark          = 0;
 static GQuark file_type_quark         = 0;
 static GQuark interval_quark          = 0;
@@ -145,6 +147,16 @@
 
 	g_object_class_install_property(
 		object_class,
+		 PROP_DOCUMENT_TITLE,
+		 g_param_spec_string(
+			 "document-title",
+			 _("Original document title"),
+			 _("The original document title of the link"),
+			 NULL,
+			 G_PARAM_READWRITE));
+
+	g_object_class_install_property(
+		object_class,
 		 PROP_BOOKMARK_FILE_LOCATION,
 		 g_param_spec_string(
 			 "location",
@@ -285,6 +297,7 @@
 			       g_cclosure_marshal_VOID__VOID,
 			       G_TYPE_NONE, 0);
 
+	document_title_quark  = g_quark_from_string("KzBookmarkFile::DocumentTitle");
 	location_quark        = g_quark_from_string("KzBookmarkFile::BookmarkFileLocation");
 	file_type_quark       = g_quark_from_string("KzBookmarkFile::FileType");
 	interval_quark        = g_quark_from_string("KzBookmarkFile::Interval");
@@ -358,6 +371,10 @@
 	KzBookmarkFile *bookmark_file = KZ_BOOKMARK_FILE(object);
 
 	switch (prop_id) {
+	case PROP_DOCUMENT_TITLE:
+		CHANGE_STR(object, document_title_quark,
+			   g_value_dup_string(value));
+		break;
 	case PROP_BOOKMARK_FILE_LOCATION:
 	{
 		CHANGE_STR(object, location_quark,
@@ -453,6 +470,10 @@
 	gchar *str;
 
 	switch (prop_id) {
+	case PROP_DOCUMENT_TITLE:
+		str = g_object_get_qdata(object, document_title_quark);
+		g_value_set_string(value, str);
+		break;
 	case PROP_BOOKMARK_FILE_LOCATION:
 		str = g_object_get_qdata(object, location_quark);
 		g_value_set_string(value, str);
@@ -557,6 +578,14 @@
 
 
 const gchar *
+kz_bookmark_file_get_document_title (KzBookmarkFile *bookmark_file)
+{
+	g_return_val_if_fail(KZ_IS_BOOKMARK_FILE(bookmark_file), NULL);
+	return g_object_get_qdata(G_OBJECT(bookmark_file), document_title_quark);
+}
+
+
+const gchar *
 kz_bookmark_file_get_location (KzBookmarkFile *bookmark_file)
 {
 	g_return_val_if_fail(KZ_IS_BOOKMARK_FILE(bookmark_file), NULL);
@@ -628,6 +657,15 @@
 
 
 void
+kz_bookmark_file_set_document_title (KzBookmarkFile *bookmark_file,
+				     const gchar *document_title)
+{
+	g_return_if_fail(KZ_IS_BOOKMARK_FILE(bookmark_file));
+	g_object_set(bookmark_file, "document-title", document_title, NULL);
+}
+
+
+void
 kz_bookmark_file_set_location (KzBookmarkFile *bookmark_file,
 			       const gchar *location)
 {

Modified: kazehakase/trunk/src/bookmarks/kz-bookmark-file.h
===================================================================
--- kazehakase/trunk/src/bookmarks/kz-bookmark-file.h	2009-02-13 01:49:42 UTC (rev 3665)
+++ kazehakase/trunk/src/bookmarks/kz-bookmark-file.h	2009-02-13 03:12:39 UTC (rev 3666)
@@ -105,6 +105,8 @@
 /*
  * "location" means location of bookmark_file file itself.
  */
+const gchar    *kz_bookmark_file_get_document_title
+						(KzBookmarkFile  *bookmark_file);
 const gchar    *kz_bookmark_file_get_location	(KzBookmarkFile  *bookmark_file);
 const gchar    *kz_bookmark_file_get_file_type	(KzBookmarkFile  *bookmark_file);
 const gchar    *kz_bookmark_file_get_xmlrpc	(KzBookmarkFile  *bookmark_file);
@@ -113,6 +115,9 @@
 guint		kz_bookmark_file_get_interval   (KzBookmarkFile  *bookmark_file);
 gboolean        kz_bookmark_file_is_editable    (KzBookmarkFile  *bookmark_file);
 
+void		kz_bookmark_file_set_document_title
+						(KzBookmarkFile  *bookmark_file,
+						 const gchar 	 *document_title);
 void		kz_bookmark_file_set_location	(KzBookmarkFile  *bookmark_file,
 						 const gchar     *location);
 void		kz_bookmark_file_set_file_type	(KzBookmarkFile  *bookmark_file,

Modified: kazehakase/trunk/src/bookmarks/kz-bookmark-menu-item.c
===================================================================
--- kazehakase/trunk/src/bookmarks/kz-bookmark-menu-item.c	2009-02-13 01:49:42 UTC (rev 3665)
+++ kazehakase/trunk/src/bookmarks/kz-bookmark-menu-item.c	2009-02-13 03:12:39 UTC (rev 3666)
@@ -89,8 +89,8 @@
 
 	bookmark = parent->bookmark;
 #if 1
-	if (kz_bookmark_is_folder(bookmark))
-		title = kz_bookmark_get_document_title(bookmark);
+	if (KZ_IS_BOOKMARK_FILE(bookmark))
+		title = kz_bookmark_file_get_document_title(KZ_BOOKMARK_FILE(bookmark));
 	if (!title || !* title)
 		title = kz_bookmark_get_title(bookmark);
 	if (!title)

Modified: kazehakase/trunk/src/bookmarks/kz-bookmark.c
===================================================================
--- kazehakase/trunk/src/bookmarks/kz-bookmark.c	2009-02-13 01:49:42 UTC (rev 3665)
+++ kazehakase/trunk/src/bookmarks/kz-bookmark.c	2009-02-13 03:12:39 UTC (rev 3666)
@@ -37,7 +37,6 @@
 enum {
 	PROP_0,
 	PROP_TITLE,
-	PROP_DOC_TITLE,
 	PROP_ID,
 	PROP_LINK,
 	PROP_DESCRIPTION,
@@ -60,7 +59,6 @@
 
 static GQuark id_quark                = 0;
 static GQuark title_quark             = 0;
-static GQuark doc_title_quark         = 0;
 static GQuark link_quark              = 0;
 static GQuark description_quark       = 0;
 static GQuark last_mod_quark          = 0;
@@ -104,16 +102,6 @@
 
 	g_object_class_install_property(
 		object_class,
-		 PROP_DOC_TITLE,
-		 g_param_spec_string(
-			 "document-title",
-			 _("Original document title"),
-			 _("The original document title of the link"),
-			 NULL,
-			 G_PARAM_READWRITE));
-
-	g_object_class_install_property(
-		object_class,
 		 PROP_LINK,
 		 g_param_spec_string(
 			 "link",
@@ -181,7 +169,6 @@
 
 	id_quark           = g_quark_from_string("KzBookmark::ID");
 	title_quark        = g_quark_from_string("KzBookmark::Title");
-	doc_title_quark    = g_quark_from_string("KzBookmark::DocumentTitle");
 	link_quark         = g_quark_from_string("KzBookmark::Link");
 	description_quark  = g_quark_from_string("KzBookmark::Description");
 	last_mod_quark     = g_quark_from_string("KzBookmark::LastModified");
@@ -220,10 +207,6 @@
 	case PROP_TITLE:
 		kz_bookmark_set_title(bookmark, g_value_get_string(value));
 		break;
-	case PROP_DOC_TITLE:
-		g_return_if_fail(!kz_bookmark_is_separator(bookmark));
-		kz_bookmark_set_document_title(bookmark, g_value_get_string(value));
-		break;
 	case PROP_LINK:
 		g_return_if_fail(!kz_bookmark_is_separator(bookmark));
 		kz_bookmark_set_link(bookmark, g_value_get_string(value));
@@ -269,10 +252,6 @@
 		str = g_object_get_qdata(object, title_quark);
 		g_value_set_string(value, str);
 		break;
-	case PROP_DOC_TITLE:
-		str = g_object_get_qdata(object, doc_title_quark);
-		g_value_set_string(value, str);
-		break;
 	case PROP_LINK:
 		str = g_object_get_qdata(object, link_quark);
 		g_value_set_string(value, str);
@@ -344,14 +323,6 @@
 
 
 const gchar *
-kz_bookmark_get_document_title (KzBookmark *bookmark)
-{
-	g_return_val_if_fail(KZ_IS_BOOKMARK(bookmark), NULL);
-	return g_object_get_qdata(G_OBJECT(bookmark), doc_title_quark);
-}
-
-
-const gchar *
 kz_bookmark_get_link (KzBookmark *bookmark)
 {
 	g_return_val_if_fail(KZ_IS_BOOKMARK(bookmark), NULL);
@@ -436,16 +407,6 @@
 
 
 void
-kz_bookmark_set_document_title (KzBookmark *bookmark,
-				const gchar *doc_title)
-{
-	g_return_if_fail(KZ_IS_BOOKMARK(bookmark));
-	CHANGE_STR(bookmark, doc_title_quark, doc_title);
-	g_object_notify(G_OBJECT(bookmark), "document-title");
-}
-
-
-void
 kz_bookmark_set_link (KzBookmark *bookmark,
 		      const gchar *uri)
 {

Modified: kazehakase/trunk/src/bookmarks/kz-bookmark.h
===================================================================
--- kazehakase/trunk/src/bookmarks/kz-bookmark.h	2009-02-13 01:49:42 UTC (rev 3665)
+++ kazehakase/trunk/src/bookmarks/kz-bookmark.h	2009-02-13 03:12:39 UTC (rev 3666)
@@ -61,12 +61,10 @@
 /*
  * "ID" is md5sum of URI of the parent bookmark file + ":" + ID
  * "title" means user defined title.
- * "document_title" is the original document title.
  */
 const gchar    *kz_bookmark_get_id		(KzBookmark  *bookmark);
 const gchar    *kz_bookmark_get_link		(KzBookmark  *bookmark);
 const gchar    *kz_bookmark_get_title		(KzBookmark  *bookmark);
-const gchar    *kz_bookmark_get_document_title	(KzBookmark  *bookmark);
 const gchar    *kz_bookmark_get_description	(KzBookmark  *bookmark);
 guint		kz_bookmark_get_last_modified	(KzBookmark  *bookmark);
 guint		kz_bookmark_get_last_visited	(KzBookmark  *bookmark);
@@ -79,8 +77,6 @@
 						 const gchar *uri);
 void		kz_bookmark_set_title		(KzBookmark  *bookmark,
 						 const gchar *title);
-void		kz_bookmark_set_document_title	(KzBookmark  *bookmark,
-						 const gchar *doc_title);
 void		kz_bookmark_set_description	(KzBookmark  *bookmark,
 						 const gchar *description);
 void		kz_bookmark_set_last_modified	(KzBookmark  *bookmark,

Modified: kazehakase/trunk/src/bookmarks/kz-rss.c
===================================================================
--- kazehakase/trunk/src/bookmarks/kz-rss.c	2009-02-13 01:49:42 UTC (rev 3665)
+++ kazehakase/trunk/src/bookmarks/kz-rss.c	2009-02-13 03:12:39 UTC (rev 3666)
@@ -31,6 +31,7 @@
 #include <string.h>
 #include <stdlib.h>
 #include <time.h>
+#include "kz-bookmark-file.h"
 
 static gboolean kz_rss_is_supported      (KzBookmarkFile *bookmark,
 					  const gchar    *buffer);
@@ -202,7 +203,7 @@
 		if (kz_xml_node_name_is(node, "title"))
 		{
 			gchar *title = kz_xml_node_to_str(node);
-			kz_bookmark_set_document_title(bookmark, title);
+			kz_bookmark_file_set_document_title(KZ_BOOKMARK_FILE(bookmark), title);
 			g_free(title);
 		}
 		else if (kz_xml_node_name_is(node, "link"))

Modified: kazehakase/trunk/src/kz-navi.c
===================================================================
--- kazehakase/trunk/src/kz-navi.c	2009-02-13 01:49:42 UTC (rev 3665)
+++ kazehakase/trunk/src/kz-navi.c	2009-02-13 03:12:39 UTC (rev 3666)
@@ -88,7 +88,7 @@
 {
 	const gchar *title;
 
-	title = kz_bookmark_get_document_title(bookmark);
+	title = kz_bookmark_file_get_document_title(KZ_BOOKMARK_FILE(bookmark));
 
 	if(title == NULL || *title == '\0')
 	{

Modified: kazehakase/trunk/test/test-bookmark-file.c
===================================================================
--- kazehakase/trunk/test/test-bookmark-file.c	2009-02-13 01:49:42 UTC (rev 3665)
+++ kazehakase/trunk/test/test-bookmark-file.c	2009-02-13 03:12:39 UTC (rev 3666)
@@ -5,6 +5,7 @@
 
 void test_new (void);
 void test_file_type (void);
+void test_document_title (void);
 void test_location (void);
 void test_interval (void);
 void test_xmlrpc_address (void);
@@ -64,6 +65,15 @@
 }
 
 void
+test_document_title (void)
+{
+    cut_trace(test_new());
+    cut_assert_null(kz_bookmark_file_get_document_title(file));
+    kz_bookmark_file_set_document_title(file, "12345");
+    cut_assert_equal_string("12345", kz_bookmark_file_get_document_title(file));
+}
+
+void
 test_location (void)
 {
     cut_trace(test_new());

Modified: kazehakase/trunk/test/test-bookmark.c
===================================================================
--- kazehakase/trunk/test/test-bookmark.c	2009-02-13 01:49:42 UTC (rev 3665)
+++ kazehakase/trunk/test/test-bookmark.c	2009-02-13 03:12:39 UTC (rev 3666)
@@ -8,7 +8,6 @@
 void test_title (void);
 void test_id (void);
 void test_description (void);
-void test_document_title (void);
 void test_last_modified (void);
 void test_added_time (void);
 void test_last_visited (void);
@@ -64,15 +63,6 @@
 }
 
 void
-test_document_title (void)
-{
-    cut_trace(test_new_with_attrs());
-    cut_assert_null(kz_bookmark_get_document_title(bookmark));
-    kz_bookmark_set_document_title(bookmark, "12345");
-    cut_assert_equal_string("12345", kz_bookmark_get_document_title(bookmark));
-}
-
-void
 test_last_modified (void)
 {
     cut_trace(test_new_with_attrs());




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