Hiroyuki Ikezoe
ikezo****@users*****
Mon Jan 8 09:20:48 JST 2007
Index: kazehakase/src/kz-thumbnails-view.c diff -u kazehakase/src/kz-thumbnails-view.c:1.27 kazehakase/src/kz-thumbnails-view.c:1.28 --- kazehakase/src/kz-thumbnails-view.c:1.27 Sat Dec 2 18:55:54 2006 +++ kazehakase/src/kz-thumbnails-view.c Mon Jan 8 09:20:48 2007 @@ -31,6 +31,8 @@ typedef struct _KzThumbnailsViewPrivate KzThumbnailsViewPrivate; struct _KzThumbnailsViewPrivate { + KzBookmark *folder; + GList *children; KzThumbnailsViewMode mode; }; @@ -43,8 +45,7 @@ #define KZ_THUMBNAIL_BOOKMARK_KEY "KzThumbnail::Bookmark" -static void dispose (GObject *object); - +static void dispose (GObject *object); static void size_allocate (GtkWidget *widget, GtkAllocation *allocation); @@ -104,9 +105,11 @@ kz_thumbnails_view_init (KzThumbnailsView *view) { KzThumbnailsViewPrivate *priv = KZ_THUMBNAILS_VIEW_GET_PRIVATE (view); - view->folder = NULL; - - priv->mode = KZ_THUMBNAILS_VIEW_VERTICAL; + + priv->folder = NULL; + priv->children = NULL; + priv->mode = KZ_THUMBNAILS_VIEW_VERTICAL; + gtk_table_set_homogeneous(GTK_TABLE(view), FALSE); gtk_table_set_col_spacings(GTK_TABLE(view), 4); gtk_table_set_row_spacings(GTK_TABLE(view), 4); @@ -116,13 +119,14 @@ static void dispose (GObject *object) { + KzThumbnailsViewPrivate *priv = KZ_THUMBNAILS_VIEW_GET_PRIVATE(object); KzThumbnailsView *view = KZ_THUMBNAILS_VIEW(object); - if (view->folder) + if (priv->folder) { - disconnect_bookmark_signals(view, view->folder); - g_object_unref(view->folder); - view->folder = NULL; + disconnect_bookmark_signals(view, priv->folder); + g_object_unref(priv->folder); + priv->folder = NULL; } if (G_OBJECT_CLASS(kz_thumbnails_view_parent_class)->dispose) @@ -137,14 +141,14 @@ GtkAllocation old_allocation; gint old_width; KzThumbnailsView *view; - KzThumbnailsViewPrivate *priv = KZ_THUMBNAILS_VIEW_GET_PRIVATE (widget); + KzThumbnailsViewPrivate *priv = KZ_THUMBNAILS_VIEW_GET_PRIVATE(widget); view = KZ_THUMBNAILS_VIEW(widget); old_allocation = widget->allocation; old_width = old_allocation.width; - GTK_WIDGET_CLASS(kz_thumbnails_view_parent_class)->size_allocate (widget, allocation); + GTK_WIDGET_CLASS(kz_thumbnails_view_parent_class)->size_allocate(widget, allocation); if (priv->mode == KZ_THUMBNAILS_VIEW_PLANE && old_width != allocation->width) @@ -216,10 +220,11 @@ static void kz_thumbnails_view_redraw (KzThumbnailsView *view) { + KzThumbnailsViewPrivate *priv = KZ_THUMBNAILS_VIEW_GET_PRIVATE (view); GList *node; gint i = 0; - for (node = view->children; node; node = g_list_next(node)) + for (node = priv->children; node; node = g_list_next(node)) { GtkWidget *thumb = node->data; @@ -244,31 +249,34 @@ KzBookmark *folder) { GList *children, *node; + KzThumbnailsViewPrivate *priv; g_return_if_fail(KZ_IS_THUMBNAILS_VIEW(view)); g_return_if_fail(!folder || kz_bookmark_is_folder(folder)); - if (view->folder) + priv = KZ_THUMBNAILS_VIEW_GET_PRIVATE(view); + + if (priv->folder) { - disconnect_bookmark_signals(view, view->folder); - g_object_unref(view->folder); - view->folder = NULL; + disconnect_bookmark_signals(view, priv->folder); + g_object_unref(priv->folder); + priv->folder = NULL; /* remove old widgets */ - g_list_foreach(view->children, + g_list_foreach(priv->children, destroy_child_widget, NULL); - g_list_free(view->children); + g_list_free(priv->children); } if (!folder) return; - view->folder = g_object_ref(folder); - connect_bookmark_signals(view, view->folder); + priv->folder = g_object_ref(folder); + connect_bookmark_signals(view, priv->folder); children = kz_bookmark_get_children(folder); for (node = children; node; node = g_list_next(node)) { - insert_bookmark(view, view->folder, + insert_bookmark(view, priv->folder, node->data, NULL); } g_list_free(children); @@ -296,12 +304,13 @@ GtkWidget *widget; GList *children; gint index; + KzThumbnailsViewPrivate *priv = KZ_THUMBNAILS_VIEW_GET_PRIVATE (view); - children = kz_bookmark_get_children(view->folder); + children = kz_bookmark_get_children(priv->folder); index = g_list_index(children, bookmark); g_list_free(children); - widget = g_list_nth_data(view->children, index); + widget = g_list_nth_data(priv->children, index); return widget; } @@ -366,6 +375,7 @@ { GtkWidget *thumbnail; gint pos = -1; + KzThumbnailsViewPrivate *priv = KZ_THUMBNAILS_VIEW_GET_PRIVATE(view); thumbnail = kz_thumbnail_new(); thumbnail_set_bookmark_property(thumbnail, child); @@ -393,7 +403,7 @@ { GList *node, *pos_node; gint i = pos + 1; - pos_node = g_list_nth(view->children, pos); + pos_node = g_list_nth(priv->children, pos); for (node = pos_node; node; node = g_list_next(node)) { @@ -409,9 +419,9 @@ } else { - pos = g_list_length(view->children); + pos = g_list_length(priv->children); } - view->children = g_list_insert(view->children, + priv->children = g_list_insert(priv->children, thumbnail, pos); @@ -439,6 +449,7 @@ KzThumbnailsView *view) { GtkWidget *thumbnail; + KzThumbnailsViewPrivate *priv = KZ_THUMBNAILS_VIEW_GET_PRIVATE(view); g_signal_handlers_disconnect_by_func (child, @@ -449,7 +460,7 @@ if (thumbnail) { gtk_widget_destroy(thumbnail); - view->children = g_list_remove(view->children, thumbnail); + priv->children = g_list_remove(priv->children, thumbnail); } } @@ -489,13 +500,14 @@ KzBookmark *bookmark; GList *children; gint index; + KzThumbnailsViewPrivate *priv = KZ_THUMBNAILS_VIEW_GET_PRIVATE(view); if (event->button == 3) return TRUE; bookmark = g_object_get_data(G_OBJECT(thumbnail), KZ_THUMBNAIL_BOOKMARK_KEY); - children = kz_bookmark_get_children(view->folder); + children = kz_bookmark_get_children(priv->folder); index = g_list_index(children, bookmark); g_list_free(children); Index: kazehakase/src/kz-thumbnails-view.h diff -u kazehakase/src/kz-thumbnails-view.h:1.8 kazehakase/src/kz-thumbnails-view.h:1.9 --- kazehakase/src/kz-thumbnails-view.h:1.8 Mon May 9 10:20:12 2005 +++ kazehakase/src/kz-thumbnails-view.h Mon Jan 8 09:20:48 2007 @@ -49,10 +49,6 @@ struct _KzThumbnailsView { GtkTable parent; - - KzBookmark *folder; - - GList *children; }; struct _KzThumbnailsViewClass