[gnome-font-viewer] font-view: show an error dialog when unable to load a font



commit 5a8f439d9081a5d28e7666760b9eae8c271a7d96
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Fri Dec 7 09:53:35 2012 -0500

    font-view: show an error dialog when unable to load a font

 src/font-view.c |   31 +++++++++++++++++++++++++++++++
 1 files changed, 31 insertions(+), 0 deletions(-)
---
diff --git a/src/font-view.c b/src/font-view.c
index c7d9c00..a9f3c2f 100644
--- a/src/font-view.c
+++ b/src/font-view.c
@@ -404,6 +404,35 @@ back_button_clicked_cb (GtkButton *button,
 }
 
 static void
+font_view_show_font_error (FontViewApplication *self,
+                           const gchar *message)
+{
+    GtkWidget *dialog;
+
+    dialog = gtk_message_dialog_new (GTK_WINDOW (self->main_window),
+                                     GTK_DIALOG_MODAL,
+                                     GTK_MESSAGE_ERROR,
+                                     GTK_BUTTONS_CLOSE,
+                                     _("This font could not be displayed."));
+    gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+                                              "%s",
+                                              message);
+    g_signal_connect (dialog, "response", G_CALLBACK (gtk_widget_destroy), NULL);
+    gtk_widget_show (dialog);
+}
+
+static void
+font_widget_error_cb (SushiFontWidget *font_widget,
+                      const gchar *message,
+                      gpointer user_data)
+{
+    FontViewApplication *self = user_data;
+
+    font_view_application_do_overview (self);
+    font_view_show_font_error (self, message);
+}
+
+static void
 font_widget_loaded_cb (SushiFontWidget *font_widget,
                        gpointer user_data)
 {
@@ -498,6 +527,8 @@ font_view_application_do_open (FontViewApplication *self)
 
         g_signal_connect (self->font_widget, "loaded",
                           G_CALLBACK (font_widget_loaded_cb), self);
+        g_signal_connect (self->font_widget, "error",
+                          G_CALLBACK (font_widget_error_cb), self);
     } else {
         g_object_set (self->font_widget, "uri", uri, NULL);
     }



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