GNC error/warning dialogs

David Hampton
19 Apr 2002 13:16:47 -0700

Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

Any objection to my pushing the formatting of error/warning dialog
message strings into the gnc_xxx_dialog() routines?  These library
functions would grow a bit, but most of the callers of these routines
would simplify.  This also has the benefit of consolidating all the
logic about creating/freeing temporary strings and results into one

Here's a typical diff:

@@ -687,15 +685,9 @@
     const char *format =3D _("The file \n    %s\n already exists.\n"
                            "Are you sure you want to overwrite it?");
-    char *tmpmsg;
-    gboolean result;
-    tmpmsg =3D g_strdup_printf (format, newfile);
-    result =3D gnc_verify_dialog (tmpmsg, FALSE);
-    g_free (tmpmsg);
     /* if user says cancel, we should break out */
-    if (!result)
+    if (!gnc_verify_dialog (FALSE, format, newfile))
       g_free (newfile);

There are two drawbacks.  First, invariant messages will also be
duplicated by the library function before the dialog is created.=20
Second, the order of the arguments to these dialog creation routines
changes as the format string gets pushed to the end of the function call
as the last required argument to the function.  (This last isn't a
requirement of the compiler, but its conceptually simpler to group the
format string and its variable number of arguments together.)  All of
these routines would still perform compile time checking of the
arguments to the format string.



Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part

Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see