[gnome-font-viewer] font-widget: sync from Sushi



commit 96ac15f7bcaa7a7f18496769b21b81eef2fa6cd8
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Fri Dec 7 09:53:15 2012 -0500

    font-widget: sync from Sushi

 src/sushi-font-loader.c |    7 +++++--
 src/sushi-font-widget.c |   16 +++++++++++++++-
 src/sushi-font-widget.h |    2 ++
 3 files changed, 22 insertions(+), 3 deletions(-)
---
diff --git a/src/sushi-font-loader.c b/src/sushi-font-loader.c
index 3168892..185e9dc 100644
--- a/src/sushi-font-loader.c
+++ b/src/sushi-font-loader.c
@@ -87,10 +87,13 @@ create_face_from_contents (FontLoadJob *job,
                                  &retval);
 
   if (ft_error != 0) {
-    g_set_error_literal (error, G_IO_ERROR, 0,
-                         "Unable to read the font face file");
+    gchar *uri;
+    uri = g_file_get_uri (job->file);
+    g_set_error (error, G_IO_ERROR, 0,
+                 "Unable to read the font face file '%s'", uri);
     retval = NULL;
     g_free (job->face_contents);
+    g_free (uri);
   } else {
     *contents = job->face_contents;
   }
diff --git a/src/sushi-font-widget.c b/src/sushi-font-widget.c
index c7d4c72..04ba9d6 100644
--- a/src/sushi-font-widget.c
+++ b/src/sushi-font-widget.c
@@ -37,6 +37,7 @@ enum {
 
 enum {
   LOADED,
+  ERROR,
   NUM_SIGNALS
 };
 
@@ -549,7 +550,7 @@ font_face_async_ready_cb (GObject *object,
                                        &error);
 
   if (error != NULL) {
-    /* FIXME: need to signal the error */
+    g_signal_emit (self, signals[ERROR], 0, error->message);
     g_print ("Can't load the font face: %s\n", error->message);
     g_error_free (error);
 
@@ -682,6 +683,13 @@ sushi_font_widget_class_init (SushiFontWidgetClass *klass)
                   0, NULL, NULL,
                   g_cclosure_marshal_VOID__VOID,
                   G_TYPE_NONE, 0);
+  signals[ERROR] =
+    g_signal_new ("error",
+                  G_TYPE_FROM_CLASS (klass),
+                  G_SIGNAL_RUN_FIRST,
+                  0, NULL, NULL,
+                  g_cclosure_marshal_VOID__STRING,
+                  G_TYPE_NONE, 1, G_TYPE_STRING);
 
   g_object_class_install_properties (oclass, NUM_PROPERTIES, properties);
   g_type_class_add_private (klass, sizeof (SushiFontWidgetPrivate));
@@ -704,3 +712,9 @@ sushi_font_widget_get_ft_face (SushiFontWidget *self)
 {
   return self->priv->face;
 }
+
+const gchar *
+sushi_font_widget_get_uri (SushiFontWidget *self)
+{
+  return self->priv->uri;
+}
diff --git a/src/sushi-font-widget.h b/src/sushi-font-widget.h
index 2120bc5..e60815f 100644
--- a/src/sushi-font-widget.h
+++ b/src/sushi-font-widget.h
@@ -63,6 +63,8 @@ SushiFontWidget *sushi_font_widget_new (const gchar *uri);
 
 FT_Face sushi_font_widget_get_ft_face (SushiFontWidget *self);
 
+const gchar *sushi_font_widget_get_uri (SushiFontWidget *self);
+
 G_END_DECLS
 
 #endif /* __SUSHI_FONT_WIDGET_H__ */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]