summaryrefslogtreecommitdiff
path: root/font-viewer
diff options
context:
space:
mode:
authorraveit65 <[email protected]>2017-01-08 19:11:59 +0100
committerraveit65 <[email protected]>2017-02-17 12:28:22 +0100
commitd31b6df0d02cb8cc8276f40c3636fd1ca257cf17 (patch)
tree1eee545082bf43e069ba8085310c23005d768919 /font-viewer
parent4a7cc755da10368126a20b011c7a16b48d105697 (diff)
downloadmate-control-center-d31b6df0d02cb8cc8276f40c3636fd1ca257cf17.tar.bz2
mate-control-center-d31b6df0d02cb8cc8276f40c3636fd1ca257cf17.tar.xz
Font-viewer: font-model, don't use sync g_file_query_info()
Use g_file_query_info_async() instead. taken from: https://git.gnome.org/browse/gnome-font-viewer/commit/?id=d360c01
Diffstat (limited to 'font-viewer')
-rw-r--r--font-viewer/font-model.c33
1 files changed, 23 insertions, 10 deletions
diff --git a/font-viewer/font-model.c b/font-viewer/font-model.c
index 13dc94ca..f6fefa27 100644
--- a/font-viewer/font-model.c
+++ b/font-viewer/font-model.c
@@ -114,7 +114,6 @@ create_thumbnail (GIOSchedulerJob *job,
}
g_object_unref (info);
- g_object_unref (file);
g_object_unref (factory);
g_clear_object (&pixbuf);
@@ -351,19 +350,18 @@ thumb_file_read_async_ready_cb (GObject *source,
}
static void
-ensure_thumbnail (FontViewModel *self,
- const gchar *path)
+thumbnail_query_info_cb (GObject *source,
+ GAsyncResult *res,
+ gpointer user_data)
{
- GFile *file, *thumb_file = NULL;
+ FontViewModel *self = user_data;
+ GFile *file = G_FILE (source);
+ GFile *thumb_file = NULL;
GFileInfo *info;
const gchar *thumb_path;
LoadThumbnailData *data;
- file = g_file_new_for_path (path);
- info = g_file_query_info (file, G_FILE_ATTRIBUTE_THUMBNAIL_PATH ","
- G_FILE_ATTRIBUTE_THUMBNAILING_FAILED,
- G_FILE_QUERY_INFO_NONE,
- NULL, NULL);
+ info = g_file_query_info_finish (file, res, NULL);
if (!info ||
g_file_info_get_attribute_boolean (info, G_FILE_ATTRIBUTE_THUMBNAILING_FAILED)) {
@@ -389,10 +387,25 @@ ensure_thumbnail (FontViewModel *self,
}
out:
- g_clear_object (&file);
g_clear_object (&info);
}
+static void
+ensure_thumbnail (FontViewModel *self,
+ const gchar *path)
+{
+ GFile *file;
+
+ file = g_file_new_for_path (path);
+ g_file_query_info_async (file,
+ G_FILE_ATTRIBUTE_THUMBNAIL_PATH ","
+ G_FILE_ATTRIBUTE_THUMBNAILING_FAILED,
+ G_FILE_QUERY_INFO_NONE,
+ G_PRIORITY_DEFAULT, NULL,
+ thumbnail_query_info_cb, self);
+ g_object_unref (file);
+}
+
/* make sure the font list is valid */
static void
ensure_font_list (FontViewModel *self)