From 75692676a96bdc5c9856df3a51370547a517c71a Mon Sep 17 00:00:00 2001 From: Benedikt Meurer <benny@xfce.org> Date: Mon, 5 Sep 2005 21:12:49 +0000 Subject: [PATCH] 2005-09-05 Benedikt Meurer <benny@xfce.org> * thunar-vfs/thunar-vfs-info.{c,h}, thunar-vfs/thunar-vfs-listdir-job.c: Use GList instead of GSList to manage ThunarVfsInfo lists, which increases data locality and decreases memory usage (as there's no need to keep another allocator around any more). * thunar/thunar-computer-folder.c, thunar/thunar-folder.{c,h}, thunar/thunar-list-model.c, thunar/thunar-local-folder.c, thunar/thunar-trash-folder.c: Use GList instead of GSList to manage the list of files for a folder for the same reason. * thunar/thunar-file.{c,h}, thunar/thunar-folder.c, thunar/thunar-local-folder.c, thunar/thunar-local-file.c: ThunarFile is derived from GObject now, instead of GtkObject. * thunar/thunar-list-model.c: No need to implement GtkTreeDragDest, as that's handled in ThunarStandardView. (Old svn revision: 17375) --- ChangeLog | 16 ++++++ thunar-vfs/thunar-vfs-info.c | 9 ++-- thunar-vfs/thunar-vfs-info.h | 2 +- thunar-vfs/thunar-vfs-listdir-job.c | 12 ++--- thunar/thunar-computer-folder.c | 12 ++--- thunar/thunar-file.c | 79 +++++++++++++++++++++++------ thunar/thunar-file.h | 9 +++- thunar/thunar-folder.c | 8 +-- thunar/thunar-folder.h | 12 ++--- thunar/thunar-list-model.c | 59 +++++++++++---------- thunar/thunar-local-file.c | 4 +- thunar/thunar-local-folder.c | 50 +++++++++--------- thunar/thunar-trash-folder.c | 12 ++--- 13 files changed, 176 insertions(+), 108 deletions(-) diff --git a/ChangeLog b/ChangeLog index b53851ee1..a154705b2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2005-09-05 Benedikt Meurer <benny@xfce.org> + + * thunar-vfs/thunar-vfs-info.{c,h}, thunar-vfs/thunar-vfs-listdir-job.c: + Use GList instead of GSList to manage ThunarVfsInfo lists, which + increases data locality and decreases memory usage (as there's no + need to keep another allocator around any more). + * thunar/thunar-computer-folder.c, thunar/thunar-folder.{c,h}, + thunar/thunar-list-model.c, thunar/thunar-local-folder.c, + thunar/thunar-trash-folder.c: Use GList instead of GSList to manage + the list of files for a folder for the same reason. + * thunar/thunar-file.{c,h}, thunar/thunar-folder.c, + thunar/thunar-local-folder.c, thunar/thunar-local-file.c: ThunarFile + is derived from GObject now, instead of GtkObject. + * thunar/thunar-list-model.c: No need to implement GtkTreeDragDest, + as that's handled in ThunarStandardView. + 2005-09-05 Benedikt Meurer <benny@xfce.org> * thunar/thunar-launcher.c, thunar/thunar-list-model.c, diff --git a/thunar-vfs/thunar-vfs-info.c b/thunar-vfs/thunar-vfs-info.c index 94669ea1b..ba23798cf 100644 --- a/thunar-vfs/thunar-vfs-info.c +++ b/thunar-vfs/thunar-vfs-info.c @@ -690,12 +690,11 @@ thunar_vfs_info_matches (const ThunarVfsInfo *a, * * Return value: the empty list (%NULL). **/ -GSList* -thunar_vfs_info_list_free (GSList *info_list) +void +thunar_vfs_info_list_free (GList *info_list) { - g_slist_foreach (info_list, (GFunc) thunar_vfs_info_unref, NULL); - g_slist_free (info_list); - return NULL; + g_list_foreach (info_list, (GFunc) thunar_vfs_info_unref, NULL); + g_list_free (info_list); } diff --git a/thunar-vfs/thunar-vfs-info.h b/thunar-vfs/thunar-vfs-info.h index 5ea26dcef..0aa3f98e0 100644 --- a/thunar-vfs/thunar-vfs-info.h +++ b/thunar-vfs/thunar-vfs-info.h @@ -249,7 +249,7 @@ const gchar *thunar_vfs_info_get_hint (const ThunarVfsInfo *info, gboolean thunar_vfs_info_matches (const ThunarVfsInfo *a, const ThunarVfsInfo *b); -GSList *thunar_vfs_info_list_free (GSList *info_list); +void thunar_vfs_info_list_free (GList *info_list); G_END_DECLS; diff --git a/thunar-vfs/thunar-vfs-listdir-job.c b/thunar-vfs/thunar-vfs-listdir-job.c index 338230c02..39749d99d 100644 --- a/thunar-vfs/thunar-vfs-listdir-job.c +++ b/thunar-vfs/thunar-vfs-listdir-job.c @@ -168,9 +168,9 @@ thunar_vfs_listdir_job_execute (ThunarVfsJob *job) GStringChunk *names_chunk; ThunarVfsURI *file_uri; GError *error = NULL; - GSList *infos = NULL; - GSList *names = NULL; - GSList *lp; + GList *infos = NULL; + GList *names = NULL; + GList *lp; time_t last_check_time; time_t current_time; DIR *dp; @@ -189,7 +189,7 @@ thunar_vfs_listdir_job_execute (ThunarVfsJob *job) * disk seeking. */ while (_thunar_vfs_sysdep_readdir (dp, &d_buffer, &d, &error) && d != NULL) - names = g_slist_insert_sorted (names, g_string_chunk_insert (names_chunk, d->d_name), (GCompareFunc) strcmp); + names = g_list_insert_sorted (names, g_string_chunk_insert (names_chunk, d->d_name), (GCompareFunc) strcmp); closedir (dp); @@ -207,7 +207,7 @@ thunar_vfs_listdir_job_execute (ThunarVfsJob *job) file_uri = thunar_vfs_uri_relative (THUNAR_VFS_LISTDIR_JOB (job)->uri, lp->data); info = thunar_vfs_info_new_for_uri (file_uri, NULL); if (G_LIKELY (info != NULL)) - infos = g_slist_append (infos, info); + infos = g_list_append (infos, info); thunar_vfs_uri_unref (file_uri); current_time = time (NULL); @@ -222,7 +222,7 @@ thunar_vfs_listdir_job_execute (ThunarVfsJob *job) /* free the names */ g_string_chunk_free (names_chunk); - g_slist_free (names); + g_list_free (names); } /* emit appropriate signals */ diff --git a/thunar/thunar-computer-folder.c b/thunar/thunar-computer-folder.c index 90255b1e3..588dbd61a 100644 --- a/thunar/thunar-computer-folder.c +++ b/thunar/thunar-computer-folder.c @@ -58,7 +58,7 @@ static const gchar *thunar_computer_folder_get_icon_name (ThunarF ThunarFileIconState icon_state, GtkIconTheme *icon_theme); static ThunarFile *thunar_computer_folder_get_corresponding_file (ThunarFolder *folder); -static GSList *thunar_computer_folder_get_files (ThunarFolder *folder); +static GList *thunar_computer_folder_get_files (ThunarFolder *folder); static gboolean thunar_computer_folder_get_loading (ThunarFolder *folder); @@ -73,7 +73,7 @@ struct _ThunarComputerFolder ThunarFile __parent__; ThunarVfsURI *uri; - GSList *files; + GList *files; }; @@ -134,12 +134,12 @@ static void thunar_computer_folder_finalize (GObject *object) { ThunarComputerFolder *computer_folder = THUNAR_COMPUTER_FOLDER (object); - GSList *lp; + GList *lp; /* free the virtual folder nodes */ for (lp = computer_folder->files; lp != NULL; lp = lp->next) g_object_unref (G_OBJECT (lp->data)); - g_slist_free (computer_folder->files); + g_list_free (computer_folder->files); /* release the folder's URI */ thunar_vfs_uri_unref (computer_folder->uri); @@ -253,7 +253,7 @@ thunar_computer_folder_get_corresponding_file (ThunarFolder *folder) -static GSList* +static GList * thunar_computer_folder_get_files (ThunarFolder *folder) { static const gchar * const identifiers[] = { "file:/", "trash:" }; @@ -273,7 +273,7 @@ thunar_computer_folder_get_files (ThunarFolder *folder) { file = thunar_file_get_for_uri (uri, NULL); if (G_LIKELY (file != NULL)) - computer_folder->files = g_slist_append (computer_folder->files, file); + computer_folder->files = g_list_append (computer_folder->files, file); thunar_vfs_uri_unref (uri); } } diff --git a/thunar/thunar-file.c b/thunar/thunar-file.c index b7f7410b9..3464ed333 100644 --- a/thunar/thunar-file.c +++ b/thunar/thunar-file.c @@ -35,10 +35,7 @@ #include <thunar/thunar-trash-folder.h> -/* the thumbnailing state of a given file (this - * state is stored in the unused bits of the - * GtkObject flags). - */ +/* the thumbnailing state of a given file */ typedef enum { THUNAR_FILE_THUMB_STATE_MASK = 0xc0000000, @@ -48,8 +45,8 @@ typedef enum THUNAR_FILE_THUMB_STATE_LOADING = 0xc0000000, } ThunarFileThumbState; -#define THUNAR_FILE_GET_THUMB_STATE(file) (GTK_OBJECT ((file))->flags & THUNAR_FILE_THUMB_STATE_MASK) -#define THUNAR_FILE_SET_THUMB_STATE(file, state) (GTK_OBJECT ((file))->flags = (GTK_OBJECT ((file))->flags & ~THUNAR_FILE_THUMB_STATE_MASK) | (state)) +#define THUNAR_FILE_GET_THUMB_STATE(file) (THUNAR_FILE ((file))->flags & THUNAR_FILE_THUMB_STATE_MASK) +#define THUNAR_FILE_SET_THUMB_STATE(file, state) (THUNAR_FILE ((file))->flags = (THUNAR_FILE ((file))->flags & ~THUNAR_FILE_THUMB_STATE_MASK) | (state)) @@ -65,12 +62,14 @@ typedef enum enum { CHANGED, + DESTROY, LAST_SIGNAL, }; static void thunar_file_class_init (ThunarFileClass *klass); +static void thunar_file_dispose (GObject *object); #ifndef G_DISABLE_CHECKS static void thunar_file_finalize (GObject *object); #endif @@ -129,7 +128,7 @@ thunar_file_get_type (void) NULL, }; - type = g_type_register_static (GTK_TYPE_OBJECT, + type = g_type_register_static (G_TYPE_OBJECT, "ThunarFile", &info, G_TYPE_FLAG_ABSTRACT); } @@ -174,9 +173,7 @@ thunar_file_atexit (void) static void thunar_file_class_init (ThunarFileClass *klass) { -#ifndef G_DISABLE_CHECKS GObjectClass *gobject_class; -#endif #ifndef G_DISABLE_CHECKS if (G_UNLIKELY (!thunar_file_atexit_registered)) @@ -193,8 +190,9 @@ thunar_file_class_init (ThunarFileClass *klass) /* determine the parent class */ thunar_file_parent_class = g_type_class_peek_parent (klass); -#ifndef G_DISABLE_CHECKS gobject_class = G_OBJECT_CLASS (klass); + gobject_class->dispose = thunar_file_dispose; +#ifndef G_DISABLE_CHECKS gobject_class->finalize = thunar_file_finalize; #endif @@ -233,6 +231,41 @@ thunar_file_class_init (ThunarFileClass *klass) NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); + + /** + * ThunarFile::destroy: + * @file : the #ThunarFile instance. + * + * Emitted when the system notices that the @file + * was destroyed. + **/ + file_signals[DESTROY] = + g_signal_new ("destroy", + G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_CLEANUP | G_SIGNAL_NO_RECURSE | G_SIGNAL_NO_HOOKS, + G_STRUCT_OFFSET (ThunarFileClass, destroy), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); +} + + + +static void +thunar_file_dispose (GObject *object) +{ + ThunarFile *file = THUNAR_FILE (object); + + /* check that we don't recurse here */ + if (G_LIKELY ((file->flags & GTK_IN_DESTRUCTION) == 0)) + { + /* emit the "destroy" signal */ + file->flags |= GTK_IN_DESTRUCTION; + g_signal_emit (object, file_signals[DESTROY], 0); + file->flags &= ~GTK_IN_DESTRUCTION; + } + + (*G_OBJECT_CLASS (thunar_file_parent_class)->dispose) (object); } @@ -503,11 +536,6 @@ _thunar_file_cache_insert (ThunarFile *file) g_return_if_fail (THUNAR_IS_FILE (file)); g_return_if_fail (file_cache != NULL); - /* drop the floating reference */ - g_assert (GTK_OBJECT_FLOATING (file)); - g_object_ref (G_OBJECT (file)); - gtk_object_sink (GTK_OBJECT (file)); - /* insert the file into the cache */ uri = thunar_file_get_uri (file); g_object_weak_ref (G_OBJECT (file), thunar_file_destroyed, uri); @@ -1516,6 +1544,27 @@ thunar_file_changed (ThunarFile *file) +/** + * thunar_file_destroy: + * @file : a #ThunarFile instance. + * + * Emits the ::destroy signal notifying all reference holders + * that they should release their references to the @file. + * + * This method is very similar to what gtk_object_destroy() + * does for #GtkObject<!---->s. + **/ +void +thunar_file_destroy (ThunarFile *file) +{ + g_return_if_fail (THUNAR_IS_FILE (file)); + + if (G_LIKELY ((file->flags & GTK_IN_DESTRUCTION) == 0)) + g_object_run_dispose (G_OBJECT (file)); +} + + + /** * thunar_file_is_hidden: * @file : a #ThunarFile instance. diff --git a/thunar/thunar-file.h b/thunar/thunar-file.h index 0ca5ab891..c8365f671 100644 --- a/thunar/thunar-file.h +++ b/thunar/thunar-file.h @@ -78,7 +78,7 @@ typedef enum struct _ThunarFileClass { - GtkObjectClass __parent__; + GObjectClass __parent__; /* virtual methods */ gboolean (*has_parent) (ThunarFile *file); @@ -140,11 +140,15 @@ struct _ThunarFileClass /* signals */ void (*changed) (ThunarFile *file); + void (*destroy) (ThunarFile *file); }; struct _ThunarFile { - GtkObject __parent__; + GObject __parent__; + + /*< private >*/ + guint flags; }; GType thunar_file_get_type (void) G_GNUC_CONST; @@ -220,6 +224,7 @@ void thunar_file_unwatch (ThunarFile *file); void thunar_file_reload (ThunarFile *file); void thunar_file_changed (ThunarFile *file); +void thunar_file_destroy (ThunarFile *file); gboolean thunar_file_is_hidden (ThunarFile *file); diff --git a/thunar/thunar-folder.c b/thunar/thunar-folder.c index 6ea5758cd..30ccd3aa7 100644 --- a/thunar/thunar-folder.c +++ b/thunar/thunar-folder.c @@ -67,7 +67,7 @@ thunar_folder_get_type (void) "ThunarFolder", &info, 0); - g_type_interface_add_prerequisite (type, GTK_TYPE_OBJECT); + g_type_interface_add_prerequisite (type, G_TYPE_OBJECT); } return type; @@ -169,7 +169,7 @@ thunar_folder_get_corresponding_file (ThunarFolder *folder) * * Return value: the list of #ThunarFiles for @folder. **/ -GSList* +GList * thunar_folder_get_files (ThunarFolder *folder) { g_return_val_if_fail (THUNAR_IS_FOLDER (folder), NULL); @@ -207,7 +207,7 @@ thunar_folder_get_loading (ThunarFolder *folder) **/ void thunar_folder_files_added (ThunarFolder *folder, - GSList *files) + GList *files) { g_return_if_fail (THUNAR_IS_FOLDER (folder)); g_return_if_fail (files != NULL); @@ -232,7 +232,7 @@ thunar_folder_files_added (ThunarFolder *folder, **/ void thunar_folder_files_removed (ThunarFolder *folder, - GSList *files) + GList *files) { g_return_if_fail (THUNAR_IS_FOLDER (folder)); g_return_if_fail (files != NULL); diff --git a/thunar/thunar-folder.h b/thunar/thunar-folder.h index 358d2e1b5..723767b41 100644 --- a/thunar/thunar-folder.h +++ b/thunar/thunar-folder.h @@ -37,26 +37,26 @@ struct _ThunarFolderIface /* methods */ ThunarFile *(*get_corresponding_file) (ThunarFolder *folder); - GSList *(*get_files) (ThunarFolder *folder); + GList *(*get_files) (ThunarFolder *folder); gboolean (*get_loading) (ThunarFolder *folder); /* signals */ void (*files_added) (ThunarFolder *folder, - GSList *files); + GList *files); void (*files_removed) (ThunarFolder *folder, - GSList *files); + GList *files); }; GType thunar_folder_get_type (void) G_GNUC_CONST; ThunarFile *thunar_folder_get_corresponding_file (ThunarFolder *folder); -GSList *thunar_folder_get_files (ThunarFolder *folder); +GList *thunar_folder_get_files (ThunarFolder *folder); gboolean thunar_folder_get_loading (ThunarFolder *folder); void thunar_folder_files_added (ThunarFolder *folder, - GSList *files); + GList *files); void thunar_folder_files_removed (ThunarFolder *folder, - GSList *files); + GList *files); G_END_DECLS; diff --git a/thunar/thunar-list-model.c b/thunar/thunar-list-model.c index b1407bd64..8efaf40fb 100644 --- a/thunar/thunar-list-model.c +++ b/thunar/thunar-list-model.c @@ -118,7 +118,7 @@ static gint thunar_list_model_cmp (ThunarListMod static gint thunar_list_model_cmp_array (gconstpointer a, gconstpointer b, gpointer user_data); -static gint thunar_list_model_cmp_slist (gconstpointer a, +static gint thunar_list_model_cmp_list (gconstpointer a, gconstpointer b, gpointer user_data); static gboolean thunar_list_model_remove (ThunarListModel *store, @@ -130,10 +130,10 @@ static void thunar_list_model_file_changed (ThunarFile static void thunar_list_model_folder_destroy (ThunarFolder *folder, ThunarListModel *store); static void thunar_list_model_files_added (ThunarFolder *folder, - GSList *files, + GList *files, ThunarListModel *store); static void thunar_list_model_files_removed (ThunarFolder *folder, - GSList *files, + GList *files, ThunarListModel *store); static gint sort_by_date_accessed (ThunarFile *a, ThunarFile *b); @@ -164,7 +164,7 @@ struct _ThunarListModel guint stamp; Row *rows; gint nrows; - GSList *hidden; + GList *hidden; GMemChunk *row_chunk; ThunarFolder *folder; gboolean show_hidden; @@ -906,9 +906,9 @@ thunar_list_model_cmp_array (gconstpointer a, static gint -thunar_list_model_cmp_slist (gconstpointer a, - gconstpointer b, - gpointer user_data) +thunar_list_model_cmp_list (gconstpointer a, + gconstpointer b, + gpointer user_data) { return -thunar_list_model_cmp (THUNAR_LIST_MODEL (user_data), THUNAR_FILE (a), @@ -1083,7 +1083,7 @@ thunar_list_model_folder_destroy (ThunarFolder *folder, static void thunar_list_model_files_added (ThunarFolder *folder, - GSList *files, + GList *files, ThunarListModel *store) { GtkTreePath *path; @@ -1103,7 +1103,7 @@ thunar_list_model_files_added (ThunarFolder *folder, /* check if the file should be hidden */ if (!store->show_hidden && thunar_file_is_hidden (file)) { - store->hidden = g_slist_prepend (store->hidden, file); + store->hidden = g_list_prepend (store->hidden, file); } else { @@ -1159,12 +1159,12 @@ thunar_list_model_files_added (ThunarFolder *folder, static void thunar_list_model_files_removed (ThunarFolder *folder, - GSList *files, + GList *files, ThunarListModel *store) { GtkTreeIter iter; ThunarFile *file; - GSList *lp; + GList *lp; Row *row; /* drop all the referenced files from the model */ @@ -1184,8 +1184,8 @@ thunar_list_model_files_removed (ThunarFolder *folder, } /* file is hidden */ - g_assert (g_slist_find (store->hidden, file) != NULL); - store->hidden = g_slist_remove (store->hidden, file); + g_assert (g_list_find (store->hidden, file) != NULL); + store->hidden = g_list_remove (store->hidden, file); g_object_unref (G_OBJECT (file)); } } @@ -1425,8 +1425,8 @@ thunar_list_model_set_folder (ThunarListModel *store, GtkTreePath *path; GtkTreeIter iter; ThunarFile *file; - GSList *files; - GSList *lp; + GList *files; + GList *lp; Row *row; g_return_if_fail (THUNAR_IS_LIST_MODEL (store)); @@ -1463,8 +1463,8 @@ thunar_list_model_set_folder (ThunarListModel *store, g_mem_chunk_reset (store->row_chunk); /* remove hidden entries */ - g_slist_foreach (store->hidden, (GFunc) g_object_unref, NULL); - g_slist_free (store->hidden); + g_list_foreach (store->hidden, (GFunc) g_object_unref, NULL); + g_list_free (store->hidden); store->hidden = NULL; /* unregister signals and drop the reference */ @@ -1485,10 +1485,10 @@ thunar_list_model_set_folder (ThunarListModel *store, g_object_ref (G_OBJECT (folder)); /* sort the files _before_ adding them to the store (reverse order -> prepend below) */ - files = g_slist_copy (thunar_folder_get_files (folder)); + files = g_list_copy (thunar_folder_get_files (folder)); if (G_LIKELY (files != NULL)) { - files = g_slist_sort_with_data (files, thunar_list_model_cmp_slist, store); + files = g_list_sort_with_data (files, thunar_list_model_cmp_list, store); /* insert the files */ for (lp = files; lp != NULL; lp = lp->next) @@ -1500,7 +1500,7 @@ thunar_list_model_set_folder (ThunarListModel *store, /* check if this file should be shown/hidden */ if (!store->show_hidden && thunar_file_is_hidden (file)) { - store->hidden = g_slist_prepend (store->hidden, file); + store->hidden = g_list_prepend (store->hidden, file); } else { @@ -1528,7 +1528,7 @@ thunar_list_model_set_folder (ThunarListModel *store, gtk_tree_path_free (path); /* cleanup */ - g_slist_free (files); + g_list_free (files); } /* connect signals to the new folder */ @@ -1615,9 +1615,9 @@ thunar_list_model_set_show_hidden (ThunarListModel *store, GtkTreePath *path; GtkTreeIter iter; ThunarFile *file; - GSList *hidden_rows; - GSList *files; - GSList *lp; + GList *hidden_rows; + GList *files; + GList *lp; Row *prev; Row *row; @@ -1641,8 +1641,7 @@ thunar_list_model_set_show_hidden (ThunarListModel *store, row->changed_id = g_signal_connect_closure_by_id (G_OBJECT (file), store->file_changed_id, 0, store->file_changed_closure, TRUE); - if (G_UNLIKELY (store->rows == NULL - || thunar_list_model_cmp (store, file, store->rows->file) < 0)) + if (G_UNLIKELY (store->rows == NULL || thunar_list_model_cmp (store, file, store->rows->file) < 0)) { row->next = store->rows; store->rows = row; @@ -1666,7 +1665,7 @@ thunar_list_model_set_show_hidden (ThunarListModel *store, store->nrows += 1; } - g_slist_free (store->hidden); + g_list_free (store->hidden); store->hidden = NULL; } else @@ -1677,8 +1676,8 @@ thunar_list_model_set_show_hidden (ThunarListModel *store, for (hidden_rows = files = NULL, row = store->rows; row != NULL; row = row->next) if (thunar_file_is_hidden (row->file)) { - hidden_rows = g_slist_prepend (hidden_rows, row); - files = g_slist_prepend (files, g_object_ref (row->file)); + hidden_rows = g_list_prepend (hidden_rows, row); + files = g_list_prepend (files, g_object_ref (row->file)); } if (files != NULL) @@ -1689,7 +1688,7 @@ thunar_list_model_set_show_hidden (ThunarListModel *store, iter.user_data = lp->data; thunar_list_model_remove (store, &iter, FALSE); } - g_slist_free (hidden_rows); + g_list_free (hidden_rows); store->hidden = files; } diff --git a/thunar/thunar-local-file.c b/thunar/thunar-local-file.c index 751510585..9674aa3e7 100644 --- a/thunar/thunar-local-file.c +++ b/thunar/thunar-local-file.c @@ -595,7 +595,7 @@ thunar_local_file_reload (ThunarFile *file) if (G_UNLIKELY (info == NULL)) { /* the file is no longer present */ - gtk_object_destroy (GTK_OBJECT (file)); + thunar_file_destroy (file); } else { @@ -639,7 +639,7 @@ thunar_local_file_monitor (ThunarVfsMonitor *monitor, break; case THUNAR_VFS_MONITOR_EVENT_DELETED: - gtk_object_destroy (GTK_OBJECT (local_file)); + thunar_file_destroy (THUNAR_FILE (local_file)); break; } } diff --git a/thunar/thunar-local-folder.c b/thunar/thunar-local-folder.c index 687ab1f11..196b444d2 100644 --- a/thunar/thunar-local-folder.c +++ b/thunar/thunar-local-folder.c @@ -50,13 +50,13 @@ static void thunar_local_folder_get_property (GObject GParamSpec *pspec); static void thunar_local_folder_finalize (GObject *object); static ThunarFile *thunar_local_folder_get_corresponding_file (ThunarFolder *folder); -static GSList *thunar_local_folder_get_files (ThunarFolder *folder); +static GList *thunar_local_folder_get_files (ThunarFolder *folder); static gboolean thunar_local_folder_get_loading (ThunarFolder *folder); static void thunar_local_folder_error (ThunarVfsJob *job, GError *error, ThunarLocalFolder *local_folder); static void thunar_local_folder_infos_ready (ThunarVfsJob *job, - GSList *infos, + GList *infos, ThunarLocalFolder *local_folder); static void thunar_local_folder_finished (ThunarVfsJob *job, ThunarLocalFolder *local_folder); @@ -79,7 +79,7 @@ struct _ThunarLocalFolder ThunarVfsJob *job; ThunarFile *corresponding_file; - GSList *files; + GList *files; GClosure *file_destroy_closure; gint file_destroy_id; @@ -145,7 +145,7 @@ static void thunar_local_folder_finalize (GObject *object) { ThunarLocalFolder *local_folder = THUNAR_LOCAL_FOLDER (object); - GSList *lp; + GList *lp; g_return_if_fail (THUNAR_IS_LOCAL_FOLDER (local_folder)); @@ -180,7 +180,7 @@ thunar_local_folder_finalize (GObject *object) NULL, NULL); g_object_unref (G_OBJECT (lp->data)); } - g_slist_free (local_folder->files); + g_list_free (local_folder->files); /* drop the "destroy" closure */ g_closure_unref (local_folder->file_destroy_closure); @@ -220,7 +220,7 @@ thunar_local_folder_get_corresponding_file (ThunarFolder *folder) -static GSList* +static GList * thunar_local_folder_get_files (ThunarFolder *folder) { return THUNAR_LOCAL_FOLDER (folder)->files; @@ -253,14 +253,14 @@ thunar_local_folder_error (ThunarVfsJob *job, static void thunar_local_folder_infos_ready (ThunarVfsJob *job, - GSList *infos, + GList *infos, ThunarLocalFolder *local_folder) { ThunarFile *file; - GSList *existing_files = local_folder->files; - GSList *nfiles = NULL; - GSList *lp; - GSList *p; + GList *existing_files = local_folder->files; + GList *nfiles = NULL; + GList *lp; + GList *p; g_return_if_fail (THUNAR_IS_LOCAL_FOLDER (local_folder)); g_return_if_fail (local_folder->job == job); @@ -283,8 +283,8 @@ thunar_local_folder_infos_ready (ThunarVfsJob *job, } /* add the file */ - nfiles = g_slist_prepend (nfiles, file); - local_folder->files = g_slist_prepend (local_folder->files, file); + nfiles = g_list_prepend (nfiles, file); + local_folder->files = g_list_prepend (local_folder->files, file); g_signal_connect_closure_by_id (G_OBJECT (file), local_folder->file_destroy_id, 0, local_folder->file_destroy_closure, TRUE); @@ -294,7 +294,7 @@ thunar_local_folder_infos_ready (ThunarVfsJob *job, if (G_LIKELY (nfiles != NULL)) { thunar_folder_files_added (THUNAR_FOLDER (local_folder), nfiles); - g_slist_free (nfiles); + g_list_free (nfiles); } } @@ -336,22 +336,22 @@ static void thunar_local_folder_file_destroy (ThunarFile *file, ThunarLocalFolder *local_folder) { - GSList *files; + GList *files; g_return_if_fail (THUNAR_IS_FILE (file)); g_return_if_fail (THUNAR_IS_LOCAL_FOLDER (local_folder)); - g_return_if_fail (g_slist_find (local_folder->files, file) != NULL); + g_return_if_fail (g_list_find (local_folder->files, file) != NULL); /* disconnect from the file */ g_signal_handlers_disconnect_matched (G_OBJECT (file), G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_CLOSURE, local_folder->file_destroy_id, 0, local_folder->file_destroy_closure, NULL, NULL); - local_folder->files = g_slist_remove (local_folder->files, file); + local_folder->files = g_list_remove (local_folder->files, file); /* tell everybody that the file is gone */ - files = g_slist_prepend (NULL, file); + files = g_list_prepend (NULL, file); thunar_folder_files_removed (THUNAR_FOLDER (local_folder), files); - g_slist_free_1 (files); + g_list_free_1 (files); /* drop our reference to the file */ g_object_unref (G_OBJECT (file)); @@ -369,7 +369,8 @@ thunar_local_folder_monitor (ThunarVfsMonitor *monitor, { ThunarLocalFolder *local_folder = THUNAR_LOCAL_FOLDER (user_data); ThunarFile *file; - GSList *lp; + GList *lp; + GList list; g_return_if_fail (THUNAR_VFS_IS_MONITOR (monitor)); g_return_if_fail (THUNAR_VFS_IS_URI (handle_uri)); @@ -401,13 +402,12 @@ thunar_local_folder_monitor (ThunarVfsMonitor *monitor, /* prepend it to our internal list */ g_signal_connect_closure_by_id (G_OBJECT (file), local_folder->file_destroy_id, 0, local_folder->file_destroy_closure, TRUE); - local_folder->files = g_slist_prepend (local_folder->files, file); + local_folder->files = g_list_prepend (local_folder->files, file); g_object_ref (G_OBJECT (file)); /* tell others about the new file */ - lp = g_slist_prepend (NULL, file); - thunar_folder_files_added (THUNAR_FOLDER (local_folder), lp); - g_slist_free (lp); + list.data = file; list.next = list.prev = NULL; + thunar_folder_files_added (THUNAR_FOLDER (local_folder), &list); } else { @@ -424,7 +424,7 @@ thunar_local_folder_monitor (ThunarVfsMonitor *monitor, case THUNAR_VFS_MONITOR_EVENT_DELETED: /* drop the file */ - gtk_object_destroy (GTK_OBJECT (file)); + thunar_file_destroy (file); break; } diff --git a/thunar/thunar-trash-folder.c b/thunar/thunar-trash-folder.c index 869dedb57..556f7dd70 100644 --- a/thunar/thunar-trash-folder.c +++ b/thunar/thunar-trash-folder.c @@ -56,7 +56,7 @@ static const gchar *thunar_trash_folder_get_icon_name (ThunarFil ThunarFileIconState icon_state, GtkIconTheme *icon_theme); static ThunarFile *thunar_trash_folder_get_corresponding_file (ThunarFolder *folder); -static GSList *thunar_trash_folder_get_files (ThunarFolder *folder); +static GList *thunar_trash_folder_get_files (ThunarFolder *folder); static gboolean thunar_trash_folder_get_loading (ThunarFolder *folder); @@ -72,7 +72,7 @@ struct _ThunarTrashFolder ThunarVfsTrashManager *manager; ThunarVfsURI *uri; - GSList *files; + GList *files; }; @@ -137,12 +137,12 @@ static void thunar_trash_folder_finalize (GObject *object) { ThunarTrashFolder *trash_folder = THUNAR_TRASH_FOLDER (object); - GSList *lp; + GList *lp; /* drop the files list */ for (lp = trash_folder->files; lp != NULL; lp = lp->next) g_object_unref (G_OBJECT (lp->data)); - g_slist_free (trash_folder->files); + g_list_free (trash_folder->files); /* unregister from the trash manager */ g_signal_handlers_disconnect_by_func (G_OBJECT (trash_folder->manager), thunar_file_changed, trash_folder); @@ -293,7 +293,7 @@ thunar_trash_folder_get_corresponding_file (ThunarFolder *folder) -static GSList* +static GList * thunar_trash_folder_get_files (ThunarFolder *folder) { ThunarTrashFolder *trash_folder = THUNAR_TRASH_FOLDER (folder); @@ -317,7 +317,7 @@ thunar_trash_folder_get_files (ThunarFolder *folder) uri = thunar_vfs_trash_get_uri (trash, fp->data); file = thunar_file_get_for_uri (uri, NULL); if (file != NULL) - trash_folder->files = g_slist_prepend (trash_folder->files, file); + trash_folder->files = g_list_prepend (trash_folder->files, file); thunar_vfs_uri_unref (uri); } g_object_unref (G_OBJECT (trash)); -- GitLab