svnno****@sourc*****
svnno****@sourc*****
Sun Feb 15 12:52:37 JST 2009
Revision: 3699 http://svn.sourceforge.jp/view?root=kazehakase&view=rev&rev=3699 Author: ikezoe Date: 2009-02-15 12:52:37 +0900 (Sun, 15 Feb 2009) Log Message: ----------- * src/bookmarks/kz-bookmark.[ch]: kz_bookmark_get_parent returns KzBookmarkFolder and kz_bookmark_set_parent needs a KzBookmarkFolder. Modified Paths: -------------- kazehakase/trunk/ChangeLog kazehakase/trunk/src/actions/kz-actions.c kazehakase/trunk/src/actions/kz-smart-bookmark-action.c kazehakase/trunk/src/bookmarks/kz-actions-bookmark.c kazehakase/trunk/src/bookmarks/kz-bookmark-bar.c kazehakase/trunk/src/bookmarks/kz-bookmark-folder.c kazehakase/trunk/src/bookmarks/kz-bookmark-item.c kazehakase/trunk/src/bookmarks/kz-bookmark.c kazehakase/trunk/src/bookmarks/kz-bookmark.h kazehakase/trunk/src/bookmarks/kz-bookmarks-view.c kazehakase/trunk/src/kz-navi.c Modified: kazehakase/trunk/ChangeLog =================================================================== --- kazehakase/trunk/ChangeLog 2009-02-15 03:18:55 UTC (rev 3698) +++ kazehakase/trunk/ChangeLog 2009-02-15 03:52:37 UTC (rev 3699) @@ -9,6 +9,8 @@ etc/kz-ui-expert.xml.in: Switch layout engine. SwitchLayoutEngine is now created on building time. It should be created at run time. * src/bookmarks/kz-bookmark-objects.h: Added. + * src/bookmarks/kz-bookmark.[ch]: kz_bookmark_get_parent returns + KzBookmarkFolder and kz_bookmark_set_parent needs a KzBookmarkFolder. 2009-02-14 Hiroyuki Ikezoe <poinc****@ikezo*****> Modified: kazehakase/trunk/src/actions/kz-actions.c =================================================================== --- kazehakase/trunk/src/actions/kz-actions.c 2009-02-15 03:18:55 UTC (rev 3698) +++ kazehakase/trunk/src/actions/kz-actions.c 2009-02-15 03:52:37 UTC (rev 3699) @@ -1030,8 +1030,9 @@ static void act_add_bookmark (GtkAction *action, KzWindow *kz) { - KzBookmark *folder, *bookmark, *sibling = NULL; + KzBookmark *bookmark, *sibling = NULL; KzBookmark *file; + KzBookmark *folder; KzEmbed *embed; const gchar *title, *uri; gchar *desc; @@ -1041,11 +1042,11 @@ folder = kz_actions_get_bookmark_for_action(kz); g_return_if_fail(KZ_IS_BOOKMARK(folder)); - if (!kz_bookmark_is_folder(folder)) + if (!KZ_IS_BOOKMARK_FOLDER(folder)) { sibling = folder; - folder = kz_bookmark_get_parent(folder); - g_return_if_fail(KZ_IS_BOOKMARK(folder)); + folder = KZ_BOOKMARK(kz_bookmark_get_parent(folder)); + g_return_if_fail(KZ_IS_BOOKMARK_FOLDER(folder)); } embed = KZ_WINDOW_CURRENT_EMBED(kz); @@ -1113,7 +1114,7 @@ bookmark = kz_actions_get_bookmark_for_action(kz); g_return_if_fail(KZ_IS_BOOKMARK(bookmark)); - folder = kz_bookmark_get_parent(bookmark); + folder = KZ_BOOKMARK(kz_bookmark_get_parent(bookmark)); g_return_if_fail(KZ_IS_BOOKMARK(folder)); if (KZ_IS_BOOKMARK_FILE(folder)) Modified: kazehakase/trunk/src/actions/kz-smart-bookmark-action.c =================================================================== --- kazehakase/trunk/src/actions/kz-smart-bookmark-action.c 2009-02-15 03:18:55 UTC (rev 3698) +++ kazehakase/trunk/src/actions/kz-smart-bookmark-action.c 2009-02-15 03:52:37 UTC (rev 3699) @@ -690,7 +690,8 @@ static void cb_menuitem_activate (GtkWidget *menuitem, KzSmartBookmarkAction *action) { - KzBookmark *parent, *bookmark; + KzBookmark *bookmark; + KzBookmarkFolder *parent; bookmark = g_object_get_data(G_OBJECT(menuitem), KZ_SMART_BOOKMARK_ACTION_BOOKMARK_KEY); @@ -718,13 +719,13 @@ /* remove bookmark */ g_object_ref(bookmark); - kz_bookmark_folder_remove(KZ_BOOKMARK_FOLDER(parent), bookmark); + kz_bookmark_folder_remove(parent, bookmark); /* insert bookmark */ - kz_bookmark_folder_prepend(KZ_BOOKMARK_FOLDER(parent), bookmark); + kz_bookmark_folder_prepend(parent, bookmark); /* now, current bookmark is top of the parent */ - kz_bookmark_folder_set_current_position(KZ_BOOKMARK_FOLDER(parent), + kz_bookmark_folder_set_current_position(parent, g_list_index(action->menulist, parent)); g_object_unref(bookmark); Modified: kazehakase/trunk/src/bookmarks/kz-actions-bookmark.c =================================================================== --- kazehakase/trunk/src/bookmarks/kz-actions-bookmark.c 2009-02-15 03:18:55 UTC (rev 3698) +++ kazehakase/trunk/src/bookmarks/kz-actions-bookmark.c 2009-02-15 03:52:37 UTC (rev 3699) @@ -78,8 +78,8 @@ static void insert_bookmark_item (KzBookmarkEditor *editor, KzBookmark *bookmark) { - KzBookmark *parent, *sibling = NULL; - KzBookmark *file; + KzBookmarkFolder *parent; + KzBookmark *file, *sibling = NULL; GList *list; g_return_if_fail(KZ_IS_BOOKMARK_EDITOR(editor)); @@ -94,22 +94,22 @@ } else { - parent = editor->current_folder; + parent = KZ_BOOKMARK_FOLDER(editor->current_folder); g_return_if_fail(KZ_IS_BOOKMARK(parent)); sibling = NULL; } - kz_bookmark_folder_insert_before(KZ_BOOKMARK_FOLDER(parent), bookmark, sibling); + kz_bookmark_folder_insert_before(parent, bookmark, sibling); if (KZ_IS_BOOKMARK_FILE(parent)) - file = parent; + file = KZ_BOOKMARK(parent); else - file = kz_bookmark_get_parent_file(parent); + file = kz_bookmark_get_parent_file(KZ_BOOKMARK(parent)); if (kz_bookmark_file_has_xmlrpc(KZ_BOOKMARK_FILE(file))) { kz_bookmark_file_xmlrpc_insert(KZ_BOOKMARK_FILE(file), - parent, + KZ_BOOKMARK(parent), sibling, bookmark); } @@ -392,7 +392,7 @@ static void act_go_up (GtkAction *action, KzBookmarkEditor *editor) { - KzBookmark *parent; + KzBookmarkFolder *parent; g_return_if_fail(GTK_IS_ACTION(action)); g_return_if_fail(KZ_IS_BOOKMARK_EDITOR(editor)); @@ -402,7 +402,7 @@ parent = kz_bookmark_get_parent(editor->current_folder); if (!parent) return; - kz_bookmark_editor_set_current(editor, parent); + kz_bookmark_editor_set_current(editor, KZ_BOOKMARK(parent)); } Modified: kazehakase/trunk/src/bookmarks/kz-bookmark-bar.c =================================================================== --- kazehakase/trunk/src/bookmarks/kz-bookmark-bar.c 2009-02-15 03:18:55 UTC (rev 3698) +++ kazehakase/trunk/src/bookmarks/kz-bookmark-bar.c 2009-02-15 03:52:37 UTC (rev 3699) @@ -400,7 +400,8 @@ guint time) { KzBookmarkBar *bar; - KzBookmark *bookmark = NULL, *sibling, *parent; + KzBookmark *bookmark = NULL, *sibling; + KzBookmarkFolder *parent; GtkWidget *src_widget; gint index; gboolean moved = FALSE, success = FALSE; @@ -441,7 +442,7 @@ g_object_ref(bookmark); parent = kz_bookmark_get_parent(bookmark); - kz_bookmark_folder_remove(KZ_BOOKMARK_FOLDER(parent), bookmark); + kz_bookmark_folder_remove(parent, bookmark); moved = TRUE; break; case TARGET_NETSCAPE_URL: Modified: kazehakase/trunk/src/bookmarks/kz-bookmark-folder.c =================================================================== --- kazehakase/trunk/src/bookmarks/kz-bookmark-folder.c 2009-02-15 03:18:55 UTC (rev 3698) +++ kazehakase/trunk/src/bookmarks/kz-bookmark-folder.c 2009-02-15 03:52:37 UTC (rev 3699) @@ -309,7 +309,7 @@ g_object_ref(child); priv->children = g_list_insert_before(priv->children, next, child); - kz_bookmark_set_parent(child, KZ_BOOKMARK(folder)); + kz_bookmark_set_parent(child, folder); g_signal_emit(folder, signals[INSERT_CHILD_SIGNAL], 0, child, sibling); } @@ -333,7 +333,7 @@ g_object_ref(child); priv->children = g_list_prepend(priv->children, child); - kz_bookmark_set_parent(child, KZ_BOOKMARK(folder)); + kz_bookmark_set_parent(child, folder); g_signal_emit(folder, signals[INSERT_CHILD_SIGNAL], 0, child, NULL); } Modified: kazehakase/trunk/src/bookmarks/kz-bookmark-item.c =================================================================== --- kazehakase/trunk/src/bookmarks/kz-bookmark-item.c 2009-02-15 03:18:55 UTC (rev 3698) +++ kazehakase/trunk/src/bookmarks/kz-bookmark-item.c 2009-02-15 03:52:37 UTC (rev 3699) @@ -661,7 +661,8 @@ gpointer data) { KzBookmarkItem *item; - KzBookmark *bookmark = NULL, *parent, *file; + KzBookmark *bookmark = NULL, *file; + KzBookmarkFolder *parent; GtkWidget *src_widget; gboolean success = FALSE, moved = FALSE; @@ -690,7 +691,7 @@ bookmark = KZ_BOOKMARK_ITEM(src_widget)->bookmark; g_object_ref(bookmark); parent = kz_bookmark_get_parent(bookmark); - kz_bookmark_folder_remove(KZ_BOOKMARK_FOLDER(parent), bookmark); + kz_bookmark_folder_remove(parent, bookmark); moved = TRUE; break; case TARGET_NETSCAPE_URL: Modified: kazehakase/trunk/src/bookmarks/kz-bookmark.c =================================================================== --- kazehakase/trunk/src/bookmarks/kz-bookmark.c 2009-02-15 03:18:55 UTC (rev 3698) +++ kazehakase/trunk/src/bookmarks/kz-bookmark.c 2009-02-15 03:52:37 UTC (rev 3699) @@ -455,7 +455,7 @@ g_object_notify(G_OBJECT(bookmark), "added-time"); } -KzBookmark * +KzBookmarkFolder * kz_bookmark_get_parent (KzBookmark *bookmark) { g_return_val_if_fail(KZ_IS_BOOKMARK(bookmark), NULL); @@ -464,9 +464,9 @@ } void -kz_bookmark_set_parent (KzBookmark *bookmark, KzBookmark *parent) +kz_bookmark_set_parent (KzBookmark *bookmark, KzBookmarkFolder *parent) { - g_return_if_fail(KZ_IS_BOOKMARK(bookmark)); + g_return_if_fail(KZ_IS_BOOKMARK_FOLDER(bookmark)); g_object_set_qdata(G_OBJECT(bookmark), parent_quark, parent); } @@ -474,16 +474,20 @@ KzBookmark * kz_bookmark_get_parent_file (KzBookmark *bookmark) { - KzBookmark *parent = bookmark; + KzBookmark *child = bookmark; + KzBookmarkFolder *parent; g_return_val_if_fail(KZ_IS_BOOKMARK(bookmark), NULL); - do + while (TRUE) { - parent = kz_bookmark_get_parent(parent); - if (KZ_IS_BOOKMARK(parent) && KZ_IS_BOOKMARK_FILE(parent)) - return parent; - } while (parent); + parent = kz_bookmark_get_parent(child); + if (!parent) + return NULL; + if (KZ_IS_BOOKMARK_FILE(parent)) + return KZ_BOOKMARK(parent); + child = KZ_BOOKMARK(parent); + } return NULL; } @@ -491,7 +495,7 @@ KzBookmark * kz_bookmark_next (KzBookmark *bookmark) { - KzBookmark *parent; + KzBookmarkFolder *parent; GList *children, *node; g_return_val_if_fail(KZ_IS_BOOKMARK(bookmark), NULL); @@ -499,7 +503,7 @@ parent = kz_bookmark_get_parent(bookmark); if (!parent) return NULL; - children = kz_bookmark_folder_get_children(KZ_BOOKMARK_FOLDER(parent)); + children = kz_bookmark_folder_get_children(parent); node = g_list_find(children, bookmark); if (node && (node = g_list_next(node))) return node->data; @@ -511,7 +515,7 @@ KzBookmark * kz_bookmark_prev (KzBookmark *bookmark) { - KzBookmark *parent; + KzBookmarkFolder *parent; GList *children, *node; g_return_val_if_fail(KZ_IS_BOOKMARK(bookmark), NULL); @@ -519,7 +523,7 @@ parent = kz_bookmark_get_parent(bookmark); if (!parent) return NULL; - children = kz_bookmark_folder_get_children(KZ_BOOKMARK_FOLDER(parent)); + children = kz_bookmark_folder_get_children(parent); node = g_list_find(children, bookmark); if (node && (node = g_list_previous(node))) return node->data; Modified: kazehakase/trunk/src/bookmarks/kz-bookmark.h =================================================================== --- kazehakase/trunk/src/bookmarks/kz-bookmark.h 2009-02-15 03:18:55 UTC (rev 3698) +++ kazehakase/trunk/src/bookmarks/kz-bookmark.h 2009-02-15 03:52:37 UTC (rev 3699) @@ -90,10 +90,10 @@ /* folder interface */ #define kz_bookmark_is_folder KZ_IS_BOOKMARK_FOLDER -KzBookmark* +KzBookmarkFolder* kz_bookmark_get_parent (KzBookmark *bookmark); void kz_bookmark_set_parent (KzBookmark *bookmark, - KzBookmark *parent); + KzBookmarkFolder *parent); KzBookmark *kz_bookmark_get_parent_file (KzBookmark *bookmark); KzBookmark *kz_bookmark_next (KzBookmark *bookmark); KzBookmark *kz_bookmark_prev (KzBookmark *bookmark); Modified: kazehakase/trunk/src/bookmarks/kz-bookmarks-view.c =================================================================== --- kazehakase/trunk/src/bookmarks/kz-bookmarks-view.c 2009-02-15 03:18:55 UTC (rev 3698) +++ kazehakase/trunk/src/bookmarks/kz-bookmarks-view.c 2009-02-15 03:52:37 UTC (rev 3699) @@ -433,7 +433,7 @@ for (parent = bookmark; parent; - parent = kz_bookmark_get_parent(parent)) + parent = KZ_BOOKMARK(kz_bookmark_get_parent(parent))) { if (parent == view->root_folder) return TRUE; @@ -658,7 +658,7 @@ next; next = kz_bookmark_next(next)) { - if (kz_bookmark_is_folder(next)) + if (KZ_IS_BOOKMARK_FOLDER(next)) return next; } @@ -666,11 +666,11 @@ next; next = kz_bookmark_prev(next)) { - if (kz_bookmark_is_folder(next)) + if (KZ_IS_BOOKMARK_FOLDER(next)) return next; } - return kz_bookmark_get_parent(bookmark); + return KZ_BOOKMARK(kz_bookmark_get_parent(bookmark)); } @@ -1033,7 +1033,8 @@ GtkTreeIter src_iter, dest_iter; GtkTreeViewDropPosition pos; GtkWidget *src_widget; - KzBookmark *src, *dest, *parent; + KzBookmark *src, *dest; + KzBookmarkFolder *parent; KzBookmark *file; gboolean success = FALSE; @@ -1077,12 +1078,12 @@ parent = kz_bookmark_get_parent(src); if (!parent) goto ERROR; g_object_ref(src); - kz_bookmark_folder_remove(KZ_BOOKMARK_FOLDER(parent), src); + kz_bookmark_folder_remove(parent, src); if (KZ_IS_BOOKMARK_FILE(parent)) - file = parent; + file = KZ_BOOKMARK(parent); else - file = kz_bookmark_get_parent_file(parent); + file = kz_bookmark_get_parent_file(KZ_BOOKMARK(parent)); if (kz_bookmark_file_has_xmlrpc(KZ_BOOKMARK_FILE(file))) { @@ -1095,7 +1096,7 @@ kz_bookmark_is_folder(dest)) { /* move the src bookmark into the dest folder */ - parent = dest; + parent = KZ_BOOKMARK_FOLDER(dest); dest = NULL; } else @@ -1108,7 +1109,7 @@ { GList *children, *node; - children = kz_bookmark_folder_get_children(KZ_BOOKMARK_FOLDER(parent)); + children = kz_bookmark_folder_get_children(parent); node = g_list_find(children, dest); node = g_list_next(node); if (node) @@ -1121,17 +1122,17 @@ if (!parent) goto ERROR; - kz_bookmark_folder_insert_before(KZ_BOOKMARK_FOLDER(parent), src, dest); + kz_bookmark_folder_insert_before(parent, src, dest); if (KZ_IS_BOOKMARK_FILE(parent)) - file = parent; + file = KZ_BOOKMARK(parent); else - file = kz_bookmark_get_parent_file(parent); + file = kz_bookmark_get_parent_file(KZ_BOOKMARK(parent)); if (kz_bookmark_file_has_xmlrpc(KZ_BOOKMARK_FILE(file))) { kz_bookmark_file_xmlrpc_insert(KZ_BOOKMARK_FILE(file), - parent, + KZ_BOOKMARK(parent), dest, src); } Modified: kazehakase/trunk/src/kz-navi.c =================================================================== --- kazehakase/trunk/src/kz-navi.c 2009-02-15 03:18:55 UTC (rev 3698) +++ kazehakase/trunk/src/kz-navi.c 2009-02-15 03:52:37 UTC (rev 3699) @@ -124,10 +124,10 @@ folder = bars->data; g_list_free(bars); - if (!kz_bookmark_is_folder(folder)) + if (!KZ_IS_BOOKMARK_FOLDER(folder)) { sibling = folder; - folder = kz_bookmark_get_parent(folder); + folder = KZ_BOOKMARK(kz_bookmark_get_parent(folder)); g_return_if_fail(KZ_IS_BOOKMARK(folder)); }