summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBarnabás Pőcze <pobrn@protonmail.com>2021-07-01 16:19:08 +0200
committerAntónio Fernandes <antoniof@gnome.org>2021-09-03 21:23:36 +0100
commitbf113781d0caa26db2b992f14e328e4cd7c038f4 (patch)
treed9e25ac54cb85b3b59e4d5cca684ac8f832387dd
parente9b247ac20ffff8b152b7e6683d357d330d11c76 (diff)
downloadnautilus-bf113781d0caa26db2b992f14e328e4cd7c038f4.tar.gz
files-view: Autocleanup locals in set_wallpaper_fallback()
Instead of manually calling `g_object_unref()` and `g_free()`, use `g_auto{free,ptr}` to (mostly) do away with the need of manually managing the resources.
-rw-r--r--src/nautilus-files-view.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
index 7e6dd8bd0..5f3e10d46 100644
--- a/src/nautilus-files-view.c
+++ b/src/nautilus-files-view.c
@@ -6854,19 +6854,17 @@ static void
set_wallpaper_fallback (NautilusFile *file,
gpointer user_data)
{
- char *target_uri;
+ g_autofree char *target_uri = NULL;
GList *uris;
- GFile *parent;
- GFile *target;
+ g_autoptr (GFile) parent = NULL;
+ g_autoptr (GFile) target = NULL;
/* Copy the item to Pictures/Wallpaper (internationalized) since it may be
* remote. Then set it as the current wallpaper. */
parent = g_file_new_for_path (g_get_user_special_dir (G_USER_DIRECTORY_PICTURES));
target = g_file_get_child (parent, _("Wallpapers"));
- g_object_unref (parent);
g_file_make_directory_with_parents (target, NULL, NULL);
target_uri = g_file_get_uri (target);
- g_object_unref (target);
uris = g_list_prepend (NULL, nautilus_file_get_uri (file));
nautilus_file_operations_copy_move (uris,
target_uri,
@@ -6875,7 +6873,6 @@ set_wallpaper_fallback (NautilusFile *file,
NULL,
wallpaper_copy_done_callback,
NULL);
- g_free (target_uri);
g_list_free_full (uris, g_free);
}