[sushi] font-widget: add an error signal



commit 61b6f28d9372dd5b5e400b97b9ece2fdba92e6fa
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Fri Dec 7 09:49:18 2012 -0500

    font-widget: add an error signal
    
    When font loading fails, emit an "error" signal with the message.

 src/libsushi/sushi-font-widget.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/src/libsushi/sushi-font-widget.c b/src/libsushi/sushi-font-widget.c
index c7d4c72..b948a75 100644
--- a/src/libsushi/sushi-font-widget.c
+++ b/src/libsushi/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));



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