aboutsummaryrefslogtreecommitdiffstats
path: root/main.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2013-05-21 23:13:45 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-05-21 23:39:49 -0700
commit478baf107623c3aa0c31c3256cfc3bc794b089b1 (patch)
tree090485f799a36090bf4a301ba8611f0b5686a44a /main.c
parent5aa8b52f82399bd4343a8213927c7e9694def1bc (diff)
downloadsubsurface-478baf107623c3aa0c31c3256cfc3bc794b089b1.tar.gz
Replace GError handling with a kMessageWidget based approach
Instead of passing pointers to GError around we pass just pointers to error message texts around and use kMessageWidget to show those. Problem is that right now the close button on that doesn't do a thing - so the error stays around indefinitely. Oops. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'main.c')
-rw-r--r--main.c21
1 files changed, 5 insertions, 16 deletions
diff --git a/main.c b/main.c
index 82e82b2e9..009218c0c 100644
--- a/main.c
+++ b/main.c
@@ -159,6 +159,7 @@ int main(int argc, char **argv)
int i;
gboolean no_filenames = TRUE;
const char *path;
+ char *error_message = NULL;
/* set up l18n - the search directory needs to change
* so that it uses the correct system directory when
@@ -179,34 +180,22 @@ int main(int argc, char **argv)
for (i = 1; i < argc; i++) {
const char *a = argv[i];
-
if (a[0] == '-') {
parse_argument(a);
continue;
}
- GError *error = NULL;
- /* if we have exactly one filename, parse_file will set
- * that to be the default. Otherwise there will be no default filename */
set_filename(NULL, TRUE);
- parse_file(a, &error);
+
+ parse_file(a, &error_message);
if (no_filenames)
{
set_filename(a, TRUE);
no_filenames = FALSE;
}
- if (error != NULL)
- {
-#if USE_GTK_UI
- report_error(error);
-#endif
- g_error_free(error);
- error = NULL;
- }
}
if (no_filenames) {
- GError *error = NULL;
const char *filename = prefs.default_filename;
- parse_file(filename, &error);
+ parse_file(filename, NULL);
/* don't report errors - this file may not exist, but make
sure we remember this as the filename in use */
set_filename(filename, FALSE);
@@ -215,7 +204,7 @@ int main(int argc, char **argv)
parse_xml_exit();
subsurface_command_line_exit(&argc, &argv);
- init_qt_ui(&argc, &argv); /* qt bit delayed until dives are parsed */
+ init_qt_ui(&argc, &argv, error_message); /* qt bit delayed until dives are parsed */
run_ui();
exit_ui();
return 0;