summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--font-viewer/font-model.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/font-viewer/font-model.c b/font-viewer/font-model.c
index 5013d451..13dc94ca 100644
--- a/font-viewer/font-model.c
+++ b/font-viewer/font-model.c
@@ -240,6 +240,14 @@ typedef struct {
} LoadThumbnailData;
static void
+load_thumbnail_data_free (LoadThumbnailData *data)
+{
+ g_object_unref (data->self);
+ g_free (data->font_path);
+ g_slice_free (LoadThumbnailData, data);
+}
+
+static void
thumbnail_ready_cb (GObject *source,
GAsyncResult *res,
gpointer user_data)
@@ -300,6 +308,7 @@ pixbuf_async_ready_cb (GObject *source,
LoadThumbnailData *data = user_data;
GdkPixbuf *pix;
GtkTreeIter iter;
+ GFile *file;
pix = gdk_pixbuf_new_from_stream_finish (res, NULL);
@@ -310,11 +319,13 @@ pixbuf_async_ready_cb (GObject *source,
-1);
g_object_unref (pix);
+ } else {
+ file = g_file_new_for_path (data->font_path);
+ set_fallback_icon (data->self, file);
+ g_object_unref (file);
}
- g_object_unref (data->self);
- g_free (data->font_path);
- g_slice_free (LoadThumbnailData, data);
+ load_thumbnail_data_free (data);
}
static void
@@ -333,6 +344,9 @@ thumb_file_read_async_ready_cb (GObject *source,
128, 128, TRUE,
NULL, pixbuf_async_ready_cb, data);
g_object_unref (is);
+ } else {
+ set_fallback_icon (data->self, G_FILE (source));
+ load_thumbnail_data_free (data);
}
}
@@ -416,6 +430,9 @@ ensure_font_list (FontViewModel *self)
FcPatternGetString (self->priv->font_list->fonts[i], FC_FILE, 0, &file);
font_name = font_utils_get_font_name_for_file (self->priv->library, (const gchar *) file);
+ if (!font_name)
+ continue;
+
gtk_list_store_append (GTK_LIST_STORE (self), &iter);
gtk_list_store_set (GTK_LIST_STORE (self), &iter,
COLUMN_NAME, font_name,