[Xfce4-commits] <thunar:master> Use g_(s)list_free_full where possible.
Nick Schermer
noreply at xfce.org
Sun Sep 16 20:20:06 CEST 2012
Updating branch refs/heads/master
to 853001496fd176d6a60fca9ca8709686dd0f67c1 (commit)
from e9ead973243a05d284f7db064430ff95b023f82d (commit)
commit 853001496fd176d6a60fca9ca8709686dd0f67c1
Author: Nick Schermer <nick at xfce.org>
Date: Sun Sep 16 18:32:05 2012 +0200
Use g_(s)list_free_full where possible.
plugins/thunar-uca/thunar-uca-model.c | 11 +++++------
thunar/thunar-application.c | 6 ++----
thunar/thunar-chooser-model.c | 7 ++-----
thunar/thunar-dbus-service.c | 3 +--
thunar/thunar-file.c | 6 ++----
thunar/thunar-list-model.c | 9 +++------
thunar/thunar-permissions-chooser.c | 3 +--
thunar/thunar-properties-dialog.c | 3 +--
thunar/thunar-renamer-dialog.c | 6 ++----
thunar/thunar-renamer-model.c | 9 +++++----
thunar/thunar-renamer-pair.c | 8 ++++----
thunar/thunar-renamer-pair.h | 2 +-
thunar/thunar-sendto-model.c | 9 +++------
thunar/thunar-shortcuts-model.c | 3 +--
thunar/thunar-standard-view.c | 21 +++++++--------------
thunar/thunar-templates-action.c | 3 +--
thunar/thunar-thumbnail-cache.c | 23 +++++++----------------
thunar/thunar-transfer-job.c | 8 ++++----
thunar/thunar-tree-model.c | 6 ++----
thunar/thunar-user.c | 6 ++----
thunar/thunar-window.c | 3 +--
thunarx/thunarx-file-info.c | 8 ++------
thunarx/thunarx-menu-provider.c | 9 +++------
thunarx/thunarx-preferences-provider.c | 3 +--
thunarx/thunarx-property-page-provider.c | 3 +--
thunarx/thunarx-provider-factory.c | 3 +--
thunarx/thunarx-renamer-provider.c | 3 +--
thunarx/thunarx-renamer.c | 3 +--
28 files changed, 67 insertions(+), 120 deletions(-)
diff --git a/plugins/thunar-uca/thunar-uca-model.c b/plugins/thunar-uca/thunar-uca-model.c
index 59c1d03..aa388b0 100644
--- a/plugins/thunar-uca/thunar-uca-model.c
+++ b/plugins/thunar-uca/thunar-uca-model.c
@@ -122,7 +122,7 @@ static gboolean thunar_uca_model_load_from_file (ThunarUcaModel
const gchar *filename,
GError **error);
static void thunar_uca_model_item_reset (ThunarUcaModelItem *item);
-static void thunar_uca_model_item_free (ThunarUcaModelItem *item);
+static void thunar_uca_model_item_free (gpointer data);
static void start_element_handler (GMarkupParseContext *context,
const gchar *element_name,
const gchar **attribute_names,
@@ -284,8 +284,7 @@ thunar_uca_model_finalize (GObject *object)
g_object_unref (G_OBJECT (uca_model->icon_factory));
/* release all items */
- g_list_foreach (uca_model->items, (GFunc) thunar_uca_model_item_free, NULL);
- g_list_free (uca_model->items);
+ g_list_free_full (uca_model->items, thunar_uca_model_item_free);
(*G_OBJECT_CLASS (thunar_uca_model_parent_class)->finalize) (object);
}
@@ -600,8 +599,9 @@ thunar_uca_model_item_reset (ThunarUcaModelItem *item)
static void
-thunar_uca_model_item_free (ThunarUcaModelItem *item)
+thunar_uca_model_item_free (gpointer data)
{
+ ThunarUcaModelItem *item = data;
thunar_uca_model_item_reset (item);
g_free (item);
}
@@ -1000,8 +1000,7 @@ types_from_mime_type (const gchar *mime_type)
*
* The caller is responsible to free the returned list using
* <informalexample><programlisting>
- * g_list_foreach (list, (GFunc) gtk_tree_path_free, NULL);
- * g_list_free (list);
+ * g_list_free_full (list, (GDestroyNotify) gtk_tree_path_free);
* </programlisting></informalexample>
*
* Return value: the list of #GtkTreePath<!---->s to items
diff --git a/thunar/thunar-application.c b/thunar/thunar-application.c
index 31ad89e..b619bbe 100644
--- a/thunar/thunar-application.c
+++ b/thunar/thunar-application.c
@@ -268,8 +268,7 @@ thunar_application_finalize (GObject *object)
g_source_remove (application->volman_idle_id);
/* drop all pending volume manager UDIs */
- g_slist_foreach (application->volman_udis, (GFunc) g_free, NULL);
- g_slist_free (application->volman_udis);
+ g_slist_free_full (application->volman_udis, g_free);
/* disconnect from the udev client */
g_object_unref (application->udev_client);
@@ -659,8 +658,7 @@ thunar_application_volman_idle (gpointer user_data)
else
{
/* drop all pending HAL device UDIs */
- g_slist_foreach (application->volman_udis, (GFunc) g_free, NULL);
- g_slist_free (application->volman_udis);
+ g_slist_free_full (application->volman_udis, g_free);
application->volman_udis = NULL;
}
diff --git a/thunar/thunar-chooser-model.c b/thunar/thunar-chooser-model.c
index ec41b5c..1fa5b9c 100644
--- a/thunar/thunar-chooser-model.c
+++ b/thunar/thunar-chooser-model.c
@@ -311,11 +311,8 @@ thunar_chooser_model_reload (ThunarChooserModel *model)
"gnome-applications",
other);
- g_list_foreach (recommended, (GFunc) g_object_unref, NULL);
- g_list_free (recommended);
-
- g_list_foreach (all, (GFunc) g_object_unref, NULL);
- g_list_free (all);
+ g_list_free_full (recommended, g_object_unref);
+ g_list_free_full (all, g_object_unref);
g_list_free (other);
}
diff --git a/thunar/thunar-dbus-service.c b/thunar/thunar-dbus-service.c
index ae8ad85..6b31a06 100644
--- a/thunar/thunar-dbus-service.c
+++ b/thunar/thunar-dbus-service.c
@@ -601,8 +601,7 @@ thunar_dbus_service_execute (ThunarDBusService *dbus_service,
g_object_unref (working_dir);
/* cleanup */
- g_list_foreach (file_list, (GFunc) g_object_unref, NULL);
- g_list_free (file_list);
+ g_list_free_full (file_list, g_object_unref);
g_object_unref (screen);
g_object_unref (file);
}
diff --git a/thunar/thunar-file.c b/thunar/thunar-file.c
index 9509600..bac2ed1 100644
--- a/thunar/thunar-file.c
+++ b/thunar/thunar-file.c
@@ -3554,8 +3554,7 @@ thunar_file_cached_display_name (const GFile *file)
*
* The caller is responsible to free the returned list using something like:
* <informalexample><programlisting>
- * g_list_foreach (list, (GFunc) g_object_unref, NULL);
- * g_list_free (list);
+ * g_list_free_full (list, g_object_unref);
* </programlisting></informalexample>
*
* Return value: the list of #GAppInfo<!---->s that can be used to open all
@@ -3612,8 +3611,7 @@ thunar_file_list_get_applications (GList *file_list)
}
/* release the list of applications for this file */
- g_list_foreach (list, (GFunc) g_object_unref, NULL);
- g_list_free (list);
+ g_list_free_full (list, g_object_unref);
}
/* check if the set is still not empty */
diff --git a/thunar/thunar-list-model.c b/thunar/thunar-list-model.c
index 018af4e..940bd99 100644
--- a/thunar/thunar-list-model.c
+++ b/thunar/thunar-list-model.c
@@ -1876,8 +1876,7 @@ thunar_list_model_set_folder (ThunarListModel *store,
g_slist_free (rows);
/* remove hidden entries */
- g_slist_foreach (store->hidden, (GFunc) g_object_unref, NULL);
- g_slist_free (store->hidden);
+ g_slist_free_full (store->hidden, g_object_unref);
store->hidden = NULL;
/* unregister signals and drop the reference */
@@ -2170,8 +2169,7 @@ thunar_list_model_get_num_files (ThunarListModel *store)
*
* The caller is responsible to free the returned list using:
* <informalexample><programlisting>
- * g_list_foreach (list, (GFunc) gtk_tree_path_free, NULL);
- * g_list_free (list);
+ * g_list_free_full (list, (GDestroyNotify) gtk_tree_path_free);
* </programlisting></informalexample>
*
* Return value: the list of #GtkTreePath<!---->s for @files.
@@ -2206,8 +2204,7 @@ thunar_list_model_get_paths_for_files (ThunarListModel *store,
*
* The caller is responsible to free the returned list using:
* <informalexample><programlisting>
- * g_list_foreach (list, (GFunc) gtk_tree_path_free, NULL);
- * g_list_free (list);
+ * g_list_free_full (list, (GDestroyNotify) gtk_tree_path_free);
* </programlisting></informalexample>
*
* Return value: the list of #GtkTreePath<!---->s that match @pattern.
diff --git a/thunar/thunar-permissions-chooser.c b/thunar/thunar-permissions-chooser.c
index 260a452..542650c 100644
--- a/thunar/thunar-permissions-chooser.c
+++ b/thunar/thunar-permissions-chooser.c
@@ -976,8 +976,7 @@ thunar_permissions_chooser_file_changed (ThunarPermissionsChooser *chooser)
if (G_LIKELY (group != NULL))
g_object_unref (G_OBJECT (group));
- g_list_foreach (groups, (GFunc) g_object_unref, NULL);
- g_list_free (groups);
+ g_list_free_full (groups, g_object_unref);
/* determine the file mode and update the combo boxes */
for (n = 0; n < G_N_ELEMENTS (chooser->access_combos); ++n)
diff --git a/thunar/thunar-properties-dialog.c b/thunar/thunar-properties-dialog.c
index d4a6e1b..ef77986 100644
--- a/thunar/thunar-properties-dialog.c
+++ b/thunar/thunar-properties-dialog.c
@@ -577,8 +577,7 @@ thunar_properties_dialog_finalize (GObject *object)
g_object_unref (dialog->thumbnailer);
/* release the provider property pages */
- g_list_foreach (dialog->provider_pages, (GFunc) g_object_unref, NULL);
- g_list_free (dialog->provider_pages);
+ g_list_free_full (dialog->provider_pages, g_object_unref);
/* drop the reference on the provider factory */
g_object_unref (dialog->provider_factory);
diff --git a/thunar/thunar-renamer-dialog.c b/thunar/thunar-renamer-dialog.c
index a19639d..02c7813 100644
--- a/thunar/thunar-renamer-dialog.c
+++ b/thunar/thunar-renamer-dialog.c
@@ -608,8 +608,7 @@ thunar_renamer_dialog_init (ThunarRenamerDialog *renamer_dialog)
}
/* release the renamers list */
- g_list_foreach (renamers, (GFunc) g_object_unref, NULL);
- g_list_free (renamers);
+ g_list_free_full (renamers, g_object_unref);
}
@@ -1518,8 +1517,7 @@ thunar_renamer_dialog_drag_drop (GtkWidget *tree_view,
/* perform the move */
thunar_renamer_model_reorder (renamer_dialog->model, rows, position);
- g_list_foreach (rows, (GFunc) gtk_tree_path_free, NULL);
- g_list_free (rows);
+ g_list_free_full (rows, (GDestroyNotify) gtk_tree_path_free);
}
/* finish the dnd operation */
diff --git a/thunar/thunar-renamer-model.c b/thunar/thunar-renamer-model.c
index 0b1ccfa..f8a992f 100644
--- a/thunar/thunar-renamer-model.c
+++ b/thunar/thunar-renamer-model.c
@@ -119,7 +119,7 @@ static gchar *thunar_renamer_model_process_item (ThunarR
static gboolean thunar_renamer_model_update_idle (gpointer user_data);
static void thunar_renamer_model_update_idle_destroy (gpointer user_data);
static ThunarRenamerModelItem *thunar_renamer_model_item_new (ThunarFile *file) G_GNUC_MALLOC;
-static void thunar_renamer_model_item_free (ThunarRenamerModelItem *item);
+static void thunar_renamer_model_item_free (gpointer data);
static gint thunar_renamer_model_cmp_array (gconstpointer pointer_a,
gconstpointer pointer_b,
gpointer user_data);
@@ -288,8 +288,7 @@ thunar_renamer_model_finalize (GObject *object)
thunar_renamer_model_set_renamer (renamer_model, NULL);
/* release all items */
- g_list_foreach (renamer_model->items, (GFunc) thunar_renamer_model_item_free, NULL);
- g_list_free (renamer_model->items);
+ g_list_free_full (renamer_model->items, thunar_renamer_model_item_free);
/* disconnect from the file monitor */
g_signal_handlers_disconnect_by_func (G_OBJECT (renamer_model->file_monitor), thunar_renamer_model_file_destroyed, renamer_model);
@@ -977,8 +976,10 @@ thunar_renamer_model_item_new (ThunarFile *file)
static void
-thunar_renamer_model_item_free (ThunarRenamerModelItem *item)
+thunar_renamer_model_item_free (gpointer data)
{
+ ThunarRenamerModelItem *item = data;
+
g_object_unref (G_OBJECT (item->file));
g_free (item->name);
g_slice_free (ThunarRenamerModelItem, item);
diff --git a/thunar/thunar-renamer-pair.c b/thunar/thunar-renamer-pair.c
index 544ed28..8d26d8f 100644
--- a/thunar/thunar-renamer-pair.c
+++ b/thunar/thunar-renamer-pair.c
@@ -98,13 +98,14 @@ thunar_renamer_pair_copy (ThunarRenamerPair *renamer_pair)
/**
* thunar_renamer_pair_free:
- * @renamer_pair : a #ThunarRenamerPair.
+ * @data : a #ThunarRenamerPair.
*
* Frees the specified @renamer_pair.
**/
void
-thunar_renamer_pair_free (ThunarRenamerPair *renamer_pair)
+thunar_renamer_pair_free (gpointer data)
{
+ ThunarRenamerPair *renamer_pair = data;
if (G_LIKELY (renamer_pair != NULL))
{
g_object_unref (G_OBJECT (renamer_pair->file));
@@ -150,8 +151,7 @@ thunar_renamer_pair_list_copy (GList *renamer_pair_list)
void
thunar_renamer_pair_list_free (GList *renamer_pair_list)
{
- g_list_foreach (renamer_pair_list, (GFunc) thunar_renamer_pair_free, NULL);
- g_list_free (renamer_pair_list);
+ g_list_free_full (renamer_pair_list, thunar_renamer_pair_free);
}
diff --git a/thunar/thunar-renamer-pair.h b/thunar/thunar-renamer-pair.h
index aa930b9..858d5ff 100644
--- a/thunar/thunar-renamer-pair.h
+++ b/thunar/thunar-renamer-pair.h
@@ -40,7 +40,7 @@ ThunarRenamerPair *thunar_renamer_pair_new (ThunarFile *file,
const gchar *name) G_GNUC_MALLOC;
ThunarRenamerPair *thunar_renamer_pair_copy (ThunarRenamerPair *renamer_pair) G_GNUC_MALLOC;
-void thunar_renamer_pair_free (ThunarRenamerPair *renamer_pair);
+void thunar_renamer_pair_free (gpointer data);
GList *thunar_renamer_pair_list_copy (GList *renamer_pair_list) G_GNUC_MALLOC;
void thunar_renamer_pair_list_free (GList *renamer_pair_list);
diff --git a/thunar/thunar-sendto-model.c b/thunar/thunar-sendto-model.c
index ee13a45..9c6a952 100644
--- a/thunar/thunar-sendto-model.c
+++ b/thunar/thunar-sendto-model.c
@@ -93,8 +93,7 @@ thunar_sendto_model_finalize (GObject *object)
GList *lp;
/* release the handlers */
- g_list_foreach (sendto_model->handlers, (GFunc) g_object_unref, NULL);
- g_list_free (sendto_model->handlers);
+ g_list_free_full (sendto_model->handlers, g_object_unref);
/* disconnect all monitors */
for (lp = sendto_model->monitors; lp != NULL; lp = lp->next)
@@ -171,8 +170,7 @@ thunar_sendto_model_event (GFileMonitor *monitor,
/* release the previously loaded handlers */
if (G_LIKELY (sendto_model->handlers != NULL))
{
- g_list_foreach (sendto_model->handlers, (GFunc) g_object_unref, NULL);
- g_list_free (sendto_model->handlers);
+ g_list_free_full (sendto_model->handlers, g_object_unref);
sendto_model->handlers = NULL;
}
@@ -222,8 +220,7 @@ thunar_sendto_model_get_default (void)
* The returned list is owned by the caller and must be freed when no
* longer needed, using:
* <informalexample><programlisting>
- * g_list_foreach (list, (GFunc) g_object_unref, NULL);
- * g_list_free (list);
+ * g_list_free_full (list, g_object_unref);
* </programlisting></informalexample>
*
* Return value: a #GList of supported #GAppInfo<!---->s as
diff --git a/thunar/thunar-shortcuts-model.c b/thunar/thunar-shortcuts-model.c
index a2f67eb..39bd646 100644
--- a/thunar/thunar-shortcuts-model.c
+++ b/thunar/thunar-shortcuts-model.c
@@ -356,8 +356,7 @@ thunar_shortcuts_model_finalize (GObject *object)
g_list_free (model->shortcuts);
/* free all hidden volumes */
- g_list_foreach (model->hidden_volumes, (GFunc) g_object_unref, NULL);
- g_list_free (model->hidden_volumes);
+ g_list_free_full (model->hidden_volumes, g_object_unref);
/* detach from the file monitor */
if (model->monitor != NULL)
diff --git a/thunar/thunar-standard-view.c b/thunar/thunar-standard-view.c
index 56e8eab..50bf0d7 100644
--- a/thunar/thunar-standard-view.c
+++ b/thunar/thunar-standard-view.c
@@ -1056,8 +1056,7 @@ thunar_standard_view_set_selected_files (ThunarComponent *component,
(*THUNAR_STANDARD_VIEW_GET_CLASS (standard_view)->scroll_to_path) (standard_view, first_path, FALSE, 0.0f, 0.0f);
/* release the tree paths */
- g_list_foreach (paths, (GFunc) gtk_tree_path_free, NULL);
- g_list_free (paths);
+ g_list_free_full (paths, (GDestroyNotify) gtk_tree_path_free);
}
}
}
@@ -1355,8 +1354,7 @@ thunar_standard_view_get_statusbar_text (ThunarView *view)
return _("Loading folder contents...");
standard_view->statusbar_text = thunar_list_model_get_statusbar_text (standard_view->model, items);
- g_list_foreach (items, (GFunc) gtk_tree_path_free, NULL);
- g_list_free (items);
+ g_list_free_full (items, (GDestroyNotify) gtk_tree_path_free);
}
return standard_view->statusbar_text;
@@ -1529,8 +1527,7 @@ thunar_standard_view_scroll_to_file (ThunarView *view,
}
/* cleanup */
- g_list_foreach (paths, (GFunc) gtk_tree_path_free, NULL);
- g_list_free (paths);
+ g_list_free_full (paths, (GDestroyNotify) gtk_tree_path_free);
}
}
}
@@ -3074,8 +3071,7 @@ thunar_standard_view_row_deleted (ThunarListModel *model,
/* Do nothing if the deleted row is not selected or there is more than one file selected */
if (G_UNLIKELY (g_list_find_custom (selected_items, path, (GCompareFunc) gtk_tree_path_compare) == NULL || g_list_length (selected_items) != 1))
{
- g_list_foreach (selected_items, (GFunc) gtk_tree_path_free, NULL);
- g_list_free (selected_items);
+ g_list_free_full (selected_items, (GDestroyNotify) gtk_tree_path_free);
return;
}
@@ -3096,8 +3092,7 @@ thunar_standard_view_row_deleted (ThunarListModel *model,
}
/* Free path list */
- g_list_foreach (selected_items, (GFunc) gtk_tree_path_free, NULL);
- g_list_free (selected_items);
+ g_list_free_full (selected_items, (GDestroyNotify) gtk_tree_path_free);
}
@@ -3436,8 +3431,7 @@ thunar_standard_view_request_thumbnails (ThunarStandardView *standard_view)
&standard_view->priv->thumbnail_request);
/* release the file list */
- g_list_foreach (visible_files, (GFunc) g_object_unref, NULL);
- g_list_free (visible_files);
+ g_list_free_full (visible_files, g_object_unref);
/* release the start and end path */
gtk_tree_path_free (start_path);
@@ -3536,8 +3530,7 @@ thunar_standard_view_context_menu (ThunarStandardView *standard_view,
/* merge the custom menu actions for the selected items */
selected_items = (*THUNAR_STANDARD_VIEW_GET_CLASS (standard_view)->get_selected_items) (standard_view);
thunar_standard_view_merge_custom_actions (standard_view, selected_items);
- g_list_foreach (selected_items, (GFunc) gtk_tree_path_free, NULL);
- g_list_free (selected_items);
+ g_list_free_full (selected_items, (GDestroyNotify) gtk_tree_path_free);
/* grab an additional reference on the view */
g_object_ref (G_OBJECT (standard_view));
diff --git a/thunar/thunar-templates-action.c b/thunar/thunar-templates-action.c
index 2202dc5..c700d21 100644
--- a/thunar/thunar-templates-action.c
+++ b/thunar/thunar-templates-action.c
@@ -509,8 +509,7 @@ thunar_templates_action_menu_shown (GtkWidget *menu,
/* drop all existing children of the menu first */
children = gtk_container_get_children (GTK_CONTAINER (menu));
- g_list_foreach (children, (GFunc) gtk_widget_destroy, NULL);
- g_list_free (children);
+ g_list_free_full (children, (GDestroyNotify) gtk_widget_destroy);
if (G_LIKELY (templates_action->job == NULL))
{
diff --git a/thunar/thunar-thumbnail-cache.c b/thunar/thunar-thumbnail-cache.c
index 90762b6..b5f541c 100644
--- a/thunar/thunar-thumbnail-cache.c
+++ b/thunar/thunar-thumbnail-cache.c
@@ -132,37 +132,28 @@ thunar_thumbnail_cache_finalize (GObject *object)
/* drop the move queue idle and all queued files */
if (cache->move_queue_idle_id > 0)
g_source_remove (cache->move_queue_idle_id);
- g_list_foreach (cache->move_source_queue, (GFunc) g_object_unref, NULL);
- g_list_foreach (cache->move_target_queue, (GFunc) g_object_unref, NULL);
- g_list_free (cache->move_source_queue);
- g_list_free (cache->move_target_queue);
+ g_list_free_full (cache->move_source_queue, g_object_unref);
+ g_list_free_full (cache->move_target_queue, g_object_unref);
/* drop the copy queue idle and all queued files */
if (cache->copy_queue_idle_id > 0)
g_source_remove (cache->copy_queue_idle_id);
- g_list_foreach (cache->copy_source_queue, (GFunc) g_object_unref, NULL);
- g_list_foreach (cache->copy_target_queue, (GFunc) g_object_unref, NULL);
- g_list_free (cache->copy_source_queue);
- g_list_free (cache->copy_target_queue);
+ g_list_free_full (cache->copy_source_queue, g_object_unref);
+ g_list_free_full (cache->copy_target_queue, g_object_unref);
/* drop the delete queue idle and all queued files */
if (cache->delete_queue_idle_id > 0)
g_source_remove (cache->delete_queue_idle_id);
- g_list_foreach (cache->delete_queue, (GFunc) g_object_unref, NULL);
- g_list_free (cache->delete_queue);
+ g_list_free_full (cache->delete_queue, g_object_unref);
/* drop the cleanup queue idle and all queued files */
if (cache->cleanup_queue_idle_id > 0)
g_source_remove (cache->cleanup_queue_idle_id);
- g_list_foreach (cache->cleanup_queue, (GFunc) g_object_unref, NULL);
- g_list_free (cache->cleanup_queue);
+ g_list_free_full (cache->cleanup_queue, g_object_unref);
/* check if we have a valid cache proxy */
if (cache->cache_proxy != NULL)
- {
- /* release the cache proxy itself */
- g_object_unref (cache->cache_proxy);
- }
+ g_object_unref (cache->cache_proxy);
/* release the cache lock */
g_mutex_unlock (cache->lock);
diff --git a/thunar/thunar-transfer-job.c b/thunar/thunar-transfer-job.c
index 2eeee5d..53eeeda 100644
--- a/thunar/thunar-transfer-job.c
+++ b/thunar/thunar-transfer-job.c
@@ -43,7 +43,7 @@ typedef struct _ThunarTransferNode ThunarTransferNode;
static void thunar_transfer_job_finalize (GObject *object);
static gboolean thunar_transfer_job_execute (ExoJob *job,
GError **error);
-static void thunar_transfer_node_free (ThunarTransferNode *node);
+static void thunar_transfer_node_free (gpointer data);
@@ -114,8 +114,7 @@ thunar_transfer_job_finalize (GObject *object)
{
ThunarTransferJob *job = THUNAR_TRANSFER_JOB (object);
- g_list_foreach (job->source_node_list, (GFunc) thunar_transfer_node_free, NULL);
- g_list_free (job->source_node_list);
+ g_list_free_full (job->source_node_list, thunar_transfer_node_free);
thunar_g_file_list_free (job->target_file_list);
@@ -858,8 +857,9 @@ thunar_transfer_job_execute (ExoJob *job,
static void
-thunar_transfer_node_free (ThunarTransferNode *node)
+thunar_transfer_node_free (gpointer data)
{
+ ThunarTransferNode *node = data;
ThunarTransferNode *next;
/* free all nodes in a row */
diff --git a/thunar/thunar-tree-model.c b/thunar/thunar-tree-model.c
index 13c2107..6a6ef0b 100644
--- a/thunar/thunar-tree-model.c
+++ b/thunar/thunar-tree-model.c
@@ -383,8 +383,7 @@ thunar_tree_model_finalize (GObject *object)
g_object_unref (model->file_monitor);
/* release all hidden volumes */
- g_list_foreach (model->hidden_volumes, (GFunc) g_object_unref, NULL);
- g_list_free (model->hidden_volumes);
+ g_list_free_full (model->hidden_volumes, g_object_unref);
/* release all resources allocated to the model */
g_node_traverse (model->root, G_POST_ORDER, G_TRAVERSE_ALL, -1, thunar_tree_model_node_traverse_free, NULL);
@@ -1263,8 +1262,7 @@ thunar_tree_model_item_reset (ThunarTreeModelItem *item)
/* free all the invisible children */
if (item->invisible_children != NULL)
{
- g_slist_foreach (item->invisible_children, (GFunc) g_object_unref, NULL);
- g_slist_free (item->invisible_children);
+ g_slist_free_full (item->invisible_children, g_object_unref);
item->invisible_children = NULL;
}
diff --git a/thunar/thunar-user.c b/thunar/thunar-user.c
index 9d317c8..5567845 100644
--- a/thunar/thunar-user.c
+++ b/thunar/thunar-user.c
@@ -239,8 +239,7 @@ thunar_user_finalize (GObject *object)
ThunarUser *user = THUNAR_USER (object);
/* unref the associated groups */
- g_list_foreach (user->groups, (GFunc) g_object_unref, NULL);
- g_list_free (user->groups);
+ g_list_free_full (user->groups, g_object_unref);
/* drop the reference on the primary group */
if (G_LIKELY (user->primary_group != NULL))
@@ -737,8 +736,7 @@ thunar_user_manager_get_user_by_id (ThunarUserManager *manager,
*
* The caller is responsible to free the returned list using:
* <informalexample><programlisting>
- * g_list_foreach (list, (GFunc) g_object_unref, NULL);
- * g_list_free (list);
+ * g_list_free_full (list, g_object_unref);
* </programlisting></informalexample>
*
* Return value: the list of all groups known to the @manager.
diff --git a/thunar/thunar-window.c b/thunar/thunar-window.c
index a669cb4..cd2d355 100644
--- a/thunar/thunar-window.c
+++ b/thunar/thunar-window.c
@@ -1623,8 +1623,7 @@ thunar_window_action_close_all_windows (GtkAction *action,
g_object_unref (G_OBJECT (application));
/* destroy all open windows */
- g_list_foreach (windows, (GFunc) gtk_widget_destroy, NULL);
- g_list_free (windows);
+ g_list_free_full (windows, (GDestroyNotify) gtk_widget_destroy);
}
diff --git a/thunarx/thunarx-file-info.c b/thunarx/thunarx-file-info.c
index 0c0c5eb..60c8dcf 100644
--- a/thunarx/thunarx-file-info.c
+++ b/thunarx/thunarx-file-info.c
@@ -443,9 +443,5 @@ thunarx_file_info_list_copy (GList *file_infos)
void
thunarx_file_info_list_free (GList *file_infos)
{
- if (file_infos != NULL)
- {
- g_list_foreach (file_infos, (GFunc) g_object_unref, NULL);
- g_list_free (file_infos);
- }
-}
+ g_list_free_full (file_infos, g_object_unref);
+}
diff --git a/thunarx/thunarx-menu-provider.c b/thunarx/thunarx-menu-provider.c
index ea3f3e9..3fe75a9 100644
--- a/thunarx/thunarx-menu-provider.c
+++ b/thunarx/thunarx-menu-provider.c
@@ -73,8 +73,7 @@ thunarx_menu_provider_get_type (void)
* The caller is responsible to free the returned list of actions using
* something like this when no longer needed:
* <informalexample><programlisting>
- * g_list_foreach (list, (GFunc) g_object_unref, NULL);
- * g_list_free (list);
+ * g_list_free_full (list, g_object_unref);
* </programlisting></informalexample>
*
* Return value: the list of #GtkAction<!---->s that @provider has to offer
@@ -129,8 +128,7 @@ thunarx_menu_provider_get_file_actions (ThunarxMenuProvider *provider,
* The caller is responsible to free the returned list of actions using
* something like this when no longer needed:
* <informalexample><programlisting>
- * g_list_foreach (list, (GFunc) g_object_unref, NULL);
- * g_list_free (list);
+ * g_list_free_full (list, g_object_unref);
* </programlisting></informalexample>
*
* Return value: the list of #GtkAction<!---->s that @provider has to offer
@@ -190,8 +188,7 @@ thunarx_menu_provider_get_folder_actions (ThunarxMenuProvider *provider,
* The caller is responsible to free the returned list of actions using
* something like this when no longer needed:
* <informalexample><programlisting>
- * g_list_foreach (list, (GFunc) g_object_unref, NULL);
- * g_list_free (list);
+ * g_list_free_full (list, g_object_unref);
* </programlisting></informalexample>
*
* Return value: the list of #GtkAction<!---->s that @provider has to offer
diff --git a/thunarx/thunarx-preferences-provider.c b/thunarx/thunarx-preferences-provider.c
index 41ac747..c675b3f 100644
--- a/thunarx/thunarx-preferences-provider.c
+++ b/thunarx/thunarx-preferences-provider.c
@@ -72,8 +72,7 @@ thunarx_preferences_provider_get_type (void)
* The caller is responsible to free the returned list of actions using
* something like this when no longer needed:
* <informalexample><programlisting>
- * g_list_foreach (list, (GFunc) g_object_unref, NULL);
- * g_list_free (list);
+ * g_list_free_full (list, g_object_unref);
* </programlisting></informalexample>
*
* Return value: the list of #GtkAction<!---->s that @provider has
diff --git a/thunarx/thunarx-property-page-provider.c b/thunarx/thunarx-property-page-provider.c
index aac8671..524492c 100644
--- a/thunarx/thunarx-property-page-provider.c
+++ b/thunarx/thunarx-property-page-provider.c
@@ -94,8 +94,7 @@ thunarx_property_page_provider_get_type (void)
* something like this when no longer needed:
* <informalexample><programlisting>
* g_list_foreach (list, (GFunc) g_object_ref_sink, NULL);
- * g_list_foreach (list, (GFunc) g_object_unref, NULL);
- * g_list_free (list);
+ * g_list_free_full (list, g_object_unref);
* </programlisting></informalexample>
*
* Return value: the list of #ThunarxPropertyPage<!---->s that @provider has to offer
diff --git a/thunarx/thunarx-provider-factory.c b/thunarx/thunarx-provider-factory.c
index 0090501..1b5d2a3 100644
--- a/thunarx/thunarx-provider-factory.c
+++ b/thunarx/thunarx-provider-factory.c
@@ -277,8 +277,7 @@ thunarx_provider_factory_get_default (void)
* The caller is responsible to release the returned
* list of providers using code like this:
* <informalexample><programlisting>
- * g_list_foreach (list, (GFunc) g_object_unref, NULL);
- * g_list_free (list);
+ * g_list_free_full (list, g_object_unref);
* </programlisting></informalexample>
*
* Return value: the of providers for @type.
diff --git a/thunarx/thunarx-renamer-provider.c b/thunarx/thunarx-renamer-provider.c
index 56fcfce..2810c8b 100644
--- a/thunarx/thunarx-renamer-provider.c
+++ b/thunarx/thunarx-renamer-provider.c
@@ -78,8 +78,7 @@ thunarx_renamer_provider_get_type (void)
* The caller is responsible to free the returned list of renamers using
* something like this when no longer needed:
* <informalexample><programlisting>
- * g_list_foreach (list, (GFunc) g_object_unref, NULL);
- * g_list_free (list);
+ * g_list_free_full (list, g_object_unref);
* </programlisting></informalexample>
*
* Return value: the list of #ThunarxRenamer<!---->s provided by the
diff --git a/thunarx/thunarx-renamer.c b/thunarx/thunarx-renamer.c
index 09cebbd..92f50d1 100644
--- a/thunarx/thunarx-renamer.c
+++ b/thunarx/thunarx-renamer.c
@@ -639,8 +639,7 @@ thunarx_renamer_save (ThunarxRenamer *renamer,
* The caller is responsible to free the returned list using something
* like the following:
* <informalexample><programlisting>
- * g_list_foreach (list, (GFunc) g_object_unref, NULL);
- * g_list_free (list);
+ * g_list_free_full (list, g_object_unref);
* </programlisting></informalexample>
*
* As a special note, this method automatically takes a reference on the
More information about the Xfce4-commits
mailing list