1 /* gEDA - GPL Electronic Design Automation
2 * gschem - gEDA Schematic Capture
3 * Copyright (C) 1998-2020 gEDA Contributors (see ChangeLog for details)
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
26 /* Error handler function used by x_rc_parse_gschem(). */
28 x_rc_parse_gschem_error (GError
**err
)
30 char *msg2
; /* Secondary text */
33 g_assert (err
!= NULL
);
35 /* Take no chances; if err was not set for some reason, it's a
39 s_log_message (_("ERROR: An unknown error occurred while parsing "
40 "configuration files.\n"));
44 g_strdup (_("An unknown error occurred while parsing configuration files."
45 "\n\nThe gschem log may contain more information."));
48 /* Config files are allowed to be missing or skipped; check for
50 if (g_error_matches (*err
, G_FILE_ERROR
, G_FILE_ERROR_NOENT
) ||
51 g_error_matches (*err
, EDA_ERROR
, EDA_ERROR_RC_TWICE
)) {
56 s_log_message (_("ERROR: %s\n"), (*err
)->message
);
59 msg2
= g_strdup_printf (_("%s\n\n"
60 "The gschem log may contain more information."),
64 dialog
= gtk_message_dialog_new (NULL
,
65 GTK_DIALOG_MODAL
, GTK_MESSAGE_ERROR
,
67 _("Cannot load gschem configuration."));
68 g_object_set (G_OBJECT (dialog
), "secondary-text", msg2
, NULL
);
69 gtk_dialog_run (GTK_DIALOG (dialog
));
70 gtk_widget_destroy (dialog
);
74 /*! \brief Load gschem configuration files and display error dialogs.
75 * \par Function Description
76 * Loads configuration files in a similar manner to g_rc_parse().
77 * Instead of exiting on error, display error dialogs with explanatory
80 * \param w_current The current #GschemToplevel structure.
81 * \param rcfile Specific config file path, or NULL.
84 x_rc_parse_gschem (TOPLEVEL
*toplevel
, const gchar
*rcfile
) {
85 return g_rc_parse_handler (toplevel
, "gschemrc", rcfile
,
86 (ConfigParseErrorFunc
) x_rc_parse_gschem_error
,