summaryrefslogtreecommitdiff
path: root/src/file-manager
diff options
context:
space:
mode:
authorStefano Karapetsas <[email protected]>2012-11-23 03:09:17 -0800
committerStefano Karapetsas <[email protected]>2012-11-23 03:09:17 -0800
commitf6f5c1bb6d060aff5fb334017c640733675c2ae2 (patch)
treecde88ea4e11a2f0809da857feaefa6824d4ba8fa /src/file-manager
parentcbfe84ee50d01e523472a8e086add01245fad6bb (diff)
parentae06676815e24a27549e0c79a74bc81c77822554 (diff)
downloadcaja-f6f5c1bb6d060aff5fb334017c640733675c2ae2.tar.bz2
caja-f6f5c1bb6d060aff5fb334017c640733675c2ae2.tar.xz
Merge pull request #56 from jasmineaura/develop
[all] add and use glibcompat.h for glib-2.27.2 forward-compat
Diffstat (limited to 'src/file-manager')
-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.c34
-rw-r--r--src/file-manager/fm-tree-model.c5
-rw-r--r--src/file-manager/fm-tree-view.c11
6 files changed, 45 insertions, 67 deletions
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..1ed8cd91 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, (GDestroyNotify) 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..29666607 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*
@@ -3430,7 +3425,7 @@ get_initial_emblems (GList *files)
ret = g_hash_table_new_full (g_direct_hash,
g_direct_equal,
NULL,
- (GFunc) g_free);
+ (GDestroyNotify) g_free);
for (l = files; l != NULL; l = l->next) {
CajaFile *file;
@@ -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