summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--eel/eel-glib-extensions.c17
-rw-r--r--libcaja-private/caja-autorun.c5
-rw-r--r--libcaja-private/caja-clipboard.c5
-rw-r--r--libcaja-private/caja-customization-data.c8
-rw-r--r--libcaja-private/caja-debug-log.c5
-rw-r--r--libcaja-private/caja-directory-async.c23
-rw-r--r--libcaja-private/caja-directory.c23
-rw-r--r--libcaja-private/caja-dnd.c9
-rw-r--r--libcaja-private/caja-emblem-utils.c5
-rw-r--r--libcaja-private/caja-file-changes-queue.c17
-rw-r--r--libcaja-private/caja-file-dnd.c5
-rw-r--r--libcaja-private/caja-file-operations.c26
-rw-r--r--libcaja-private/caja-file-utilities.c5
-rw-r--r--libcaja-private/caja-file.c29
-rw-r--r--libcaja-private/caja-icon-canvas-item.c8
-rw-r--r--libcaja-private/caja-icon-container.c5
-rw-r--r--libcaja-private/caja-merged-directory.c5
-rw-r--r--libcaja-private/caja-mime-actions.c11
-rw-r--r--libcaja-private/caja-mime-application-chooser.c5
-rw-r--r--libcaja-private/caja-open-with-dialog.c5
-rw-r--r--libcaja-private/caja-program-choosing.c14
-rw-r--r--libcaja-private/caja-query.c7
-rw-r--r--libcaja-private/caja-search-engine-beagle.c5
-rw-r--r--libcaja-private/caja-search-engine-simple.c11
-rw-r--r--libcaja-private/caja-search-engine-tracker.c7
-rw-r--r--libcaja-private/caja-undostack-manager.c32
-rw-r--r--src/caja-application.c12
-rw-r--r--src/caja-bookmark-list.c5
-rw-r--r--src/caja-emblem-sidebar.c5
-rw-r--r--src/caja-history-sidebar.c5
-rw-r--r--src/caja-information-panel.c5
-rw-r--r--src/caja-navigation-window-slot.c8
-rw-r--r--src/caja-pathbar.c5
-rw-r--r--src/caja-places-sidebar.c5
-rw-r--r--src/caja-property-browser.c11
-rw-r--r--src/caja-query-editor.c5
-rw-r--r--src/caja-spatial-window.c5
-rw-r--r--src/caja-trash-bar.c5
-rw-r--r--src/caja-window-manage-views.c20
-rw-r--r--src/caja-window-slot.c5
-rw-r--r--src/caja-window.c14
-rw-r--r--src/file-manager/fm-directory-view.c41
-rw-r--r--src/file-manager/fm-list-model.c10
-rw-r--r--src/file-manager/fm-list-view.c11
-rw-r--r--src/file-manager/fm-properties-window.c32
-rw-r--r--src/file-manager/fm-tree-model.c5
-rw-r--r--src/file-manager/fm-tree-view.c11
47 files changed, 234 insertions, 288 deletions
diff --git a/eel/eel-glib-extensions.c b/eel/eel-glib-extensions.c
index 5b016aad..ee108050 100644
--- a/eel/eel-glib-extensions.c
+++ b/eel/eel-glib-extensions.c
@@ -38,6 +38,8 @@
#include <time.h>
#include <locale.h>
+#include <src/glibcompat.h> /* for g_list_free_full */
+
/* Legal conversion specifiers, as specified in the C standard. */
#define C_STANDARD_STRFTIME_CHARACTERS "aAbBcdHIjmMpSUwWxXyYZ"
#define C_STANDARD_NUMERIC_STRFTIME_CHARACTERS "dHIjmMSUwWyY"
@@ -1034,16 +1036,11 @@ eel_self_check_glib_extensions (void)
EEL_CHECK_BOOLEAN_RESULT (eel_g_str_list_equal (compare_list_1, compare_list_4), FALSE);
EEL_CHECK_BOOLEAN_RESULT (eel_g_str_list_equal (compare_list_1, compare_list_5), FALSE);
- g_list_foreach (compare_list_1, (GFunc) g_free, NULL);
- g_list_free(compare_list_1);
- g_list_foreach (compare_list_2, (GFunc) g_free, NULL);
- g_list_free(compare_list_2);
- g_list_foreach (compare_list_3, (GFunc) g_free, NULL);
- g_list_free(compare_list_3);
- g_list_foreach (compare_list_4, (GFunc) g_free, NULL);
- g_list_free(compare_list_4);
- g_list_foreach (compare_list_5, (GFunc) g_free, NULL);
- g_list_free(compare_list_5);
+ g_list_free_full (compare_list_1, g_free);
+ g_list_free_full (compare_list_2, g_free);
+ g_list_free_full (compare_list_3, g_free);
+ g_list_free_full (compare_list_4, g_free);
+ g_list_free_full (compare_list_5, g_free);
/* eel_g_list_partition */
diff --git a/libcaja-private/caja-autorun.c b/libcaja-private/caja-autorun.c
index 66534642..2896cb9d 100644
--- a/libcaja-private/caja-autorun.c
+++ b/libcaja-private/caja-autorun.c
@@ -43,6 +43,8 @@
#include "caja-desktop-icon-file.h"
#include "caja-file-utilities.h"
+#include <src/glibcompat.h> /* for g_list_free_full */
+
enum
{
AUTORUN_ASK,
@@ -651,8 +653,7 @@ caja_autorun_prepare_combo_box (GtkWidget *combo_box,
{
g_object_unref (default_app_info);
}
- g_list_foreach (app_info_list, (GFunc) g_object_unref, NULL);
- g_list_free(app_info_list);
+ g_list_free_full (app_info_list, g_object_unref);
gtk_combo_box_set_model (GTK_COMBO_BOX (combo_box), GTK_TREE_MODEL (list_store));
g_object_unref (G_OBJECT (list_store));
diff --git a/libcaja-private/caja-clipboard.c b/libcaja-private/caja-clipboard.c
index bce5d552..2cc61f7a 100644
--- a/libcaja-private/caja-clipboard.c
+++ b/libcaja-private/caja-clipboard.c
@@ -35,6 +35,8 @@
#include <gtk/gtk.h>
#include <string.h>
+#include <src/glibcompat.h> /* for g_list_free_full */
+
typedef struct _TargetCallbackData TargetCallbackData;
typedef void (* SelectAllCallback) (gpointer target);
@@ -681,7 +683,6 @@ caja_clipboard_clear_if_colliding_uris (GtkWidget *widget,
}
if (clipboard_item_uris) {
- g_list_foreach (clipboard_item_uris, (GFunc) g_free, NULL);
- g_list_free(clipboard_item_uris);
+ g_list_free_full (clipboard_item_uris, g_free);
}
}
diff --git a/libcaja-private/caja-customization-data.c b/libcaja-private/caja-customization-data.c
index 01521d0a..a1019301 100644
--- a/libcaja-private/caja-customization-data.c
+++ b/libcaja-private/caja-customization-data.c
@@ -43,6 +43,8 @@
#include <stdlib.h>
#include <string.h>
+#include <src/glibcompat.h> /* for g_list_free_full */
+
typedef enum
{
READ_PUBLIC_CUSTOMIZATIONS,
@@ -304,10 +306,8 @@ caja_customization_data_destroy (CajaCustomizationData *data)
g_object_unref (data->pattern_frame);
}
- g_list_foreach(data->public_file_list, (GFunc) g_object_unref, NULL);
- g_list_free(data->public_file_list);
- g_list_foreach(data->private_file_list, (GFunc) g_object_unref, NULL);
- g_list_free(data->private_file_list);
+ g_list_free_full (data->public_file_list, g_object_unref);
+ g_list_free_full (data->private_file_list, g_object_unref);
if (data->name_map_hash != NULL)
{
diff --git a/libcaja-private/caja-debug-log.c b/libcaja-private/caja-debug-log.c
index 1ccfed0b..4b18ca80 100644
--- a/libcaja-private/caja-debug-log.c
+++ b/libcaja-private/caja-debug-log.c
@@ -30,6 +30,8 @@
#include "caja-debug-log.h"
#include "caja-file.h"
+#include <src/glibcompat.h> /* for g_list_free_full */
+
#define DEFAULT_RING_BUFFER_NUM_LINES 1000
#define KEY_FILE_GROUP "debug log"
@@ -308,8 +310,7 @@ caja_debug_log_with_file_list (gboolean is_milestone, const char *domain, GList
caja_debug_logv (is_milestone, domain, uris, format, args);
va_end (args);
- g_list_foreach (uris, (GFunc) g_free, NULL);
- g_list_free(uris);
+ g_list_free_full (uris, g_free);
}
gboolean
diff --git a/libcaja-private/caja-directory-async.c b/libcaja-private/caja-directory-async.c
index 9694b1b0..91a2ffb4 100644
--- a/libcaja-private/caja-directory-async.c
+++ b/libcaja-private/caja-directory-async.c
@@ -39,6 +39,8 @@
#include <stdio.h>
#include <stdlib.h>
+#include <src/glibcompat.h> /* for g_list_free_full */
+
/* turn this on to see messages about each load_directory call: */
#if 0
#define DEBUG_LOAD_DIRECTORY
@@ -1079,8 +1081,7 @@ dequeue_pending_idle_callback (gpointer callback_data)
file->details->got_mime_list = TRUE;
file->details->mime_list_is_up_to_date = TRUE;
- g_list_foreach (file->details->mime_list, (GFunc) g_free, NULL);
- g_list_free(file->details->mime_list);
+ g_list_free_full (file->details->mime_list, g_free);
file->details->mime_list = istr_set_get_as_list
(dir_load_state->load_mime_list_hash);
@@ -1093,8 +1094,7 @@ dequeue_pending_idle_callback (gpointer callback_data)
}
drain:
- g_list_foreach (pending_file_info, (GFunc) g_object_unref, NULL);
- g_list_free(pending_file_info);
+ g_list_free_full (pending_file_info, g_object_unref);
/* Get the state machine running again. */
caja_directory_async_state_changed (directory);
@@ -1182,8 +1182,7 @@ file_list_cancel (CajaDirectory *directory)
if (directory->details->pending_file_info != NULL)
{
- g_list_foreach (directory->details->pending_file_info, (GFunc) g_object_unref, NULL);
- g_list_free(directory->details->pending_file_info);
+ g_list_free_full (directory->details->pending_file_info, g_object_unref);
directory->details->pending_file_info = NULL;
}
@@ -2788,8 +2787,7 @@ count_more_files_callback (GObject *source_object,
state);
}
- g_list_foreach (files, (GFunc) g_object_unref, NULL);
- g_list_free(files);
+ g_list_free_full (files, g_object_unref);
if (error)
{
@@ -3014,8 +3012,7 @@ deep_count_state_free (DeepCountState *state)
{
g_object_unref (state->deep_count_location);
}
- g_list_foreach (state->deep_count_subdirectories, (GFunc) g_object_unref, NULL);
- g_list_free(state->deep_count_subdirectories);
+ g_list_free_full (state->deep_count_subdirectories, g_object_unref);
g_array_free (state->seen_deep_count_inodes, TRUE);
g_free (state);
}
@@ -3323,8 +3320,7 @@ mime_list_done (MimeListState *state, gboolean success)
file = state->mime_list_file;
file->details->mime_list_is_up_to_date = TRUE;
- g_list_foreach(file->details->mime_list, (GFunc) g_free, NULL);
- g_list_free(file->details->mime_list);
+ g_list_free_full (file->details->mime_list, g_free);
if (success)
{
file->details->mime_list_failed = TRUE;
@@ -4579,8 +4575,7 @@ get_mount_at (GFile *target)
g_object_unref (root);
}
- g_list_foreach (mounts, (GFunc) g_object_unref, NULL);
- g_list_free(mounts);
+ g_list_free_full (mounts, g_object_unref);
g_object_unref (monitor);
diff --git a/libcaja-private/caja-directory.c b/libcaja-private/caja-directory.c
index 38d73794..50462916 100644
--- a/libcaja-private/caja-directory.c
+++ b/libcaja-private/caja-directory.c
@@ -40,6 +40,8 @@
#include <gtk/gtk.h>
#include <string.h>
+#include <src/glibcompat.h> /* for g_list_free_full */
+
enum
{
FILES_ADDED,
@@ -175,8 +177,7 @@ caja_directory_finalize (GObject *object)
if (directory->details->monitor_list != NULL)
{
g_warning ("destroying a CajaDirectory while it's being monitored");
- g_list_foreach(directory->details->monitor_list, (GFunc) g_free, NULL);
- g_list_free(directory->details->monitor_list);
+ g_list_free_full (directory->details->monitor_list, g_free);
}
if (directory->details->monitor != NULL)
@@ -213,8 +214,7 @@ caja_directory_finalize (GObject *object)
g_assert (directory->details->directory_load_in_progress == NULL);
g_assert (directory->details->count_in_progress == NULL);
g_assert (directory->details->dequeue_pending_idle_id == 0);
- g_list_foreach(directory->details->pending_file_info, (GFunc) g_object_unref, NULL);
- g_list_free(directory->details->pending_file_info);
+ g_list_free_full (directory->details->pending_file_info, g_object_unref);
EEL_CALL_PARENT (G_OBJECT_CLASS, finalize, (object));
}
@@ -941,8 +941,7 @@ call_get_file_info_free_list (gpointer key, gpointer value, gpointer user_data)
files = value;
caja_directory_get_info_for_new_files (directory, files);
- g_list_foreach (files, (GFunc) g_object_unref, NULL);
- g_list_free (files);
+ g_list_free_full (files, g_object_unref);
}
static void
@@ -1094,8 +1093,7 @@ caja_directory_notify_files_added_by_uri (GList *uris)
files = caja_file_list_from_uris (uris);
caja_directory_notify_files_added (files);
- g_list_foreach(files, (GFunc) g_object_unref, NULL);
- g_list_free(files);
+ g_list_free_full (files, g_object_unref);
}
void
@@ -1144,8 +1142,7 @@ caja_directory_notify_files_changed_by_uri (GList *uris)
files = caja_file_list_from_uris (uris);
caja_directory_notify_files_changed (files);
- g_list_foreach(files, (GFunc) g_object_unref, NULL);
- g_list_free(files);
+ g_list_free_full (files, g_object_unref);
}
void
@@ -1206,8 +1203,7 @@ caja_directory_notify_files_removed_by_uri (GList *uris)
files = caja_file_list_from_uris (uris);
caja_directory_notify_files_changed (files);
- g_list_foreach(files, (GFunc) g_object_unref, NULL);
- g_list_free(files);
+ g_list_free_full (files, g_object_unref);
}
static void
@@ -1500,8 +1496,7 @@ caja_directory_notify_files_moved_by_uri (GList *uri_pairs)
file_pairs = uri_pairs_to_file_pairs (uri_pairs);
caja_directory_notify_files_moved (file_pairs);
- g_list_foreach (file_pairs, (GFunc)g_file_pair_free, NULL);
- g_list_free (file_pairs);
+ g_list_free_full (file_pairs, g_file_pair_free);
}
void
diff --git a/libcaja-private/caja-dnd.c b/libcaja-private/caja-dnd.c
index feea5ca8..5943f041 100644
--- a/libcaja-private/caja-dnd.c
+++ b/libcaja-private/caja-dnd.c
@@ -44,6 +44,8 @@
#include <stdio.h>
#include <string.h>
+#include <src/glibcompat.h> /* for g_list_free_full */
+
/* a set of defines stolen from the eel-icon-dnd.c file.
* These are in microseconds.
*/
@@ -129,8 +131,7 @@ caja_drag_uri_array_from_selection_list (const GList *selection_list)
uri_list = caja_drag_uri_list_from_selection_list (selection_list);
uris = caja_drag_uri_array_from_list (uri_list);
- g_list_foreach(uri_list, (GFunc) g_free, NULL);
- g_list_free(uri_list);
+ g_list_free_full (uri_list, g_free);
return uris;
}
@@ -1316,9 +1317,7 @@ slot_proxy_handle_drop (GtkWidget *widget,
uri_list,
target_uri,
gdk_drag_context_get_selected_action (context));
- g_list_foreach(uri_list, (GFunc) g_free, NULL);
- g_list_free(uri_list);
-
+ g_list_free_full (uri_list, g_free);
}
else if (drag_info->info == CAJA_ICON_DND_URI_LIST)
{
diff --git a/libcaja-private/caja-emblem-utils.c b/libcaja-private/caja-emblem-utils.c
index dd70dbc3..f837df69 100644
--- a/libcaja-private/caja-emblem-utils.c
+++ b/libcaja-private/caja-emblem-utils.c
@@ -43,6 +43,8 @@
#include "caja-file.h"
#include "caja-emblem-utils.h"
+#include <src/glibcompat.h> /* for g_list_free_full */
+
#define EMBLEM_NAME_TRASH "emblem-trash"
#define EMBLEM_NAME_SYMLINK "emblem-symbolic-link"
#define EMBLEM_NAME_NOREAD "emblem-noread"
@@ -119,8 +121,7 @@ is_reserved_keyword (const char *keyword)
result = g_list_find_custom (available,
(char *) icon_name,
(GCompareFunc) g_ascii_strcasecmp) != NULL;
- g_list_foreach(available, (GFunc) g_free, NULL);
- g_list_free(available);
+ g_list_free_full (available, g_free);
g_free (icon_name);
return result;
}
diff --git a/libcaja-private/caja-file-changes-queue.c b/libcaja-private/caja-file-changes-queue.c
index 39cf123e..43495c93 100644
--- a/libcaja-private/caja-file-changes-queue.c
+++ b/libcaja-private/caja-file-changes-queue.c
@@ -25,6 +25,8 @@
#include "caja-directory-notify.h"
+#include <src/glibcompat.h> /* for g_list_free_full */
+
#ifdef G_THREADS_ENABLED
#define MUTEX_LOCK(a) if ((a) != NULL) g_mutex_lock (a)
#define MUTEX_UNLOCK(a) if ((a) != NULL) g_mutex_unlock (a)
@@ -288,8 +290,7 @@ pairs_list_free (GList *pairs)
}
/* delete the list and the now empty pair structs */
- g_list_foreach(pairs, (GFunc) g_free, NULL);
- g_list_free(pairs);
+ g_list_free_full (pairs, g_free);
}
static void
@@ -304,8 +305,7 @@ position_set_list_free (GList *list)
g_object_unref (item->location);
}
/* delete the list and the now empty structs */
- g_list_foreach(list, (GFunc) g_free, NULL);
- g_list_free(list);
+ g_list_free_full (list, g_free);
}
/* go through changes in the change queue, send ones with the same kind
@@ -387,8 +387,7 @@ caja_file_changes_consume_changes (gboolean consume_all)
{
deletions = g_list_reverse (deletions);
caja_directory_notify_files_removed (deletions);
- g_list_foreach(deletions, (GFunc) g_object_unref, NULL);
- g_list_free(deletions);
+ g_list_free_full (deletions, g_object_unref);
deletions = NULL;
}
if (moves != NULL)
@@ -402,16 +401,14 @@ caja_file_changes_consume_changes (gboolean consume_all)
{
additions = g_list_reverse (additions);
caja_directory_notify_files_added (additions);
- g_list_foreach(additions, (GFunc) g_object_unref, NULL);
- g_list_free(additions);
+ g_list_free_full (additions, g_object_unref);
additions = NULL;
}
if (changes != NULL)
{
changes = g_list_reverse (changes);
caja_directory_notify_files_changed (changes);
- g_list_foreach(changes, (GFunc) g_object_unref, NULL);
- g_list_free(changes);
+ g_list_free_full (changes, g_object_unref);
changes = NULL;
}
if (position_set_requests != NULL)
diff --git a/libcaja-private/caja-file-dnd.c b/libcaja-private/caja-file-dnd.c
index 2c239643..5e1beec5 100644
--- a/libcaja-private/caja-file-dnd.c
+++ b/libcaja-private/caja-file-dnd.c
@@ -32,6 +32,8 @@
#include "caja-file-utilities.h"
#include <string.h>
+#include <src/glibcompat.h> /* for g_list_free_full */
+
static gboolean
caja_drag_can_accept_files (CajaFile *drop_target_item)
{
@@ -181,6 +183,5 @@ caja_drag_file_receive_dropped_keyword (CajaFile *file,
}
caja_file_set_keywords (file, keywords);
- g_list_foreach(keywords, (GFunc) g_free, NULL);
- g_list_free(keywords);
+ g_list_free_full (keywords, g_free);
}
diff --git a/libcaja-private/caja-file-operations.c b/libcaja-private/caja-file-operations.c
index 067f52d5..baaa8843 100644
--- a/libcaja-private/caja-file-operations.c
+++ b/libcaja-private/caja-file-operations.c
@@ -68,6 +68,8 @@
#include "caja-file-conflict-dialog.h"
#include "caja-undostack-manager.h"
+#include <src/glibcompat.h> /* for g_list_free_full */
+
/* TODO: TESTING!!! */
typedef struct {
@@ -1858,8 +1860,7 @@ delete_job_done (gpointer user_data)
job = user_data;
- g_list_foreach(job->files, (GFunc) g_object_unref, NULL);
- g_list_free(job->files);
+ g_list_free_full (job->files, g_object_unref);
if (job->done_callback) {
debuting_uris = g_hash_table_new_full (g_file_hash, (GEqualFunc)g_file_equal, g_object_unref, NULL);
@@ -2188,8 +2189,7 @@ has_trash_files (GMount *mount)
}
}
- g_list_foreach(dirs, (GFunc) g_object_unref, NULL);
- g_list_free(dirs);
+ g_list_free_full (dirs, g_object_unref);
return res;
}
@@ -4462,8 +4462,7 @@ copy_job_done (gpointer user_data)
job->done_callback (job->debuting_files, job->done_callback_data);
}
- g_list_foreach(job->files, (GFunc) g_object_unref, NULL);
- g_list_free(job->files);
+ g_list_free_full (job->files, g_object_unref);
if (job->destination) {
g_object_unref (job->destination);
}
@@ -4990,8 +4989,7 @@ move_job_done (gpointer user_data)
job->done_callback (job->debuting_files, job->done_callback_data);
}
- g_list_foreach(job->files, (GFunc) g_object_unref, NULL);
- g_list_free(job->files);
+ g_list_free_full (job->files, g_object_unref);
g_object_unref (job->destination);
g_hash_table_unref (job->debuting_files);
g_free (job->icon_positions);
@@ -5071,8 +5069,7 @@ move_job (GIOSchedulerJob *io_job,
&source_info, &transfer_info);
aborted:
- g_list_foreach(fallbacks, (GFunc) g_free, NULL);
- g_list_free(fallbacks);
+ g_list_free_full (fallbacks, g_free);
g_free (dest_fs_id);
g_free (dest_fs_type);
@@ -5326,8 +5323,7 @@ link_job_done (gpointer user_data)
job->done_callback (job->debuting_files, job->done_callback_data);
}
- g_list_foreach(job->files, (GFunc) g_object_unref, NULL);
- g_list_free(job->files);
+ g_list_free_full (job->files, g_object_unref);
g_object_unref (job->destination);
g_hash_table_unref (job->debuting_files);
g_free (job->icon_positions);
@@ -5779,8 +5775,7 @@ caja_file_operations_copy_move (const GList *item_uris,
done_callback, done_callback_data);
}
- g_list_foreach(locations, (GFunc) g_object_unref, NULL);
- g_list_free(locations);
+ g_list_free_full (locations, g_object_unref);
if (dest) {
g_object_unref (dest);
}
@@ -6258,8 +6253,7 @@ empty_trash_job_done (gpointer user_data)
job = user_data;
- g_list_foreach(job->trash_dirs, (GFunc) g_object_unref, NULL);
- g_list_free(job->trash_dirs);
+ g_list_free_full (job->trash_dirs, g_object_unref);
if (job->done_callback) {
job->done_callback (job->done_callback_data);
diff --git a/libcaja-private/caja-file-utilities.c b/libcaja-private/caja-file-utilities.c
index bfe8321e..51ecbf5b 100644
--- a/libcaja-private/caja-file-utilities.c
+++ b/libcaja-private/caja-file-utilities.c
@@ -43,6 +43,8 @@
#include <unistd.h>
#include <stdlib.h>
+#include <src/glibcompat.h> /* for g_list_free_full */
+
#define CAJA_USER_DIRECTORY_NAME ".config/caja"
#define DEFAULT_CAJA_DIRECTORY_MODE (0755)
@@ -1428,8 +1430,7 @@ caja_restore_files_from_trash (GList *files,
parent_window,
NULL, NULL);
- g_list_foreach(locations, (GFunc) g_object_unref, NULL);
- g_list_free(locations);
+ g_list_free_full (locations, g_object_unref);
g_object_unref (original_dir_location);
}
diff --git a/libcaja-private/caja-file.c b/libcaja-private/caja-file.c
index 788eec68..1958fafc 100644
--- a/libcaja-private/caja-file.c
+++ b/libcaja-private/caja-file.c
@@ -70,6 +70,8 @@
#include <unistd.h>
#include <sys/stat.h>
+#include <src/glibcompat.h> /* for g_list_free_full */
+
#ifdef HAVE_SELINUX
#include <selinux/selinux.h>
#endif
@@ -816,14 +818,10 @@ finalize (GObject *object)
eel_ref_str_unref (file->details->filesystem_id);
- g_list_foreach(file->details->mime_list, (GFunc) g_free, NULL);
- g_list_free(file->details->mime_list);
- g_list_foreach(file->details->pending_extension_emblems, (GFunc) g_free, NULL);
- g_list_free(file->details->pending_extension_emblems);
- g_list_foreach(file->details->extension_emblems, (GFunc) g_free, NULL);
- g_list_free(file->details->extension_emblems);
- g_list_foreach(file->details->pending_info_providers, (GFunc) g_object_unref, NULL);
- g_list_free(file->details->pending_info_providers);
+ g_list_free_full (file->details->mime_list, g_free);
+ g_list_free_full (file->details->pending_extension_emblems, g_free);
+ g_list_free_full (file->details->extension_emblems, g_free);
+ g_list_free_full (file->details->pending_info_providers, g_object_unref);
if (file->details->pending_extension_attributes) {
g_hash_table_destroy (file->details->pending_extension_attributes);
@@ -2997,8 +2995,7 @@ fill_emblem_cache_if_needed (CajaFile *file)
/* Zero-terminate so we can tell where the list ends. */
*scanner = 0;
- g_list_foreach(keywords, (GFunc) g_free, NULL);
- g_list_free(keywords);
+ g_list_free_full (keywords, g_free);
}
static int
@@ -6605,8 +6602,7 @@ caja_file_get_emblem_icons (CajaFile *file,
icons = g_list_prepend (icons, icon);
}
- g_list_foreach(keywords, (GFunc) g_free, NULL);
- g_list_free(keywords);
+ g_list_free_full (keywords, g_free);
return icons;
}
@@ -6665,8 +6661,7 @@ sort_keyword_list_and_remove_duplicates (GList *keywords)
if (strcmp ((const char *) p->data, (const char *) p->next->data) == 0) {
duplicate_link = p->next;
keywords = g_list_remove_link (keywords, duplicate_link);
- g_list_foreach(duplicate_link, (GFunc) g_free, NULL);
- g_list_free(duplicate_link);
+ g_list_free_full (duplicate_link, g_free);
} else {
p = p->next;
}
@@ -7560,8 +7555,7 @@ void
caja_file_invalidate_extension_info_internal (CajaFile *file)
{
if (file->details->pending_info_providers)
- g_list_foreach(file->details->pending_info_providers, (GFunc) g_object_unref, NULL);
- g_list_free(file->details->pending_info_providers);
+ g_list_free_full (file->details->pending_info_providers, g_object_unref);
file->details->pending_info_providers =
caja_module_get_extensions_for_type (CAJA_TYPE_INFO_PROVIDER);
@@ -8383,8 +8377,7 @@ caja_file_invalidate_extension_info (CajaFile *file)
void
caja_file_info_providers_done (CajaFile *file)
{
- g_list_foreach(file->details->extension_emblems, (GFunc) g_free, NULL);
- g_list_free(file->details->extension_emblems);
+ g_list_free_full (file->details->extension_emblems, g_free);
file->details->extension_emblems = file->details->pending_extension_emblems;
file->details->pending_extension_emblems = NULL;
diff --git a/libcaja-private/caja-icon-canvas-item.c b/libcaja-private/caja-icon-canvas-item.c
index 45e6f98b..b8e3fa28 100644
--- a/libcaja-private/caja-icon-canvas-item.c
+++ b/libcaja-private/caja-icon-canvas-item.c
@@ -50,6 +50,8 @@
#include <stdio.h>
#include <string.h>
+#include <src/glibcompat.h> /* for g_list_free_full */
+
#define EMBLEM_SPACING 2
/* gap between bottom of icon and start of text box */
@@ -326,8 +328,7 @@ caja_icon_canvas_item_finalize (GObject *object)
g_object_unref (details->text_util);
}
- g_list_foreach(details->emblem_pixbufs, (GFunc) g_object_unref, NULL);
- g_list_free(details->emblem_pixbufs);
+ g_list_free_full (details->emblem_pixbufs, g_object_unref);
g_free (details->editable_text);
g_free (details->additional_text);
g_free (details->attach_points);
@@ -763,8 +764,7 @@ caja_icon_canvas_item_set_emblems (CajaIconCanvasItem *item,
/* Take in the new list of emblems. */
eel_g_object_list_ref (emblem_pixbufs);
- g_list_foreach(item->details->emblem_pixbufs, (GFunc) g_object_unref, NULL);
- g_list_free(item->details->emblem_pixbufs);
+ g_list_free_full (item->details->emblem_pixbufs, g_object_unref);
item->details->emblem_pixbufs = g_list_copy (emblem_pixbufs);
caja_icon_canvas_item_invalidate_bounds_cache (item);
diff --git a/libcaja-private/caja-icon-container.c b/libcaja-private/caja-icon-container.c
index 2b38220c..10f5fc8f 100644
--- a/libcaja-private/caja-icon-container.c
+++ b/libcaja-private/caja-icon-container.c
@@ -52,6 +52,8 @@
#include <stdio.h>
#include <string.h>
+#include <src/glibcompat.h> /* for g_list_free_full */
+
#if !GTK_CHECK_VERSION(3, 0, 0)
#define gtk_scrollable_get_hadjustment gtk_layout_get_hadjustment
#define gtk_scrollable_get_vadjustment gtk_layout_get_vadjustment
@@ -7793,8 +7795,7 @@ caja_icon_container_update_icon (CajaIconContainer *container,
/* Let the pixbufs go. */
g_object_unref (pixbuf);
- g_list_foreach(emblem_pixbufs, (GFunc) g_object_unref, NULL);
- g_list_free(emblem_pixbufs);
+ g_list_free_full (emblem_pixbufs, g_object_unref);
g_free (editable_text);
g_free (additional_text);
diff --git a/libcaja-private/caja-merged-directory.c b/libcaja-private/caja-merged-directory.c
index a3e2a9b2..bb7ce9eb 100644
--- a/libcaja-private/caja-merged-directory.c
+++ b/libcaja-private/caja-merged-directory.c
@@ -33,6 +33,8 @@
#include <eel/eel-gtk-macros.h>
#include <gtk/gtk.h>
+#include <src/glibcompat.h> /* for g_list_free_full */
+
struct CajaMergedDirectoryDetails
{
GList *directories;
@@ -589,8 +591,7 @@ real_directory_notify_files_removed (CajaDirectory *real_directory)
caja_directory_notify_files_removed_by_uri (files);
}
- g_list_foreach(files, (GFunc) g_free, NULL);
- g_list_free(files);
+ g_list_free_full (files, g_free);
}
static void
diff --git a/libcaja-private/caja-mime-actions.c b/libcaja-private/caja-mime-actions.c
index 4668e0ac..bbcc6f4d 100644
--- a/libcaja-private/caja-mime-actions.c
+++ b/libcaja-private/caja-mime-actions.c
@@ -44,6 +44,8 @@
#include "caja-debug-log.h"
#include "caja-open-with-dialog.h"
+#include <src/glibcompat.h> /* for g_list_free_full */
+
typedef enum
{
ACTIVATION_ACTION_LAUNCH_DESKTOP_FILE,
@@ -230,8 +232,7 @@ static void
application_launch_parameters_free (ApplicationLaunchParameters *parameters)
{
g_object_unref (parameters->application);
- g_list_foreach(parameters->uris, (GFunc) g_free, NULL);
- g_list_free(parameters->uris);
+ g_list_free_full (parameters->uris, g_free);
g_free (parameters);
}
@@ -513,8 +514,7 @@ caja_mime_has_any_applications_for_file (CajaFile *file)
if (apps)
{
result = TRUE;
- g_list_foreach(apps, (GFunc) g_object_unref, NULL);
- g_list_free(apps);
+ g_list_free_full (apps, g_object_unref);
}
else
{
@@ -735,8 +735,7 @@ trash_or_delete_files (GtkWindow *parent_window,
caja_file_operations_trash_or_delete (locations,
parent_window,
NULL, NULL);
- g_list_foreach(locations, (GFunc) g_object_unref, NULL);
- g_list_free(locations);
+ g_list_free_full (locations, g_object_unref);
}
static void
diff --git a/libcaja-private/caja-mime-application-chooser.c b/libcaja-private/caja-mime-application-chooser.c
index dd8af544..21c56c1a 100644
--- a/libcaja-private/caja-mime-application-chooser.c
+++ b/libcaja-private/caja-mime-application-chooser.c
@@ -39,6 +39,8 @@
#include <gtk/gtk.h>
#include <gio/gio.h>
+#include <src/glibcompat.h> /* for g_list_free_full */
+
struct _CajaMimeApplicationChooserDetails
{
char *uri;
@@ -563,8 +565,7 @@ refresh_model (CajaMimeApplicationChooser *chooser)
g_object_unref (default_app);
}
- g_list_foreach(applications, (GFunc) g_object_unref, NULL);
- g_list_free(applications);
+ g_list_free_full (applications, g_object_unref);
}
static void
diff --git a/libcaja-private/caja-open-with-dialog.c b/libcaja-private/caja-open-with-dialog.c
index 50ca03ef..0d7a4537 100644
--- a/libcaja-private/caja-open-with-dialog.c
+++ b/libcaja-private/caja-open-with-dialog.c
@@ -36,6 +36,8 @@
#include <gtk/gtk.h>
#include <gio/gio.h>
+#include <src/glibcompat.h> /* for g_list_free_full */
+
#define sure_string(s) ((const char *)((s)!=NULL?(s):""))
#define DESKTOP_ENTRY_GROUP "Desktop Entry"
@@ -290,8 +292,7 @@ add_or_find_application (CajaOpenWithDialog *dialog)
if (applications != NULL)
{
- g_list_foreach(applications, (GFunc) g_object_unref, NULL);
- g_list_free(applications);
+ g_list_free_full (applications, g_object_unref);
}
}
diff --git a/libcaja-private/caja-program-choosing.c b/libcaja-private/caja-program-choosing.c
index f7b3fa42..bc9ee396 100644
--- a/libcaja-private/caja-program-choosing.c
+++ b/libcaja-private/caja-program-choosing.c
@@ -42,6 +42,8 @@
#include <gdk/gdk.h>
#include <gdk/gdkx.h>
+#include <src/glibcompat.h> /* for g_list_free_full */
+
/**
* application_cannot_open_location
*
@@ -163,8 +165,7 @@ caja_launch_application (GAppInfo *application,
uris = g_list_reverse (uris);
caja_launch_application_by_uri (application, uris,
parent_window);
- g_list_foreach(uris, (GFunc) g_free, NULL);
- g_list_free(uris);
+ g_list_free_full (uris, g_free);
}
void
@@ -273,8 +274,7 @@ caja_launch_application_by_uri (GAppInfo *application,
}
}
- g_list_foreach(locations, (GFunc) g_object_unref, NULL);
- g_list_free(locations);
+ g_list_free_full (locations, g_object_unref);
}
/**
@@ -450,8 +450,7 @@ caja_launch_desktop_file (GdkScreen *screen,
" drop them again."),
parent_window);
- g_list_foreach(files, (GFunc) g_object_unref, NULL);
- g_list_free(files);
+ g_list_free_full (files, g_object_unref);
g_object_unref (app_info);
return;
}
@@ -503,8 +502,7 @@ caja_launch_desktop_file (GdkScreen *screen,
g_free (message);
}
- g_list_foreach(files, (GFunc) g_object_unref, NULL);
- g_list_free(files);
+ g_list_free_full (files, g_object_unref);
g_object_unref (context);
g_object_unref (app_info);
}
diff --git a/libcaja-private/caja-query.c b/libcaja-private/caja-query.c
index 9c6044af..df4a8753 100644
--- a/libcaja-private/caja-query.c
+++ b/libcaja-private/caja-query.c
@@ -30,6 +30,8 @@
#include <glib/gi18n.h>
#include <libcaja-private/caja-file-utilities.h>
+#include <src/glibcompat.h> /* for g_list_free_full */
+
struct CajaQueryDetails
{
char *text;
@@ -118,10 +120,7 @@ caja_query_get_mime_types (CajaQuery *query)
void
caja_query_set_mime_types (CajaQuery *query, GList *mime_types)
{
- g_list_foreach(query->details->mime_types, (GFunc) g_free, NULL);
- g_list_free(query->details->mime_types);
- g_list_foreach(query->details->mime_types, (GFunc) g_free, NULL);
- g_list_free(query->details->mime_types);
+ g_list_free_full (query->details->mime_types, g_free);
query->details->mime_types = eel_g_str_list_copy (mime_types);
}
diff --git a/libcaja-private/caja-search-engine-beagle.c b/libcaja-private/caja-search-engine-beagle.c
index 6e59b060..1b63bb28 100644
--- a/libcaja-private/caja-search-engine-beagle.c
+++ b/libcaja-private/caja-search-engine-beagle.c
@@ -27,6 +27,8 @@
#include <eel/eel-gtk-macros.h>
#include <gmodule.h>
+#include <src/glibcompat.h> /* for g_list_free_full */
+
typedef struct _BeagleHit BeagleHit;
typedef struct _BeagleQuery BeagleQuery;
typedef struct _BeagleClient BeagleClient;
@@ -341,8 +343,7 @@ caja_search_engine_beagle_start (CajaSearchEngine *engine)
/* These must live during the lifetime of the query */
g_free (text);
- g_list_foreach(mimetypes, (GFunc) g_free, NULL);
- g_list_free(mimetypes);
+ g_list_free_full (mimetypes, g_free);
}
static void
diff --git a/libcaja-private/caja-search-engine-simple.c b/libcaja-private/caja-search-engine-simple.c
index cf50497f..dc30dbe8 100644
--- a/libcaja-private/caja-search-engine-simple.c
+++ b/libcaja-private/caja-search-engine-simple.c
@@ -30,6 +30,8 @@
#include <eel/eel-gtk-macros.h>
#include <gio/gio.h>
+#include <src/glibcompat.h> /* for g_list_free_full */
+
#define BATCH_SIZE 500
typedef struct
@@ -137,10 +139,8 @@ search_thread_data_free (SearchThreadData *data)
g_hash_table_destroy (data->visited);
g_object_unref (data->cancellable);
g_strfreev (data->words);
- g_list_foreach(data->mime_types, (GFunc) g_free, NULL);
- g_list_free(data->mime_types);
- g_list_foreach(data->uri_hits, (GFunc) g_free, NULL);
- g_list_free(data->uri_hits);
+ g_list_free_full (data->mime_types, g_free);
+ g_list_free_full (data->uri_hits, g_free);
g_free (data);
}
@@ -182,8 +182,7 @@ search_thread_add_hits_idle (gpointer user_data)
hits->uris);
}
- g_list_foreach(hits->uris, (GFunc) g_free, NULL);
- g_list_free(hits->uris);
+ g_list_free_full (hits->uris, g_free);
g_free (hits);
return FALSE;
diff --git a/libcaja-private/caja-search-engine-tracker.c b/libcaja-private/caja-search-engine-tracker.c
index e47af045..edf725c8 100644
--- a/libcaja-private/caja-search-engine-tracker.c
+++ b/libcaja-private/caja-search-engine-tracker.c
@@ -27,6 +27,7 @@
#include <gmodule.h>
#include <string.h>
+#include <src/glibcompat.h> /* for g_list_free_full */
typedef struct _TrackerClient TrackerClient;
@@ -306,8 +307,7 @@ search_callback (gpointer results, GError *error, gpointer user_data)
caja_search_engine_hits_added (CAJA_SEARCH_ENGINE (tracker), hit_uris);
caja_search_engine_finished (CAJA_SEARCH_ENGINE (tracker));
- g_list_foreach (hit_uris, (GFunc) g_free, NULL);
- g_list_free (hit_uris);
+ g_list_free_full (hit_uris, g_free);
}
@@ -461,8 +461,7 @@ caja_search_engine_tracker_start (CajaSearchEngine *engine)
tracker->details->query_pending = TRUE;
g_free (search_text);
- g_list_foreach(mimetypes, (GFunc) g_free, NULL);
- g_list_free(mimetypes);
+ g_list_free_full (mimetypes, g_free);
}
static void
diff --git a/libcaja-private/caja-undostack-manager.c b/libcaja-private/caja-undostack-manager.c
index 0a19934e..08dd827e 100644
--- a/libcaja-private/caja-undostack-manager.c
+++ b/libcaja-private/caja-undostack-manager.c
@@ -34,6 +34,8 @@
#include <locale.h>
#include <gdk/gdk.h>
+#include <src/glibcompat.h> /* for g_list_free_full */
+
/* *****************************************************************
Private fields
***************************************************************** */
@@ -431,8 +433,7 @@ caja_undostack_manager_redo (CajaUndoStackManager * manager,
uris = construct_gfile_list (action->sources, action->src_dir);
caja_file_operations_copy (uris, NULL,
action->dest_dir, NULL, undo_redo_done_transfer_callback, action);
- g_list_foreach(uris, (GFunc) g_object_unref, NULL);
- g_list_free(uris);
+ g_list_free_full (uris, g_object_unref);
break;
case CAJA_UNDOSTACK_CREATEFILEFROMTEMPLATE:
puri = get_uri_parent (action->target_uri);
@@ -448,16 +449,14 @@ caja_undostack_manager_redo (CajaUndoStackManager * manager,
uris = construct_gfile_list (action->sources, action->src_dir);
caja_file_operations_duplicate (uris, NULL, NULL,
undo_redo_done_transfer_callback, action);
- g_list_foreach(uris, (GFunc) g_object_unref, NULL);
- g_list_free(uris);
+ g_list_free_full (uris, g_object_unref);
break;
case CAJA_UNDOSTACK_RESTOREFROMTRASH:
case CAJA_UNDOSTACK_MOVE:
uris = construct_gfile_list (action->sources, action->src_dir);
caja_file_operations_move (uris, NULL,
action->dest_dir, NULL, undo_redo_done_transfer_callback, action);
- g_list_foreach(uris, (GFunc) g_object_unref, NULL);
- g_list_free(uris);
+ g_list_free_full (uris, g_object_unref);
break;
case CAJA_UNDOSTACK_RENAME:
new_name = get_uri_basename (action->new_uri);
@@ -491,16 +490,14 @@ caja_undostack_manager_redo (CajaUndoStackManager * manager,
caja_file_operations_trash_or_delete
(uris, NULL, undo_redo_done_delete_callback, action);
g_list_free (uri_to_trash);
- g_list_foreach(uris, (GFunc) g_object_unref, NULL);
- g_list_free(uris);
+ g_list_free_full (uris, g_object_unref);
}
break;
case CAJA_UNDOSTACK_CREATELINK:
uris = construct_gfile_list (action->sources, action->src_dir);
caja_file_operations_link (uris, NULL,
action->dest_dir, NULL, undo_redo_done_transfer_callback, action);
- g_list_foreach(uris, (GFunc) g_object_unref, NULL);
- g_list_free(uris);
+ g_list_free_full (uris, g_object_unref);
break;
case CAJA_UNDOSTACK_SETPERMISSIONS:
file = caja_file_get_by_uri (action->target_uri);
@@ -583,8 +580,7 @@ caja_undostack_manager_undo (CajaUndoStackManager * manager,
if (priv->confirm_delete) {
caja_file_operations_delete (uris, NULL,
undo_redo_done_delete_callback, action);
- g_list_foreach(uris, (GFunc) g_object_unref, NULL);
- g_list_free(uris);
+ g_list_free_full (uris, g_object_unref);
} else {
/* We skip the confirmation message
*/
@@ -605,8 +601,7 @@ caja_undostack_manager_undo (CajaUndoStackManager * manager,
uris = construct_gfile_list (action->destinations, action->dest_dir);
caja_file_operations_trash_or_delete (uris, NULL,
undo_redo_done_delete_callback, action);
- g_list_foreach(uris, (GFunc) g_object_unref, NULL);
- g_list_free(uris);
+ g_list_free_full (uris, g_object_unref);
break;
case CAJA_UNDOSTACK_MOVETOTRASH:
files_to_restore = retrieve_files_to_restore (action->trashed);
@@ -636,8 +631,7 @@ caja_undostack_manager_undo (CajaUndoStackManager * manager,
uris = construct_gfile_list (action->destinations, action->dest_dir);
caja_file_operations_move (uris, NULL,
action->src_dir, NULL, undo_redo_done_transfer_callback, action);
- g_list_foreach(uris, (GFunc) g_object_unref, NULL);
- g_list_free(uris);
+ g_list_free_full (uris, g_object_unref);
break;
case CAJA_UNDOSTACK_RENAME:
new_name = get_uri_basename (action->old_uri);
@@ -1766,12 +1760,10 @@ free_undostack_action (gpointer data, gpointer user_data)
g_free (action->new_user_name_or_id);
if (action->sources) {
- g_list_foreach (action->sources, (GFunc) g_free, NULL);
- g_list_free (action->sources);
+ g_list_free_full (action->sources, g_free);
}
if (action->destinations) {
- g_list_foreach (action->destinations, (GFunc) g_free, NULL);
- g_list_free (action->destinations);
+ g_list_free_full (action->destinations, g_free);
}
if (action->trashed) {
diff --git a/src/caja-application.c b/src/caja-application.c
index edba1d5c..6c68198f 100644
--- a/src/caja-application.c
+++ b/src/caja-application.c
@@ -75,6 +75,8 @@
#include <libcaja-extension/caja-menu-provider.h>
#include <libcaja-private/caja-autorun.h>
+#include "glibcompat.h" /* for g_list_free_full */
+
enum {
COMMAND_0, /* unused: 0 is an invalid command */
@@ -257,8 +259,7 @@ automount_all_volumes (CajaApplication *application)
/* pass NULL as GMountOperation to avoid user interaction */
g_volume_mount (volume, 0, NULL, NULL, startup_volume_mount_cb, NULL);
}
- g_list_foreach(volumes, (GFunc) g_object_unref, NULL);
- g_list_free(volumes);
+ g_list_free_full (volumes, g_object_unref);
}
}
@@ -761,8 +762,7 @@ finish_startup (CajaApplication *application,
/* listen for eject button presses */
drives = g_volume_monitor_get_connected_drives (application->volume_monitor);
g_list_foreach (drives, (GFunc) drive_listen_for_eject_button, application);
- g_list_foreach (drives, (GFunc) g_object_unref, NULL);
- g_list_free (drives);
+ g_list_free_full (drives, g_object_unref);
application->automount_idle_id =
g_idle_add_full (G_PRIORITY_LOW,
@@ -1171,9 +1171,7 @@ caja_application_close_desktop (void)
{
if (caja_application_desktop_windows != NULL)
{
- g_list_foreach (caja_application_desktop_windows,
- (GFunc) gtk_widget_destroy, NULL);
- g_list_free (caja_application_desktop_windows);
+ g_list_free_full (caja_application_desktop_windows, gtk_widget_destroy);
caja_application_desktop_windows = NULL;
}
}
diff --git a/src/caja-bookmark-list.c b/src/caja-bookmark-list.c
index db594cf7..8ea12d41 100644
--- a/src/caja-bookmark-list.c
+++ b/src/caja-bookmark-list.c
@@ -35,6 +35,8 @@
#include <gio/gio.h>
#include <string.h>
+#include "glibcompat.h" /* for g_list_free_full */
+
#define MAX_BOOKMARK_LENGTH 80
#define LOAD_JOB 1
#define SAVE_JOB 2
@@ -167,8 +169,7 @@ static void
clear (CajaBookmarkList *bookmarks)
{
g_list_foreach (bookmarks->list, stop_monitoring_one, bookmarks);
- g_list_foreach(bookmarks->list, (GFunc) g_object_unref, NULL);
- g_list_free(bookmarks->list);
+ g_list_free_full (bookmarks->list, g_object_unref);
bookmarks->list = NULL;
}
diff --git a/src/caja-emblem-sidebar.c b/src/caja-emblem-sidebar.c
index 1de86f9b..b1e6ec58 100644
--- a/src/caja-emblem-sidebar.c
+++ b/src/caja-emblem-sidebar.c
@@ -47,6 +47,8 @@
#include <libcaja-private/caja-module.h>
#include <libcaja-private/caja-signaller.h>
+#include "glibcompat.h" /* for g_list_free_full */
+
struct CajaEmblemSidebarDetails
{
CajaWindowInfo *window;
@@ -1006,8 +1008,7 @@ caja_emblem_sidebar_populate (CajaEmblemSidebar *emblem_sidebar)
widgets = g_list_prepend (widgets, emblem_widget);
}
- g_list_foreach(icons, (GFunc) g_free, NULL);
- g_list_free(icons);
+ g_list_free_full (icons, g_free);
/* sort the emblems by display name */
widgets = g_list_sort (widgets, emblem_widget_sort_func);
diff --git a/src/caja-history-sidebar.c b/src/caja-history-sidebar.c
index b69dce51..72993d73 100644
--- a/src/caja-history-sidebar.c
+++ b/src/caja-history-sidebar.c
@@ -40,6 +40,8 @@
#include "caja-history-sidebar.h"
+#include "glibcompat.h" /* for g_list_free_full */
+
#define CAJA_HISTORY_SIDEBAR_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), CAJA_TYPE_HISTORY_SIDEBAR, CajaHistorySidebarClass))
#define CAJA_IS_HISTORY_SIDEBAR(obj) \
@@ -121,8 +123,7 @@ update_history (CajaHistorySidebar *sidebar)
}
g_free (name);
}
- g_list_foreach(history, (GFunc) g_object_unref, NULL);
- g_list_free(history);
+ g_list_free_full (history, g_object_unref);
selection = GTK_TREE_SELECTION (gtk_tree_view_get_selection (sidebar->tree_view));
diff --git a/src/caja-information-panel.c b/src/caja-information-panel.c
index 7aa17908..5e7fb3dd 100644
--- a/src/caja-information-panel.c
+++ b/src/caja-information-panel.c
@@ -49,6 +49,8 @@
#include <libcaja-private/caja-sidebar-provider.h>
#include <libcaja-private/caja-module.h>
+#include "glibcompat.h" /* for g_list_free_full */
+
struct CajaInformationPanelDetails
{
GtkVBox *container;
@@ -1228,8 +1230,7 @@ selection_changed_callback (CajaWindowInfo *window,
caja_information_panel_set_uri (panel, uri, name);
- g_list_foreach (selection, (GFunc) g_object_unref, NULL);
- g_list_free (selection);
+ g_list_free_full (selection, g_object_unref);
g_free (uri);
g_free (name);
}
diff --git a/src/caja-navigation-window-slot.c b/src/caja-navigation-window-slot.c
index 14963733..36d92808 100644
--- a/src/caja-navigation-window-slot.c
+++ b/src/caja-navigation-window-slot.c
@@ -31,6 +31,8 @@
#include <libcaja-private/caja-file.h>
#include <eel/eel-gtk-macros.h>
+#include "glibcompat.h" /* for g_list_free_full */
+
static void caja_navigation_window_slot_init (CajaNavigationWindowSlot *slot);
static void caja_navigation_window_slot_class_init (CajaNavigationWindowSlotClass *class);
@@ -88,8 +90,7 @@ caja_navigation_window_slot_clear_forward_list (CajaNavigationWindowSlot *slot)
{
g_assert (CAJA_IS_NAVIGATION_WINDOW_SLOT (slot));
- g_list_foreach(slot->forward_list, (GFunc) g_object_unref, NULL);
- g_list_free(slot->forward_list);
+ g_list_free_full (slot->forward_list, g_object_unref);
slot->forward_list = NULL;
}
@@ -98,8 +99,7 @@ caja_navigation_window_slot_clear_back_list (CajaNavigationWindowSlot *slot)
{
g_assert (CAJA_IS_NAVIGATION_WINDOW_SLOT (slot));
- g_list_foreach(slot->back_list, (GFunc) g_object_unref, NULL);
- g_list_free(slot->back_list);
+ g_list_free_full (slot->back_list, g_object_unref);
slot->back_list = NULL;
}
diff --git a/src/caja-pathbar.c b/src/caja-pathbar.c
index 57821d60..30879096 100644
--- a/src/caja-pathbar.c
+++ b/src/caja-pathbar.c
@@ -35,6 +35,8 @@
#include "caja-window-private.h"
#include "caja-window-slot.h"
+#include "glibcompat.h" /* for g_list_free_full */
+
#if !GTK_CHECK_VERSION(3,0,0)
#define gtk_widget_get_preferred_size(x,y,z) gtk_widget_size_request(x,y)
#endif
@@ -1750,8 +1752,7 @@ setup_file_path_mounted_mount (GFile *location, ButtonData *button_data)
g_object_unref (default_location);
g_object_unref (root);
}
- g_list_foreach(mounts, (GFunc) g_object_unref, NULL);
- g_list_free(mounts);
+ g_list_free_full (mounts, g_object_unref);
return result;
}
diff --git a/src/caja-places-sidebar.c b/src/caja-places-sidebar.c
index 7b188152..fa588663 100644
--- a/src/caja-places-sidebar.c
+++ b/src/caja-places-sidebar.c
@@ -53,6 +53,8 @@
#include "caja-places-sidebar.h"
#include "caja-window.h"
+#include "glibcompat.h" /* for g_list_free_full */
+
#define EJECT_BUTTON_XPAD 6
#define ICON_CELL_XPAD 6
@@ -842,8 +844,7 @@ update_places (CajaPlacesSidebar *sidebar)
g_free (tooltip);
}
- g_list_foreach (network_mounts, (GFunc) g_object_unref, NULL);
- g_list_free(network_mounts);
+ g_list_free_full (network_mounts, g_object_unref);
/* network:// */
mount_uri = "network:///"; /* No need to strdup */
diff --git a/src/caja-property-browser.c b/src/caja-property-browser.c
index e3ee8dd7..e18e6b91 100644
--- a/src/caja-property-browser.c
+++ b/src/caja-property-browser.c
@@ -55,6 +55,8 @@
#include <libcaja-private/caja-signaller.h>
#include <atk/atkrelationset.h>
+#include "glibcompat.h" /* for g_list_free_full */
+
/* property types */
typedef enum
@@ -232,8 +234,7 @@ caja_property_browser_dispose (GObject *object)
g_free (property_browser->details->dragged_file);
g_free (property_browser->details->drag_type);
- g_list_foreach (property_browser->details->keywords, (GFunc) g_free, NULL);
- g_list_free(property_browser->details->keywords);
+ g_list_free_full (property_browser->details->keywords, g_free);
if (property_browser->details->property_chit)
{
@@ -1796,8 +1797,7 @@ make_properties_from_directories (CajaPropertyBrowser *property_browser)
if (property_browser->details->category_type == CAJA_PROPERTY_EMBLEM)
{
- g_list_foreach(property_browser->details->keywords, (GFunc) g_free, NULL);
- g_list_free(property_browser->details->keywords);
+ g_list_free_full (property_browser->details->keywords, g_free);
property_browser->details->keywords = NULL;
icons = caja_emblem_list_available ();
@@ -1851,8 +1851,7 @@ make_properties_from_directories (CajaPropertyBrowser *property_browser)
g_object_unref (object_pixbuf);
}
}
- g_list_foreach(icons, (GFunc) g_free, NULL);
- g_list_free(icons);
+ g_list_free_full (icons, g_free);
}
else
{
diff --git a/src/caja-query-editor.c b/src/caja-query-editor.c
index b0d04008..647a4fb0 100644
--- a/src/caja-query-editor.c
+++ b/src/caja-query-editor.c
@@ -34,6 +34,8 @@
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
+#include "glibcompat.h" /* for g_list_free_full */
+
typedef enum
{
CAJA_QUERY_EDITOR_ROW_LOCATION,
@@ -864,8 +866,7 @@ type_add_rows_from_query (CajaQueryEditor *editor,
&iter);
}
- g_list_foreach(mime_types, (GFunc) g_free, NULL);
- g_list_free(mime_types);
+ g_list_free_full (mime_types, g_free);
}
/* End of row types */
diff --git a/src/caja-spatial-window.c b/src/caja-spatial-window.c
index 94e43956..45525f33 100644
--- a/src/caja-spatial-window.c
+++ b/src/caja-spatial-window.c
@@ -62,6 +62,8 @@
#include <libcaja-private/caja-search-engine.h>
#include <libcaja-private/caja-signaller.h>
+#include "glibcompat.h" /* for g_list_free_full */
+
#if !GTK_CHECK_VERSION(3,0,0)
#define gtk_widget_get_preferred_size(x,y,z) gtk_widget_size_request(x,y)
#endif
@@ -555,8 +557,7 @@ location_menu_item_activated_callback (GtkWidget *menu_item,
caja_window_slot_open_location_with_selection
(slot, dest, selection, close_behind);
- g_list_foreach(selection, (GFunc) g_object_unref, NULL);
- g_list_free(selection);
+ g_list_free_full (selection, g_object_unref);
}
if (event != NULL) {
diff --git a/src/caja-trash-bar.c b/src/caja-trash-bar.c
index beb993bd..47cac9df 100644
--- a/src/caja-trash-bar.c
+++ b/src/caja-trash-bar.c
@@ -33,6 +33,8 @@
#include <libcaja-private/caja-file.h>
#include <libcaja-private/caja-trash-monitor.h>
+#include "glibcompat.h" /* for g_list_free_full */
+
#define CAJA_TRASH_BAR_GET_PRIVATE(o)\
(G_TYPE_INSTANCE_GET_PRIVATE ((o), CAJA_TYPE_TRASH_BAR, CajaTrashBarPrivate))
@@ -70,8 +72,7 @@ restore_button_clicked_cb (GtkWidget *button,
caja_restore_files_from_trash (files, GTK_WINDOW (gtk_widget_get_toplevel (button)));
caja_file_list_free (files);
- g_list_foreach(locations, (GFunc) g_object_unref, NULL);
- g_list_free(locations);
+ g_list_free_full (locations, g_object_unref);
}
static void
diff --git a/src/caja-window-manage-views.c b/src/caja-window-manage-views.c
index 5156cb18..117412c8 100644
--- a/src/caja-window-manage-views.c
+++ b/src/caja-window-manage-views.c
@@ -74,6 +74,8 @@
*/
#include "caja-desktop-window.h"
+#include "glibcompat.h" /* for g_list_free_full */
+
/* This number controls a maximum character count for a URL that is
* displayed as part of a dialog. It's fairly arbitrary -- big enough
* to allow most "normal" URIs to display in full, but small enough to
@@ -1421,8 +1423,7 @@ create_content_view (CajaWindowSlot *slot,
FALSE,
TRUE);
- g_list_foreach(slot->pending_selection, (GFunc) g_object_unref, NULL);
- g_list_free(slot->pending_selection);
+ g_list_free_full (slot->pending_selection, g_object_unref);
slot->pending_selection = NULL;
}
else if (slot->location != NULL)
@@ -1433,8 +1434,7 @@ create_content_view (CajaWindowSlot *slot,
selection,
FALSE,
TRUE);
- g_list_foreach(selection, (GFunc) g_object_unref, NULL);
- g_list_free(selection);
+ g_list_free_full (selection, g_object_unref);
}
else
{
@@ -1492,8 +1492,7 @@ load_new_location (CajaWindowSlot *slot,
caja_view_set_selection (view, selection_copy);
}
- g_list_foreach(selection_copy, (GFunc) g_object_unref, NULL);
- g_list_free(selection_copy);
+ g_list_free_full (selection_copy, g_object_unref);
}
/* A view started to load the location its viewing, either due to
@@ -1950,8 +1949,7 @@ free_location_change (CajaWindowSlot *slot)
}
slot->pending_location = NULL;
- g_list_foreach(slot->pending_selection, (GFunc) g_object_unref, NULL);
- g_list_free(slot->pending_selection);
+ g_list_free_full (slot->pending_selection, g_object_unref);
slot->pending_selection = NULL;
/* Don't free pending_scroll_to, since thats needed until
@@ -2005,8 +2003,7 @@ cancel_location_change (CajaWindowSlot *slot)
selection,
TRUE,
FALSE);
- g_list_foreach(selection, (GFunc) g_object_unref, NULL);
- g_list_free(selection);
+ g_list_free_full (selection, g_object_unref);
}
end_location_change (slot);
@@ -2356,8 +2353,7 @@ caja_window_slot_reload (CajaWindowSlot *slot)
NULL, NULL);
g_free (current_pos);
g_object_unref (location);
- g_list_foreach(selection, (GFunc) g_object_unref, NULL);
- g_list_free(selection);
+ g_list_free_full (selection, g_object_unref);
}
void
diff --git a/src/caja-window-slot.c b/src/caja-window-slot.c
index 5d87a60f..0fe2375b 100644
--- a/src/caja-window-slot.c
+++ b/src/caja-window-slot.c
@@ -33,6 +33,8 @@
#include <eel/eel-gtk-macros.h>
#include <eel/eel-string.h>
+#include "glibcompat.h" /* for g_list_free_full */
+
static void caja_window_slot_init (CajaWindowSlot *slot);
static void caja_window_slot_class_init (CajaWindowSlotClass *class);
static void caja_window_slot_dispose (GObject *object);
@@ -662,8 +664,7 @@ caja_window_slot_dispose (GObject *object)
g_object_ref (slot->location);
}
- g_list_foreach(slot->pending_selection, (GFunc) g_free, NULL);
- g_list_free(slot->pending_selection);
+ g_list_free_full (slot->pending_selection, g_free);
slot->pending_selection = NULL;
if (slot->current_location_bookmark != NULL)
diff --git a/src/caja-window.c b/src/caja-window.c
index 35b78432..25003f6b 100644
--- a/src/caja-window.c
+++ b/src/caja-window.c
@@ -65,6 +65,8 @@
#include <math.h>
#include <sys/time.h>
+#include "glibcompat.h" /* for g_list_free_full */
+
#define MAX_HISTORY_ITEMS 50
#define EXTRA_VIEW_WIDGETS_BACKGROUND "#a7c6e1"
@@ -343,8 +345,7 @@ caja_window_go_up (CajaWindow *window, gboolean close_behind, gboolean new_tab)
g_object_unref (parent);
- g_list_foreach(selection, (GFunc) g_object_unref, NULL);
- g_list_free(selection);
+ g_list_free_full (selection, g_object_unref);
}
static void
@@ -606,8 +607,7 @@ caja_window_get_property (GObject *object,
static void
free_stored_viewers (CajaWindow *window)
{
- g_list_foreach(window->details->short_list_viewers, (GFunc) g_free, NULL);
- g_list_free(window->details->short_list_viewers);
+ g_list_free_full (window->details->short_list_viewers, g_free);
window->details->short_list_viewers = NULL;
g_free (window->details->extra_viewer);
window->details->extra_viewer = NULL;
@@ -626,8 +626,7 @@ caja_window_destroy (GtkObject *object)
/* close all panes safely */
panes_copy = g_list_copy (window->details->panes);
- g_list_foreach (panes_copy, (GFunc) caja_window_close_pane, NULL);
- g_list_free (panes_copy);
+ g_list_free_full (panes_copy, caja_window_close_pane);
/* the panes list should now be empty */
g_assert (window->details->panes == NULL);
@@ -1760,8 +1759,7 @@ caja_send_history_list_changed (void)
static void
free_history_list (void)
{
- g_list_foreach(history_list, (GFunc) g_object_unref, NULL);
- g_list_free(history_list);
+ g_list_free_full (history_list, g_object_unref);
history_list = NULL;
}
diff --git a/src/file-manager/fm-directory-view.c b/src/file-manager/fm-directory-view.c
index 932e87b8..e0dfce34 100644
--- a/src/file-manager/fm-directory-view.c
+++ b/src/file-manager/fm-directory-view.c
@@ -82,6 +82,8 @@
#include <libcaja-private/caja-icon-names.h>
#include <libcaja-private/caja-undostack-manager.h>
+#include <src/glibcompat.h> /* for g_list_free_full */
+
/* Minimum starting update inverval */
#define UPDATE_INTERVAL_MIN 100
/* Maximum update interval */
@@ -1025,8 +1027,7 @@ delete_selected_files (FMDirectoryView *view)
caja_file_operations_delete (locations, fm_directory_view_get_containing_window (view), NULL, NULL);
- g_list_foreach(locations, (GFunc) g_object_unref, NULL);
- g_list_free(locations);
+ g_list_free_full (locations, g_object_unref);
caja_file_list_free (selection);
}
@@ -1935,8 +1936,7 @@ fm_directory_view_set_selection_locations (CajaView *caja_view,
/* If we are still loading, set the list of pending URIs instead.
* done_loading() will eventually select the pending URIs and reveal them.
*/
- g_list_foreach(view->details->pending_locations_selected, (GFunc) g_object_unref, NULL);
- g_list_free(view->details->pending_locations_selected);
+ g_list_free_full (view->details->pending_locations_selected, g_object_unref);
view->details->pending_locations_selected =
eel_g_object_list_copy (selection_locations);
}
@@ -2550,8 +2550,7 @@ done_loading (FMDirectoryView *view,
fm_directory_view_reveal_selection (view);
}
}
- g_list_foreach(locations_selected, (GFunc) g_object_unref, NULL);
- g_list_free(locations_selected);
+ g_list_free_full (locations_selected, g_object_unref);
fm_directory_view_display_selection_info (view);
}
@@ -3793,8 +3792,7 @@ fm_directory_view_create_links_for_files (FMDirectoryView *view, GList *files,
caja_file_operations_copy_move (uris, relative_item_points, dir_uri, GDK_ACTION_LINK,
GTK_WIDGET (view), copy_move_done_callback, copy_move_done_data);
g_free (dir_uri);
- g_list_foreach(uris, (GFunc) g_free, NULL);
- g_list_free(uris);
+ g_list_free_full (uris, g_free);
}
static void
@@ -3826,8 +3824,7 @@ fm_directory_view_duplicate_selection (FMDirectoryView *view, GList *files,
copy_move_done_data = pre_copy_move (view);
caja_file_operations_copy_move (uris, relative_item_points, NULL, GDK_ACTION_COPY,
GTK_WIDGET (view), copy_move_done_callback, copy_move_done_data);
- g_list_foreach(uris, (GFunc) g_free, NULL);
- g_list_free(uris);
+ g_list_free_full (uris, g_free);
}
/* special_link_in_selection
@@ -3931,8 +3928,7 @@ trash_or_delete_files (GtkWindow *parent_window,
parent_window,
(CajaDeleteCallback) trash_or_delete_done_cb,
view);
- g_list_foreach(locations, (GFunc) g_object_unref, NULL);
- g_list_free(locations);
+ g_list_free_full (locations, g_object_unref);
}
static gboolean
@@ -4681,8 +4677,7 @@ reset_open_with_menu (FMDirectoryView *view, GList *selection)
index,
menu_path, popup_path, submenu_visible);
}
- g_list_foreach(applications, (GFunc) g_object_unref, NULL);
- g_list_free(applications);
+ g_list_free_full (applications, g_object_unref);
if (default_app != NULL) {
g_object_unref (default_app);
}
@@ -4997,8 +4992,7 @@ reset_extension_actions_menu (FMDirectoryView *view, GList *selection)
if (items != NULL) {
add_extension_menu_items (view, selection, items, "");
- g_list_foreach (items, (GFunc) g_object_unref, NULL);
- g_list_free (items);
+ g_list_free_full (items, g_object_unref);
}
}
@@ -5977,8 +5971,7 @@ move_copy_selection_to_location (FMDirectoryView *view,
0, 0,
view);
- g_list_foreach(uris, (GFunc) g_free, NULL);
- g_list_free(uris);
+ g_list_free_full (uris, g_free);
caja_file_list_free (selection);
}
@@ -6118,8 +6111,7 @@ paste_clipboard_data (FMDirectoryView *view,
gtk_clipboard_clear (caja_clipboard_get (GTK_WIDGET (view)));
}
- g_list_foreach(item_uris, (GFunc) g_free, NULL);
- g_list_free(item_uris);
+ g_list_free_full (item_uris, g_free);
}
}
@@ -7113,8 +7105,7 @@ action_location_delete_callback (GtkAction *action,
caja_file_operations_delete (files, fm_directory_view_get_containing_window (view),
NULL, NULL);
- g_list_foreach(files, (GFunc) g_object_unref, NULL);
- g_list_free(files);
+ g_list_free_full (files, g_object_unref);
}
static void
@@ -9797,8 +9788,7 @@ fm_directory_view_stop (FMDirectoryView *view)
view->details->old_added_files = NULL;
file_and_directory_list_free (view->details->old_changed_files);
view->details->old_changed_files = NULL;
- g_list_foreach(view->details->pending_locations_selected, (GFunc) g_object_unref, NULL);
- g_list_free(view->details->pending_locations_selected);
+ g_list_free_full (view->details->pending_locations_selected, g_object_unref);
view->details->pending_locations_selected = NULL;
if (view->details->model != NULL) {
@@ -10576,8 +10566,7 @@ fm_directory_view_handle_uri_list_drop (FMDirectoryView *view,
target_uri != NULL ? target_uri : container_uri,
action, x, y, view);
- g_list_foreach(real_uri_list, (GFunc) g_free, NULL);
- g_list_free(real_uri_list);
+ g_list_free_full (real_uri_list, g_free);
if (points != NULL)
g_array_free (points, TRUE);
diff --git a/src/file-manager/fm-list-model.c b/src/file-manager/fm-list-model.c
index f6ba0168..1be811f4 100644
--- a/src/file-manager/fm-list-model.c
+++ b/src/file-manager/fm-list-model.c
@@ -35,6 +35,7 @@
#include <libcaja-private/caja-dnd.h>
#include <glib.h>
+#include <src/glibcompat.h> /* for g_list_free_full */
enum
{
@@ -371,8 +372,7 @@ fm_list_model_get_value (GtkTreeModel *tree_model, GtkTreeIter *iter, int column
g_object_unref (emblem);
}
- g_list_foreach (emblem_icons, (GFunc) g_object_unref, NULL);
- g_list_free(emblem_icons);
+ g_list_free_full (emblem_icons, g_object_unref);
g_object_unref (gicon);
gicon = emblemed_icon;
@@ -678,8 +678,7 @@ fm_list_model_get_first_iter_for_file (FMListModel *model,
res = TRUE;
*iter = *(GtkTreeIter *)list->data;
}
- g_list_foreach(list, (GFunc) g_free, NULL);
- g_list_free(list);
+ g_list_free_full (list, g_free);
return res;
}
@@ -1806,8 +1805,7 @@ refresh_row (gpointer data,
gtk_tree_path_free (path);
}
- g_list_foreach(iters, (GFunc) g_free, NULL);
- g_list_free(iters);
+ g_list_free_full (iters, g_free);
}
void
diff --git a/src/file-manager/fm-list-view.c b/src/file-manager/fm-list-view.c
index f487c333..f35fb656 100644
--- a/src/file-manager/fm-list-view.c
+++ b/src/file-manager/fm-list-view.c
@@ -61,6 +61,8 @@
#include <libcaja-private/caja-clipboard.h>
#include <libcaja-private/caja-cell-renderer-text-ellipsized.h>
+#include <src/glibcompat.h> /* for g_list_free_full */
+
struct FMListViewDetails
{
GtkTreeView *tree_view;
@@ -449,8 +451,7 @@ get_filtered_selection_refs (GtkTreeView *tree_view)
static void
ref_list_free (GList *ref_list)
{
- g_list_foreach (ref_list, (GFunc) gtk_tree_row_reference_free, NULL);
- g_list_free (ref_list);
+ g_list_free_full (ref_list, gtk_tree_row_reference_free);
}
static void
@@ -2325,8 +2326,7 @@ fm_list_view_set_selection (FMDirectoryView *view, GList *selection)
gtk_tree_selection_select_iter (tree_selection,
(GtkTreeIter *)l->data);
}
- g_list_foreach(iters, (GFunc) g_free, NULL);
- g_list_free(iters);
+ g_list_free_full (iters, g_free);
}
g_signal_handlers_unblock_by_func (tree_selection, list_selection_changed_callback, view);
@@ -2363,8 +2363,7 @@ fm_list_view_invert_selection (FMDirectoryView *view)
gtk_tree_selection_unselect_iter (tree_selection,
(GtkTreeIter *)l->data);
}
- g_list_foreach(iters, (GFunc) g_free, NULL);
- g_list_free(iters);
+ g_list_free_full (iters, g_free);
}
g_list_free (selection);
diff --git a/src/file-manager/fm-properties-window.c b/src/file-manager/fm-properties-window.c
index 4a7b7c54..73b28e2f 100644
--- a/src/file-manager/fm-properties-window.c
+++ b/src/file-manager/fm-properties-window.c
@@ -67,6 +67,8 @@
#include <sys/mount.h>
#endif
+#include <src/glibcompat.h> /* for g_list_free_full */
+
#define USED_FILL_R (0.988235294 * 65535)
#define USED_FILL_G (0.91372549 * 65535)
#define USED_FILL_B (0.309803922 * 65535)
@@ -841,8 +843,7 @@ file_has_keyword (CajaFile *file, const char *keyword)
keywords = caja_file_get_keywords (file);
word = g_list_find_custom (keywords, keyword, (GCompareFunc) strcmp);
- g_list_foreach(keywords, (GFunc) g_free, NULL);
- g_list_free(keywords);
+ g_list_free_full (keywords, g_free);
return (word != NULL);
}
@@ -932,8 +933,7 @@ emblem_button_toggled (GtkToggleButton *button,
keywords = g_list_prepend (keywords, g_strdup (name));
}
caja_file_set_keywords (file, keywords);
- g_list_foreach(keywords, (GFunc) g_free, NULL);
- g_list_free(keywords);
+ g_list_free_full (keywords, g_free);
}
for (l = files_off; l != NULL; l = l->next) {
@@ -946,12 +946,10 @@ emblem_button_toggled (GtkToggleButton *button,
word = g_list_find_custom (keywords, name, (GCompareFunc)strcmp);
if (word) {
keywords = g_list_remove_link (keywords, word);
- g_list_foreach(word, (GFunc) g_free, NULL);
- g_list_free(word);
+ g_list_free_full (word, g_free);
}
caja_file_set_keywords (file, keywords);
- g_list_foreach(keywords, (GFunc) g_free, NULL);
- g_list_free(keywords);
+ g_list_free_full (keywords, g_free);
}
g_list_free (files_on);
@@ -1207,8 +1205,7 @@ properties_window_update (FMPropertiesWindow *window,
refresh_extension_pages (window);
}
- g_list_foreach(window->details->mime_list, (GFunc) g_free, NULL);
- g_list_free(window->details->mime_list);
+ g_list_free_full (window->details->mime_list, g_free);
window->details->mime_list = mime_list;
}
}
@@ -1817,8 +1814,7 @@ synch_groups_combo_box (GtkComboBox *combo_box, CajaFile *file)
gtk_combo_box_set_active (combo_box, current_group_index);
g_free (current_group_name);
- g_list_foreach(groups, (GFunc) g_free, NULL);
- g_list_free(groups);
+ g_list_free_full (groups, g_free);
}
static gboolean
@@ -2173,8 +2169,7 @@ synch_user_menu (GtkComboBox *combo_box, CajaFile *file)
gtk_combo_box_set_active (combo_box, owner_index);
g_free (owner_name);
- g_list_foreach(users, (GFunc) g_free, NULL);
- g_list_free(users);
+ g_list_free_full (users, g_free);
}
static GtkComboBox*
@@ -3569,8 +3564,7 @@ create_emblems_page (FMPropertiesWindow *window)
gtk_container_add (GTK_CONTAINER (emblems_table), button);
}
- g_list_foreach(icons, (GFunc) g_free, NULL);
- g_list_free(icons);
+ g_list_free_full (icons, g_free);
gtk_widget_show_all (emblems_table);
}
@@ -5054,8 +5048,7 @@ get_pending_key (GList *file_list)
g_string_append (key, ";");
}
- g_list_foreach(uris, (GFunc) g_free, NULL);
- g_list_free(uris);
+ g_list_free_full (uris, g_free);
ret = key->str;
g_string_free (key, FALSE);
@@ -5628,8 +5621,7 @@ real_finalize (GObject *object)
window = FM_PROPERTIES_WINDOW (object);
- g_list_foreach(window->details->mime_list, (GFunc) g_free, NULL);
- g_list_free(window->details->mime_list);
+ g_list_free_full (window->details->mime_list, g_free);
g_free (window->details->pending_name);
g_free (window->details);
diff --git a/src/file-manager/fm-tree-model.c b/src/file-manager/fm-tree-model.c
index 3423e2d1..6babc2d3 100644
--- a/src/file-manager/fm-tree-model.c
+++ b/src/file-manager/fm-tree-model.c
@@ -37,6 +37,8 @@
#include <gtk/gtk.h>
#include <string.h>
+#include <src/glibcompat.h> /* for g_list_free_full */
+
enum
{
ROW_LOADED,
@@ -319,8 +321,7 @@ get_menu_icon_for_file (TreeNode *node,
}
}
- g_list_foreach (emblem_icons, (GFunc) g_object_unref, NULL);
- g_list_free(emblem_icons);
+ g_list_free_full (emblem_icons, g_object_unref);
info = caja_icon_info_lookup (gicon, size);
retval = caja_icon_info_get_pixbuf_nodefault_at_size (info, size);
diff --git a/src/file-manager/fm-tree-view.c b/src/file-manager/fm-tree-view.c
index 37559f53..32053db3 100644
--- a/src/file-manager/fm-tree-view.c
+++ b/src/file-manager/fm-tree-view.c
@@ -55,6 +55,8 @@
#include <libcaja-private/caja-window-info.h>
#include <libcaja-private/caja-window-slot-info.h>
+#include <src/glibcompat.h> /* for g_list_free_full */
+
typedef struct
{
GObject parent;
@@ -1059,8 +1061,7 @@ paste_clipboard_data (FMTreeView *view,
gtk_clipboard_clear (caja_clipboard_get (GTK_WIDGET (view)));
}
- g_list_foreach(item_uris, (GFunc) g_free, NULL);
- g_list_free(item_uris);
+ g_list_free_full (item_uris, g_free);
}
}
@@ -1123,8 +1124,7 @@ fm_tree_view_trash_cb (GtkWidget *menu_item,
caja_file_operations_trash_or_delete (list,
fm_tree_view_get_containing_window (view),
NULL, NULL);
- g_list_foreach(list, (GFunc) g_object_unref, NULL);
- g_list_free(list);
+ g_list_free_full (list, g_free);
}
static void
@@ -1142,8 +1142,7 @@ fm_tree_view_delete_cb (GtkWidget *menu_item,
caja_file_get_location (view->details->popup_file));
caja_file_operations_delete (location_list, fm_tree_view_get_containing_window (view), NULL, NULL);
- g_list_foreach(location_list, (GFunc) g_object_unref, NULL);
- g_list_free(location_list);
+ g_list_free_full (location_list, g_object_unref);
}
static void