Merge pull request #25 from gergelypolonkai/error-checking
Add error checking to some ignored places
This commit is contained in:
commit
452475d63c
16
src/ag-app.c
16
src/ag-app.c
@ -342,3 +342,19 @@ ag_app_class_init(AgAppClass *klass)
|
|||||||
application_class->open = ag_app_open;
|
application_class->open = ag_app_open;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ag_app_message_dialog(GtkWidget *window, GtkMessageType message_type, gchar *fmt, ...)
|
||||||
|
{
|
||||||
|
gchar *msg;
|
||||||
|
va_list args;
|
||||||
|
GtkWidget *dialog;
|
||||||
|
|
||||||
|
va_start(args, fmt);
|
||||||
|
msg = g_strdup_vprintf(fmt, args);
|
||||||
|
va_end(args);
|
||||||
|
|
||||||
|
dialog = gtk_message_dialog_new(GTK_WINDOW(window), GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, message_type, GTK_BUTTONS_OK, "%s", msg);
|
||||||
|
g_free(msg);
|
||||||
|
gtk_dialog_run(GTK_DIALOG(dialog));
|
||||||
|
gtk_widget_destroy(dialog);
|
||||||
|
}
|
||||||
|
@ -37,6 +37,7 @@ void ag_app_raise(AgApp *self);
|
|||||||
void ag_app_run_action(AgApp *app,
|
void ag_app_run_action(AgApp *app,
|
||||||
gboolean is_remote,
|
gboolean is_remote,
|
||||||
const AstrognomeOptions *options);
|
const AstrognomeOptions *options);
|
||||||
|
void ag_app_message_dialog(GtkWidget *window, GtkMessageType message_type, gchar *fmt, ...);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
@ -165,7 +165,9 @@ ag_window_save_action(GSimpleAction *action, GVariant *parameter, gpointer user_
|
|||||||
ag_window_save_as(window, &err);
|
ag_window_save_as(window, &err);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Check err!
|
if (err) {
|
||||||
|
ag_app_message_dialog(GTK_WIDGET(window), GTK_MESSAGE_ERROR, "%s", err->message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -177,7 +179,9 @@ ag_window_save_as_action(GSimpleAction *action, GVariant *parameter, gpointer us
|
|||||||
recalculate_chart(window);
|
recalculate_chart(window);
|
||||||
ag_window_save_as(window, &err);
|
ag_window_save_as(window, &err);
|
||||||
|
|
||||||
// TODO: Check err!
|
if (err) {
|
||||||
|
ag_app_message_dialog(GTK_WIDGET(window), GTK_MESSAGE_ERROR, "%s", err->message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -253,7 +257,9 @@ ag_window_export_svg_action(GSimpleAction *action, GVariant *parameter, gpointer
|
|||||||
|
|
||||||
ag_window_export_svg(window, &err);
|
ag_window_export_svg(window, &err);
|
||||||
|
|
||||||
// TODO: Check err!
|
if (err) {
|
||||||
|
ag_app_message_dialog(GTK_WIDGET(window), GTK_MESSAGE_ERROR, "%s", err->message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const gchar *
|
const gchar *
|
||||||
|
Loading…
Reference in New Issue
Block a user