summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGaël Bonithon <gael@xfce.org>2021-12-24 23:25:16 +0100
committerGaël Bonithon <gael@xfce.org>2021-12-26 18:29:15 +0100
commitb014aabd2d78472a18a9b863e51dd6f1631d78cb (patch)
treee966db49d789ff0d514d443f5f1fa1f725497fc1
parent851a63ce087fe27c23bc625c25a4c0a9c976e895 (diff)
downloadtumbler-b014aabd2d78472a18a9b863e51dd6f1631d78cb.tar.gz
Cleanup: Use `g_file_peek_path()` when appropriate
This simplifies the code, fixes leaks in `g_debug()` calls, and GLib 2.56 will be required when moving to Xfce 4.18.
-rw-r--r--configure.ac14
-rw-r--r--plugins/desktop-thumbnailer/desktop-thumbnailer-provider.c18
-rw-r--r--plugins/desktop-thumbnailer/desktop-thumbnailer.c15
-rw-r--r--plugins/ffmpeg-thumbnailer/ffmpeg-thumbnailer.c5
-rw-r--r--plugins/gepub-thumbnailer/gepub-thumbnailer.c7
-rw-r--r--plugins/jpeg-thumbnailer/jpeg-thumbnailer.c7
-rw-r--r--plugins/odf-thumbnailer/odf-thumbnailer.c7
-rw-r--r--plugins/raw-thumbnailer/raw-thumbnailer.c5
-rw-r--r--plugins/xdg-cache/xdg-cache-cache.c20
-rw-r--r--plugins/xdg-cache/xdg-cache-thumbnail.c30
-rw-r--r--tumblerd/tumbler-manager.c53
11 files changed, 55 insertions, 126 deletions
diff --git a/configure.ac b/configure.ac
index 54ee3ee..cba5e8a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -141,13 +141,13 @@ fi
dnl ***********************************
dnl *** Check for required packages ***
dnl ***********************************
-AC_DEFINE(GLIB_VERSION_MAX_ALLOWED, GLIB_VERSION_2_50, Warn when using post 2_50 APIs)
-AC_DEFINE(GLIB_VERSION_MIN_REQUIRED, GLIB_VERSION_2_50, Don't warn about post 2_50 deprecations)
-PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.50.0])
-PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.50.0])
-PKG_CHECK_MODULES([GIO_UNIX], [gio-unix-2.0 >= 2.50.0])
-PKG_CHECK_MODULES([GMODULE], [gmodule-2.0 >= 2.50.0])
-PKG_CHECK_MODULES([GTHREAD], [gthread-2.0 >= 2.50.0])
+AC_DEFINE(GLIB_VERSION_MAX_ALLOWED, GLIB_VERSION_2_56, Warn when using post 2_56 APIs)
+AC_DEFINE(GLIB_VERSION_MIN_REQUIRED, GLIB_VERSION_2_56, Don't warn about post 2_56 deprecations)
+PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.56.0])
+PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.56.0])
+PKG_CHECK_MODULES([GIO_UNIX], [gio-unix-2.0 >= 2.56.0])
+PKG_CHECK_MODULES([GMODULE], [gmodule-2.0 >= 2.56.0])
+PKG_CHECK_MODULES([GTHREAD], [gthread-2.0 >= 2.56.0])
XDT_CHECK_PACKAGE([LIBXFCE4UTIL], [libxfce4util-1.0], [4.17.1])
dnl *************************
diff --git a/plugins/desktop-thumbnailer/desktop-thumbnailer-provider.c b/plugins/desktop-thumbnailer/desktop-thumbnailer-provider.c
index e76e405..a942ef2 100644
--- a/plugins/desktop-thumbnailer/desktop-thumbnailer-provider.c
+++ b/plugins/desktop-thumbnailer/desktop-thumbnailer-provider.c
@@ -101,14 +101,14 @@ desktop_thumbnailer_get_from_desktop_file (GFile *file,
DesktopThumbnailer *thumbnailer;
GKeyFile *key_file;
GError *error = NULL;
- gchar *filename;
+ const gchar *filename;
gchar *exec;
gchar **mime_types;
g_return_val_if_fail (G_IS_FILE (file), NULL);
/* determine the absolute filename of the input file */
- filename = g_file_get_path (file);
+ filename = g_file_peek_path (file);
/* allocate a new key file object */
key_file = g_key_file_new ();
@@ -118,9 +118,7 @@ desktop_thumbnailer_get_from_desktop_file (GFile *file,
{
g_warning (TUMBLER_WARNING_LOAD_FILE_FAILED, filename, error->message);
g_clear_error (&error);
-
g_key_file_free (key_file);
- g_free (filename);
return NULL;
}
@@ -132,9 +130,7 @@ desktop_thumbnailer_get_from_desktop_file (GFile *file,
{
g_warning (TUMBLER_WARNING_MALFORMED_FILE, filename, error->message);
g_clear_error (&error);
-
g_key_file_free (key_file);
- g_free (filename);
return NULL;
}
@@ -146,10 +142,8 @@ desktop_thumbnailer_get_from_desktop_file (GFile *file,
{
g_warning (TUMBLER_WARNING_MALFORMED_FILE, filename, error->message);
g_clear_error (&error);
-
g_free (exec);
g_key_file_free (key_file);
- g_free (filename);
return NULL;
}
@@ -164,7 +158,6 @@ desktop_thumbnailer_get_from_desktop_file (GFile *file,
g_print("Registered thumbnailer %s\n", exec);
g_free(exec);
- g_free (filename);
return thumbnailer;
}
@@ -175,15 +168,10 @@ desktop_thumbnailer_get_thumbnailers_from_dir (GList *thumbnailers,
GStrv uri_schemes)
{
const gchar *base_name;
- gchar *dirname;
GDir *dir;
- /* determine the absolute path to the directory */
- dirname = g_file_get_path (directory);
-
/* try to open the directory for reading */
- dir = g_dir_open (dirname, 0, NULL);
- g_free (dirname);
+ dir = g_dir_open (g_file_peek_path (directory), 0, NULL);
if (dir == NULL)
return thumbnailers;
diff --git a/plugins/desktop-thumbnailer/desktop-thumbnailer.c b/plugins/desktop-thumbnailer/desktop-thumbnailer.c
index 4faa77e..5e79543 100644
--- a/plugins/desktop-thumbnailer/desktop-thumbnailer.c
+++ b/plugins/desktop-thumbnailer/desktop-thumbnailer.c
@@ -265,7 +265,7 @@ desktop_thumbnailer_load_thumbnail (DesktopThumbnailer *thumbnailer,
GFile *tmpfile;
gchar *exec;
gchar **cmd_argv;
- gchar *tmpfilepath;
+ const gchar *tmpfilepath;
gboolean res;
gint cmd_argc;
gint size;
@@ -278,7 +278,7 @@ desktop_thumbnailer_load_thumbnail (DesktopThumbnailer *thumbnailer,
if ( G_LIKELY (tmpfile) )
{
- tmpfilepath = g_file_get_path (tmpfile);
+ tmpfilepath = g_file_peek_path (tmpfile);
size = MIN (width, height);
@@ -322,7 +322,6 @@ desktop_thumbnailer_load_thumbnail (DesktopThumbnailer *thumbnailer,
else
g_warning ("Malformed command line \"%s\": %s", exec, (*error)->message);
- g_free (tmpfilepath);
g_object_unref (tmpfile);
g_object_unref (stream);
}
@@ -344,7 +343,6 @@ desktop_thumbnailer_create (TumblerAbstractThumbnailer *thumbnailer,
TumblerThumbnailFlavor *flavor;
TumblerImageData data;
const gchar *uri;
- gchar *path;
GFile *file;
gint height;
gint width;
@@ -360,9 +358,7 @@ desktop_thumbnailer_create (TumblerAbstractThumbnailer *thumbnailer,
return;
uri = tumbler_file_info_get_uri (info);
-
file = g_file_new_for_uri (uri);
- path = g_file_get_path (file);
thumbnail = tumbler_file_info_get_thumbnail (info);
g_assert (thumbnail != NULL);
@@ -372,8 +368,9 @@ desktop_thumbnailer_create (TumblerAbstractThumbnailer *thumbnailer,
tumbler_thumbnail_flavor_get_size (flavor, &width, &height);
- pixbuf = desktop_thumbnailer_load_thumbnail (DESKTOP_THUMBNAILER(thumbnailer),
- uri, path, width, height, cancellable, &error);
+ pixbuf = desktop_thumbnailer_load_thumbnail (DESKTOP_THUMBNAILER (thumbnailer),
+ uri, g_file_peek_path (file),
+ width, height, cancellable, &error);
if (pixbuf != NULL)
{
@@ -402,8 +399,6 @@ desktop_thumbnailer_create (TumblerAbstractThumbnailer *thumbnailer,
g_signal_emit_by_name (thumbnailer, "ready", uri);
}
- g_free (path);
-
g_object_unref (thumbnail);
g_object_unref (flavor);
g_object_unref (file);
diff --git a/plugins/ffmpeg-thumbnailer/ffmpeg-thumbnailer.c b/plugins/ffmpeg-thumbnailer/ffmpeg-thumbnailer.c
index 795ab92..f8c7cbb 100644
--- a/plugins/ffmpeg-thumbnailer/ffmpeg-thumbnailer.c
+++ b/plugins/ffmpeg-thumbnailer/ffmpeg-thumbnailer.c
@@ -185,6 +185,7 @@ ffmpeg_thumbnailer_create (TumblerAbstractThumbnailer *thumbnailer,
/* get the local absolute path to the source file */
file = g_file_new_for_uri (uri);
path = g_file_get_path (file);
+ g_object_unref (file);
if (path == NULL)
{
@@ -195,12 +196,10 @@ ffmpeg_thumbnailer_create (TumblerAbstractThumbnailer *thumbnailer,
g_error_free (error);
/* clean up */
- g_object_unref (file);
g_object_unref (thumbnail);
video_thumbnailer_destroy_image_data (v_data);
return;
}
- g_object_unref (file);
/* try to generate a thumbnail */
if (video_thumbnailer_generate_thumbnail_to_buffer (ffmpeg_thumbnailer->video, path, v_data) != 0)
@@ -217,7 +216,7 @@ ffmpeg_thumbnailer_create (TumblerAbstractThumbnailer *thumbnailer,
video_thumbnailer_destroy_image_data (v_data);
return;
}
- g_free (path);
+ g_free (path);
v_stream = g_memory_input_stream_new_from_data (v_data->image_data_ptr,
v_data->image_data_size, NULL);
diff --git a/plugins/gepub-thumbnailer/gepub-thumbnailer.c b/plugins/gepub-thumbnailer/gepub-thumbnailer.c
index 775a5aa..b019020 100644
--- a/plugins/gepub-thumbnailer/gepub-thumbnailer.c
+++ b/plugins/gepub-thumbnailer/gepub-thumbnailer.c
@@ -145,7 +145,6 @@ gepub_thumbnailer_create (TumblerAbstractThumbnailer *thumbnailer,
const gchar *uri;
GFile *file;
GError *error = NULL;
- gchar *path;
GdkPixbuf *pixbuf = NULL;
GepubDoc *doc;
gchar *cover;
@@ -166,15 +165,13 @@ gepub_thumbnailer_create (TumblerAbstractThumbnailer *thumbnailer,
if (g_file_is_native (file))
{
/* try to load the EPUB file */
- path = g_file_get_path (file);
- doc = gepub_doc_new (path, &error);
+ doc = gepub_doc_new (g_file_peek_path (file), &error);
if (error != NULL)
{
g_signal_emit_by_name (thumbnailer, "error", uri,
error->code, error->message);
g_error_free (error);
- g_free (path);
g_object_unref (file);
return;
}
@@ -190,7 +187,6 @@ gepub_thumbnailer_create (TumblerAbstractThumbnailer *thumbnailer,
"Cover not found");
g_free (cover);
- g_free (path);
g_object_unref (doc);
g_object_unref (file);
return;
@@ -224,7 +220,6 @@ gepub_thumbnailer_create (TumblerAbstractThumbnailer *thumbnailer,
g_bytes_unref (content);
g_free (cover_mime);
- g_free (path);
g_object_unref (doc);
g_object_unref (thumbnail);
}
diff --git a/plugins/jpeg-thumbnailer/jpeg-thumbnailer.c b/plugins/jpeg-thumbnailer/jpeg-thumbnailer.c
index c137458..f89128d 100644
--- a/plugins/jpeg-thumbnailer/jpeg-thumbnailer.c
+++ b/plugins/jpeg-thumbnailer/jpeg-thumbnailer.c
@@ -786,7 +786,6 @@ jpeg_thumbnailer_create (TumblerAbstractThumbnailer *thumbnailer,
JOCTET *content;
GError *error = NULL;
GFile *file;
- gchar *path;
gsize length;
gint fd;
gint height;
@@ -818,10 +817,8 @@ jpeg_thumbnailer_create (TumblerAbstractThumbnailer *thumbnailer,
#ifdef HAVE_MMAP
if (g_file_is_native (file))
{
- path = g_file_get_path (file);
-
/* try to open the file at the given path */
- fd = open (path, O_RDONLY);
+ fd = open (g_file_peek_path (file), O_RDONLY);
if (G_LIKELY (fd >= 0))
{
/* determine the status of the file */
@@ -872,8 +869,6 @@ jpeg_thumbnailer_create (TumblerAbstractThumbnailer *thumbnailer,
/* close the file */
close (fd);
}
-
- g_free (path);
}
#endif
diff --git a/plugins/odf-thumbnailer/odf-thumbnailer.c b/plugins/odf-thumbnailer/odf-thumbnailer.c
index d231aac..629d8ee 100644
--- a/plugins/odf-thumbnailer/odf-thumbnailer.c
+++ b/plugins/odf-thumbnailer/odf-thumbnailer.c
@@ -272,7 +272,6 @@ odf_thumbnailer_create (TumblerAbstractThumbnailer *thumbnailer,
const gchar *uri;
GFile *file;
GError *error = NULL;
- gchar *path;
GsfInfile *infile;
GdkPixbuf *pixbuf = NULL;
TumblerImageData data;
@@ -291,9 +290,7 @@ odf_thumbnailer_create (TumblerAbstractThumbnailer *thumbnailer,
if (g_file_is_native (file))
{
/* try to mmap the file */
- path = g_file_get_path (file);
- input = gsf_input_mmap_new (path, NULL);
- g_free (path);
+ input = gsf_input_mmap_new (g_file_peek_path (file), NULL);
}
if (input == NULL)
@@ -304,6 +301,7 @@ odf_thumbnailer_create (TumblerAbstractThumbnailer *thumbnailer,
{
g_signal_emit_by_name (thumbnailer, "error", uri, error->code, error->message);
g_error_free (error);
+ g_object_unref (file);
return;
}
}
@@ -362,6 +360,7 @@ odf_thumbnailer_create (TumblerAbstractThumbnailer *thumbnailer,
g_signal_emit_by_name (thumbnailer, "ready", uri);
}
+ g_object_unref (file);
g_object_unref (input);
g_object_unref (thumbnail);
}
diff --git a/plugins/raw-thumbnailer/raw-thumbnailer.c b/plugins/raw-thumbnailer/raw-thumbnailer.c
index 8daf9e9..16c75da 100644
--- a/plugins/raw-thumbnailer/raw-thumbnailer.c
+++ b/plugins/raw-thumbnailer/raw-thumbnailer.c
@@ -108,7 +108,7 @@ raw_thumbnailer_create (TumblerAbstractThumbnailer *thumbnailer,
TumblerImageData data;
TumblerThumbnail *thumbnail;
const gchar *uri;
- gchar *path;
+ const gchar *path;
GdkPixbuf *pixbuf = NULL;
GError *error = NULL;
GFile *file;
@@ -137,7 +137,7 @@ raw_thumbnailer_create (TumblerAbstractThumbnailer *thumbnailer,
g_object_unref (flavor);
/* libopenraw only handles local IO */
- path = g_file_get_path (file);
+ path = g_file_peek_path (file);
if (path != NULL && g_path_is_absolute (path))
{
pixbuf = or_gdkpixbuf_extract_rotated_thumbnail (path, MIN (width, height));
@@ -154,7 +154,6 @@ raw_thumbnailer_create (TumblerAbstractThumbnailer *thumbnailer,
TUMBLER_ERROR_MESSAGE_LOCAL_ONLY);
}
- g_free (path);
g_object_unref (file);
if (pixbuf != NULL)
diff --git a/plugins/xdg-cache/xdg-cache-cache.c b/plugins/xdg-cache/xdg-cache-cache.c
index 69a07e6..f32c1f5 100644
--- a/plugins/xdg-cache/xdg-cache-cache.c
+++ b/plugins/xdg-cache/xdg-cache-cache.c
@@ -275,14 +275,12 @@ xdg_cache_cache_cleanup (TumblerCache *cache,
{
base_file = xdg_cache_cache_get_file (base_uris[n], iter->data);
- filename = g_file_get_path (base_file);
+ filename = (gchar *) g_file_peek_path (base_file);
if (g_file_test (filename, G_FILE_TEST_IS_REGULAR))
{
g_unlink (filename);
}
- g_free(filename);
-
/* releas the base file */
g_object_unref(base_file);
}
@@ -327,9 +325,8 @@ xdg_cache_cache_copy_or_move_file (TumblerCache *cache,
{
GFile *from_file;
GFile *temp_file;
- gchar *temp_path;
- gchar *dest_path;
- gchar *from_path;
+ const gchar *temp_path;
+ const gchar *dest_path;
gboolean result;
GFile *dest_file;
@@ -349,33 +346,28 @@ xdg_cache_cache_copy_or_move_file (TumblerCache *cache,
if (result)
{
- temp_path = g_file_get_path (temp_file);
+ temp_path = g_file_peek_path (temp_file);
if (xdg_cache_cache_write_thumbnail_info (temp_path, to_uri, mtime,
NULL, NULL))
{
dest_file = xdg_cache_cache_get_file (to_uri, flavor);
- dest_path = g_file_get_path (dest_file);
+ dest_path = g_file_peek_path (dest_file);
if (g_rename (temp_path, dest_path) != 0)
g_unlink (temp_path);
- g_free (dest_path);
g_object_unref (dest_file);
}
else
{
g_unlink (temp_path);
}
-
- g_free (temp_path);
}
else if (!do_copy)
{
/* if the move failed, drop the old cache file */
- from_path = g_file_get_path (from_file);
- g_unlink (from_path);
- g_free (from_path);
+ g_unlink (g_file_peek_path (from_file));
}
g_object_unref (temp_file);
diff --git a/plugins/xdg-cache/xdg-cache-thumbnail.c b/plugins/xdg-cache/xdg-cache-thumbnail.c
index 7b22f33..e58b2ea 100644
--- a/plugins/xdg-cache/xdg-cache-thumbnail.c
+++ b/plugins/xdg-cache/xdg-cache-thumbnail.c
@@ -228,7 +228,6 @@ xdg_cache_thumbnail_load (TumblerThumbnail *thumbnail,
XDGCacheThumbnail *cache_thumbnail = XDG_CACHE_THUMBNAIL (thumbnail);
GError *err = NULL;
GFile *file;
- gchar *path;
g_return_val_if_fail (XDG_CACHE_IS_THUMBNAIL (thumbnail), FALSE);
g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), FALSE);
@@ -238,20 +237,16 @@ xdg_cache_thumbnail_load (TumblerThumbnail *thumbnail,
file = xdg_cache_cache_get_file (cache_thumbnail->uri,
cache_thumbnail->flavor);
- path = g_file_get_path (file);
- g_object_unref (file);
g_free (cache_thumbnail->cached_uri);
cache_thumbnail->cached_uri = NULL;
cache_thumbnail->cached_mtime = 0;
- xdg_cache_cache_read_thumbnail_info (path,
+ xdg_cache_cache_read_thumbnail_info (g_file_peek_path (file),
&cache_thumbnail->cached_uri,
&cache_thumbnail->cached_mtime,
cancellable, &err);
-
- /* free the filename */
- g_free (path);
+ g_object_unref (file);
if (err != NULL)
{
@@ -342,9 +337,8 @@ xdg_cache_thumbnail_save_image_data (TumblerThumbnail *thumbnail,
GFile *dest_file;
GFile *flavor_dir;
GFile *temp_file;
- gchar *dest_path;
- gchar *flavor_dir_path;
- gchar *temp_path;
+ const gchar *dest_path;
+ const gchar *temp_path;
gchar *mtime_str;
gint width;
gint height;
@@ -380,15 +374,13 @@ xdg_cache_thumbnail_save_image_data (TumblerThumbnail *thumbnail,
temp_file = xdg_cache_cache_get_temp_file (cache_thumbnail->uri,
cache_thumbnail->flavor);
- /* determine the flavor directory and its path */
+ /* determine the flavor directory */
flavor_dir = g_file_get_parent (temp_file);
- flavor_dir_path = g_file_get_path (flavor_dir);
/* create the flavor directory with user-only read/write/execute permissions */
- g_mkdir_with_parents (flavor_dir_path, S_IRWXU);
+ g_mkdir_with_parents (g_file_peek_path (flavor_dir), S_IRWXU);
- /* free the flavor dir path and GFile */
- g_free (flavor_dir_path);
+ /* free the flavor dir GFile */
g_object_unref (flavor_dir);
/* open a stream to write to (and possibly replace) the temp file */
@@ -411,8 +403,8 @@ xdg_cache_thumbnail_save_image_data (TumblerThumbnail *thumbnail,
cache_thumbnail->flavor);
/* determine temp and destination paths */
- temp_path = g_file_get_path (temp_file);
- dest_path = g_file_get_path (dest_file);
+ temp_path = g_file_peek_path (temp_file);
+ dest_path = g_file_peek_path (dest_file);
/* try to rename the thumbnail */
if (g_rename (temp_path, dest_path) == -1)
@@ -422,10 +414,6 @@ xdg_cache_thumbnail_save_image_data (TumblerThumbnail *thumbnail,
g_file_delete (temp_file, NULL, NULL);
}
- /* free strings */
- g_free (dest_path);
- g_free (temp_path);
-
/* destroy the destination GFile */
g_object_unref (dest_file);
}
diff --git a/tumblerd/tumbler-manager.c b/tumblerd/tumbler-manager.c
index 54e8c3e..b2302a9 100644
--- a/tumblerd/tumbler-manager.c
+++ b/tumblerd/tumbler-manager.c
@@ -524,20 +524,17 @@ tumbler_manager_parse_overrides (TumblerManager *manager,
GList *overrides = NULL;
GFile *directory;
gchar **sections;
- gchar *filename;
+ const gchar *filename;
gchar *uri_type;
guint n;
g_return_val_if_fail (TUMBLER_IS_MANAGER (manager), NULL);
g_return_val_if_fail (G_IS_FILE (file), NULL);
- filename = g_file_get_path (file);
+ filename = g_file_peek_path (file);
if (!g_file_test (filename, G_FILE_TEST_IS_REGULAR))
- {
- g_free (filename);
- return NULL;
- }
+ return NULL;
/* allocate the key file */
key_file = g_key_file_new ();
@@ -548,7 +545,6 @@ tumbler_manager_parse_overrides (TumblerManager *manager,
g_warning (TUMBLER_WARNING_LOAD_FILE_FAILED, filename, error->message);
g_clear_error (&error);
g_key_file_free (key_file);
- g_free (filename);
return NULL;
}
@@ -623,7 +619,6 @@ tumbler_manager_parse_overrides (TumblerManager *manager,
g_free (sections);
g_key_file_free (key_file);
- g_free (filename);
return overrides;
}
@@ -928,7 +923,7 @@ tumbler_manager_load_thumbnailer (TumblerManager *manager,
GList *lp;
gchar **hash_keys;
gchar *base_name;
- gchar *filename;
+ const gchar *filename;
gchar *name;
gchar *object_path;
gchar **uri_schemes;
@@ -939,7 +934,7 @@ tumbler_manager_load_thumbnailer (TumblerManager *manager,
g_return_if_fail (G_IS_FILE (file));
/* determine the absolute filename of the input file */
- filename = g_file_get_path (file);
+ filename = g_file_peek_path (file);
/* allocate a new key file object */
key_file = g_key_file_new ();
@@ -951,7 +946,6 @@ tumbler_manager_load_thumbnailer (TumblerManager *manager,
g_clear_error (&error);
g_key_file_free (key_file);
- g_free (filename);
return;
}
@@ -964,7 +958,6 @@ tumbler_manager_load_thumbnailer (TumblerManager *manager,
g_clear_error (&error);
g_key_file_free (key_file);
- g_free (filename);
return;
}
@@ -978,7 +971,6 @@ tumbler_manager_load_thumbnailer (TumblerManager *manager,
g_clear_error (&error);
g_key_file_free (key_file);
- g_free (filename);
return;
}
@@ -994,7 +986,6 @@ tumbler_manager_load_thumbnailer (TumblerManager *manager,
g_free (object_path);
g_free (name);
g_key_file_free (key_file);
- g_free (filename);
return;
}
@@ -1021,7 +1012,6 @@ tumbler_manager_load_thumbnailer (TumblerManager *manager,
g_free (object_path);
g_free (name);
g_key_file_free (key_file);
- g_free (filename);
return;
}
@@ -1051,7 +1041,6 @@ tumbler_manager_load_thumbnailer (TumblerManager *manager,
g_free (object_path);
g_free (name);
g_key_file_free (key_file);
- g_free (filename);
/* determine the basename of the file */
base_name = g_file_get_basename (file);
@@ -1176,22 +1165,15 @@ tumbler_manager_load_thumbnailers (TumblerManager *manager,
const gchar *base_name;
GFileType type;
GFile *file;
- gchar *dirname;
GDir *dir;
g_return_if_fail (TUMBLER_IS_MANAGER (manager));
g_return_if_fail (G_IS_FILE (directory));
- /* determine the absolute path to the directory */
- dirname = g_file_get_path (directory);
-
/* try to open the directory for reading */
- dir = g_dir_open (dirname, 0, NULL);
+ dir = g_dir_open (g_file_peek_path (directory), 0, NULL);
if (dir == NULL)
- {
- g_free (dirname);
- return;
- }
+ return;
/* iterate over all files in the directory */
for (base_name = g_dir_read_name (dir);
@@ -1216,9 +1198,6 @@ tumbler_manager_load_thumbnailers (TumblerManager *manager,
/* close the directory handle */
g_dir_close (dir);
-
- /* free memory used for the directory path */
- g_free (dirname);
}
@@ -1637,7 +1616,7 @@ tumbler_manager_directory_changed (TumblerManager *manager,
if (g_strcmp0 (base_name, "overrides") == 0)
{
#ifdef DEBUG
- g_debug (" %s deleted", g_file_get_path (file));
+ g_debug (" %s deleted", g_file_peek_path (file));
#endif
tumbler_mutex_lock (manager->mutex);
tumbler_manager_unload_overrides_file (manager, file);
@@ -1650,7 +1629,7 @@ tumbler_manager_directory_changed (TumblerManager *manager,
else if (g_str_has_suffix (base_name, ".service"))
{
#ifdef DEBUG
- g_debug (" %s deleted", g_file_get_path (file));
+ g_debug (" %s deleted", g_file_peek_path (file));
#endif
tumbler_mutex_lock (manager->mutex);
tumbler_manager_thumbnailer_file_deleted (manager, file);
@@ -1663,7 +1642,7 @@ tumbler_manager_directory_changed (TumblerManager *manager,
else
{
#ifdef DEBUG
- g_debug (" %s deleted", g_file_get_path (file));
+ g_debug (" %s deleted", g_file_peek_path (file));
#endif
tumbler_mutex_lock (manager->mutex);
dir_index = tumbler_manager_get_dir_index (manager, file);
@@ -1695,7 +1674,7 @@ tumbler_manager_directory_changed (TumblerManager *manager,
if (event_type == G_FILE_MONITOR_EVENT_CREATED)
{
#ifdef DEBUG
- g_debug (" %s created", g_file_get_path (file));
+ g_debug (" %s created", g_file_peek_path (file));
#endif
tumbler_mutex_lock (manager->mutex);
tumbler_manager_load_overrides_file (manager, file);
@@ -1708,7 +1687,7 @@ tumbler_manager_directory_changed (TumblerManager *manager,
else if (event_type == G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT)
{
#ifdef DEBUG
- g_debug (" %s changed", g_file_get_path (file));
+ g_debug (" %s changed", g_file_peek_path (file));
#endif
tumbler_mutex_lock (manager->mutex);
tumbler_manager_unload_overrides_file (manager, file);
@@ -1725,7 +1704,7 @@ tumbler_manager_directory_changed (TumblerManager *manager,
if (event_type == G_FILE_MONITOR_EVENT_CREATED)
{
#ifdef DEBUG
- g_debug (" %s created", g_file_get_path (file));
+ g_debug (" %s created", g_file_peek_path (file));
#endif
tumbler_mutex_lock (manager->mutex);
tumbler_manager_load_thumbnailer (manager, file);
@@ -1738,7 +1717,7 @@ tumbler_manager_directory_changed (TumblerManager *manager,
else if (event_type == G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT)
{
#ifdef DEBUG
- g_debug (" %s changed", g_file_get_path (file));
+ g_debug (" %s changed", g_file_peek_path (file));
#endif
tumbler_mutex_lock (manager->mutex);
tumbler_manager_thumbnailer_file_deleted (manager, file);
@@ -1760,7 +1739,7 @@ tumbler_manager_directory_changed (TumblerManager *manager,
if (dir_index >= 0)
{
#ifdef DEBUG
- g_debug (" %s created", g_file_get_path (file));
+ g_debug (" %s created", g_file_peek_path (file));
#endif
tumbler_mutex_lock (manager->mutex);
@@ -1895,7 +1874,7 @@ dump_thumbnailers (TumblerManager *manager)
{
g_print (" %s:\n", base_name);
for (iter = *list; iter != NULL; iter = iter->next)
- g_print (" %s\n", g_file_get_path (((ThumbnailerInfo *)iter->data)->file));
+ g_print (" %s\n", g_file_peek_path (((ThumbnailerInfo *)iter->data)->file));
}
g_print ("\n");