[gnome-font-viewer] font-view: factor out a method to display error dialog
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-font-viewer] font-view: factor out a method to display error dialog
- Date: Thu, 4 Jul 2019 23:10:16 +0000 (UTC)
commit bc422f33c0fa2833780c24f74853b941ea0bd47f
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Thu Jul 4 16:07:29 2019 -0700
font-view: factor out a method to display error dialog
We'll reuse this to display an error when installation fails.
src/font-view.c | 31 +++++++++++++++++++------------
1 file changed, 19 insertions(+), 12 deletions(-)
---
diff --git a/src/font-view.c b/src/font-view.c
index b9bac8b..e58095b 100644
--- a/src/font-view.c
+++ b/src/font-view.c
@@ -557,6 +557,24 @@ font_model_config_changed_cb (FontViewModel *model,
install_button_refresh_appearance (self, NULL);
}
+static void
+font_view_show_error (FontViewApplication *self,
+ const gchar *primary_text,
+ const gchar *secondary_text)
+{
+ GtkWidget *dialog;
+
+ dialog = gtk_message_dialog_new (GTK_WINDOW (self->main_window),
+ GTK_DIALOG_MODAL,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_CLOSE,
+ primary_text);
+ gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+ "%s", secondary_text);
+ g_signal_connect (dialog, "response", G_CALLBACK (gtk_widget_destroy), NULL);
+ gtk_widget_show (dialog);
+}
+
static void
font_view_show_install_error (FontViewApplication *self,
GError *error)
@@ -717,18 +735,7 @@ 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);
+ font_view_show_error (self, _("This font could not be displayed."), message);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]