diff options
-rw-r--r-- | libnautilus-private/nautilus-bookmark.c | 4 | ||||
-rw-r--r-- | libnautilus-private/nautilus-bookmark.h | 4 | ||||
-rw-r--r-- | src/nautilus-bookmark-list.c | 109 | ||||
-rw-r--r-- | src/nautilus-bookmark-list.h | 5 |
4 files changed, 61 insertions, 61 deletions
diff --git a/libnautilus-private/nautilus-bookmark.c b/libnautilus-private/nautilus-bookmark.c index 5322dda6a..8c93ed823 100644 --- a/libnautilus-private/nautilus-bookmark.c +++ b/libnautilus-private/nautilus-bookmark.c @@ -62,9 +62,9 @@ struct NautilusBookmarkDetails static void nautilus_bookmark_connect_file (NautilusBookmark *file); static void nautilus_bookmark_disconnect_file (NautilusBookmark *file); -G_DEFINE_TYPE (NautilusBookmark, nautilus_bookmark, GTK_TYPE_OBJECT); +G_DEFINE_TYPE (NautilusBookmark, nautilus_bookmark, G_TYPE_OBJECT); -/* GtkObject methods. */ +/* GObject methods. */ static void nautilus_bookmark_finalize (GObject *object) diff --git a/libnautilus-private/nautilus-bookmark.h b/libnautilus-private/nautilus-bookmark.h index ca839c266..e907bf377 100644 --- a/libnautilus-private/nautilus-bookmark.h +++ b/libnautilus-private/nautilus-bookmark.h @@ -44,12 +44,12 @@ typedef struct NautilusBookmark NautilusBookmark; typedef struct NautilusBookmarkDetails NautilusBookmarkDetails; struct NautilusBookmark { - GtkObject object; + GObject object; NautilusBookmarkDetails *details; }; struct NautilusBookmarkClass { - GtkObjectClass parent_class; + GObjectClass parent_class; /* Signals that clients can connect to. */ diff --git a/src/nautilus-bookmark-list.c b/src/nautilus-bookmark-list.c index 25885d9eb..0e5776890 100644 --- a/src/nautilus-bookmark-list.c +++ b/src/nautilus-bookmark-list.c @@ -47,11 +47,10 @@ static char *window_geometry; /* forward declarations */ -static void destroy (GtkObject *object); static void nautilus_bookmark_list_load_file (NautilusBookmarkList *bookmarks); static void nautilus_bookmark_list_save_file (NautilusBookmarkList *bookmarks); -G_DEFINE_TYPE(NautilusBookmarkList, nautilus_bookmark_list, GTK_TYPE_OBJECT) +G_DEFINE_TYPE(NautilusBookmarkList, nautilus_bookmark_list, G_TYPE_OBJECT) static NautilusBookmark * new_bookmark_from_uri (const char *uri, const char *label) @@ -121,13 +120,62 @@ nautilus_bookmark_list_get_file (void) /* Initialization. */ static void -nautilus_bookmark_list_class_init (NautilusBookmarkListClass *class) +bookmark_in_list_changed_callback (NautilusBookmark *bookmark, + NautilusBookmarkList *bookmarks) { - GtkObjectClass *object_class; + g_assert (NAUTILUS_IS_BOOKMARK (bookmark)); + g_assert (NAUTILUS_IS_BOOKMARK_LIST (bookmarks)); - object_class = GTK_OBJECT_CLASS (class); + /* Save changes so we'll have the good icon next time. */ + nautilus_bookmark_list_save_file (bookmarks); +} + +static void +stop_monitoring_bookmark (NautilusBookmarkList *bookmarks, + NautilusBookmark *bookmark) +{ + g_signal_handlers_disconnect_by_func (bookmark, + bookmark_in_list_changed_callback, + bookmarks); +} + +static void +stop_monitoring_one (gpointer data, gpointer user_data) +{ + g_assert (NAUTILUS_IS_BOOKMARK (data)); + g_assert (NAUTILUS_IS_BOOKMARK_LIST (user_data)); + + stop_monitoring_bookmark (NAUTILUS_BOOKMARK_LIST (user_data), + NAUTILUS_BOOKMARK (data)); +} + +static void +clear (NautilusBookmarkList *bookmarks) +{ + g_list_foreach (bookmarks->list, stop_monitoring_one, bookmarks); + eel_g_object_list_free (bookmarks->list); + bookmarks->list = NULL; +} + +static void +do_finalize (GObject *object) +{ + if (NAUTILUS_BOOKMARK_LIST (object)->monitor != NULL) { + g_file_monitor_cancel (NAUTILUS_BOOKMARK_LIST (object)->monitor); + NAUTILUS_BOOKMARK_LIST (object)->monitor = NULL; + } + + clear (NAUTILUS_BOOKMARK_LIST (object)); + + G_OBJECT_CLASS (nautilus_bookmark_list_parent_class)->finalize (object); +} + +static void +nautilus_bookmark_list_class_init (NautilusBookmarkListClass *class) +{ + GObjectClass *object_class = G_OBJECT_CLASS (class); - object_class->destroy = destroy; + object_class->finalize = do_finalize; signals[CONTENTS_CHANGED] = g_signal_new ("contents_changed", @@ -173,55 +221,6 @@ nautilus_bookmark_list_init (NautilusBookmarkList *bookmarks) } static void -bookmark_in_list_changed_callback (NautilusBookmark *bookmark, - NautilusBookmarkList *bookmarks) -{ - g_assert (NAUTILUS_IS_BOOKMARK (bookmark)); - g_assert (NAUTILUS_IS_BOOKMARK_LIST (bookmarks)); - - /* Save changes so we'll have the good icon next time. */ - nautilus_bookmark_list_contents_changed (bookmarks); -} - -static void -stop_monitoring_bookmark (NautilusBookmarkList *bookmarks, - NautilusBookmark *bookmark) -{ - g_signal_handlers_disconnect_by_func (bookmark, - bookmark_in_list_changed_callback, - bookmarks); -} - -static void -stop_monitoring_one (gpointer data, gpointer user_data) -{ - g_assert (NAUTILUS_IS_BOOKMARK (data)); - g_assert (NAUTILUS_IS_BOOKMARK_LIST (user_data)); - - stop_monitoring_bookmark (NAUTILUS_BOOKMARK_LIST (user_data), - NAUTILUS_BOOKMARK (data)); -} - -static void -clear (NautilusBookmarkList *bookmarks) -{ - g_list_foreach (bookmarks->list, stop_monitoring_one, bookmarks); - eel_g_object_list_free (bookmarks->list); - bookmarks->list = NULL; -} - -static void -destroy (GtkObject *object) -{ - if (NAUTILUS_BOOKMARK_LIST (object)->monitor != NULL) { - g_file_monitor_cancel (NAUTILUS_BOOKMARK_LIST (object)->monitor); - NAUTILUS_BOOKMARK_LIST (object)->monitor = NULL; - } - - clear (NAUTILUS_BOOKMARK_LIST (object)); -} - -static void insert_bookmark_internal (NautilusBookmarkList *bookmarks, NautilusBookmark *bookmark, int index) diff --git a/src/nautilus-bookmark-list.h b/src/nautilus-bookmark-list.h index f611681f0..231b50ee4 100644 --- a/src/nautilus-bookmark-list.h +++ b/src/nautilus-bookmark-list.h @@ -47,13 +47,14 @@ typedef struct NautilusBookmarkListClass NautilusBookmarkListClass; (G_TYPE_INSTANCE_GET_CLASS ((obj), NAUTILUS_TYPE_BOOKMARK_LIST, NautilusBookmarkListClass)) struct NautilusBookmarkList { - GtkObject object; + GObject object; + GList *list; GFileMonitor *monitor; }; struct NautilusBookmarkListClass { - GtkObjectClass parent_class; + GObjectClass parent_class; void (* contents_changed) (NautilusBookmarkList *bookmarks); }; |