From cc7aed38c190a4e6d91be7c5954611d208c8dbe2 Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Sun, 30 Mar 2014 17:52:57 +0200 Subject: [PATCH] Add GTK message dialogs instead of g_warning() calls. This is to enhance UX. Fix #9 --- src/ag-app.c | 6 +++++- src/ag-window.c | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/ag-app.c b/src/ag-app.c index 1384176..0581cd0 100644 --- a/src/ag-app.c +++ b/src/ag-app.c @@ -201,7 +201,11 @@ show_help(const gchar *topic, GtkWindow *parent) } if (!gtk_show_uri(screen, uri, gtk_get_current_event_time(), &err)) { - g_warning("Unable to display help: %s", err->message); + GtkWidget *dialog; + + dialog = gtk_message_dialog_new(parent, GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, "Unable to display help: %s", err->message); + gtk_dialog_run(GTK_DIALOG(dialog)); + gtk_widget_destroy(dialog); } g_free(uri); diff --git a/src/ag-window.c b/src/ag-window.c index fee60f6..28c69a5 100644 --- a/src/ag-window.c +++ b/src/ag-window.c @@ -179,7 +179,11 @@ ag_window_redraw_chart(AgWindow *window) svg_content = ag_chart_create_svg(window->priv->chart, &err); if (svg_content == NULL) { - g_warning("%s", err->message); + GtkWidget *dialog; + + dialog = gtk_message_dialog_new(GTK_WINDOW(window), 0, GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, "Unable to draw chart: %s", err->message); + gtk_dialog_run(GTK_DIALOG(dialog)); + gtk_widget_destroy(dialog); } else { webkit_web_view_load_string(WEBKIT_WEB_VIEW(window->priv->tab_chart), svg_content, "image/svg+xml", "UTF-8", "file://"); g_free(svg_content);