summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJasmine Hassan <[email protected]>2012-11-23 11:18:34 +0200
committerJasmine Hassan <[email protected]>2012-11-23 11:18:34 +0200
commitb00cccb74307a49df74deb785936e3cd9cf3a5ad (patch)
treef2bcc459a2bef12678e642d0a14ce7f02373b71d /src
parentb12a7f6ea3309ecddfc7e3ae839a7b558c862533 (diff)
downloadcaja-b00cccb74307a49df74deb785936e3cd9cf3a5ad.tar.bz2
caja-b00cccb74307a49df74deb785936e3cd9cf3a5ad.tar.xz
[all] include src/glibcompat.h & use g_list_free_full() where needed
Also fixes a double-free regression in lc-p/caja-query from 7a42b9b0
Diffstat (limited to 'src')
-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
21 files changed, 102 insertions, 123 deletions
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