summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorraveit65 <[email protected]>2017-01-08 20:20:43 +0100
committerraveit65 <[email protected]>2017-02-17 12:28:22 +0100
commit5cd279624ad264c97895a64c56946b5790b44390 (patch)
treec4ab9ddb053f24425119915856991c6ace491b91
parent82efaeeacd2da297869fca0499c1561ea849c49b (diff)
downloadmate-control-center-5cd279624ad264c97895a64c56946b5790b44390.tar.bz2
mate-control-center-5cd279624ad264c97895a64c56946b5790b44390.tar.xz
Fontviewer: font-view, show an error dialog when unable to load a font
taken from: https://git.gnome.org/browse/gnome-font-viewer/commit/?id=5a8f439
-rw-r--r--font-viewer/font-view.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/font-viewer/font-view.c b/font-viewer/font-view.c
index 640f7443..379f4f95 100644
--- a/font-viewer/font-view.c
+++ b/font-viewer/font-view.c
@@ -387,6 +387,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)
{
@@ -481,6 +510,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);
}