Re: gtk_message_dialog_new_with_markup() revisited



On Wed, 2003-08-13 at 05:01, Matthias Clasen wrote:
> > What do people think?
> 
> I think I'd prefer to have a new format conversion for that. Something like
> 
> ..._with_markup ("<i>%m</i> %s", "this gets escaped", "this
> <b>doesn't</b>");
> 
> But this wouldn't be any easier to implement, unless we want to rely on
> glibc features.
> I think it addresses 
> 
> > - Perhaps a bit too magic
> > - You might sometimes actually want markup in string
> >   arguments.
> > - If you have a preexisting string with markup, you can't
> >   set it as the text of a message dialog by doing:
>
> Although it doesn't completely eliminate the trap. People still have to
> remember to use %m instead of  %s.

It doesn't eliminate the trap at all. Though it does solve the
convenience issue. 

If we were going this route, I think a new flag would make more
sense than a separate format character; perhaps %&s to escape
or better, solving the trap, %=s to not escape.

 - We need to escape at least %s and %c, and perhaps other 
   format characters we don't know about.
 - Less chance of collision. For example, %m is already used
   by GNU libc to mean strerror(errno)

Either a new format characters or a new flag would be fairly trivial
to implement with the code I posted to the bug.

*However*, any extension to printf() syntax, whether new formats
character or a new flag, removes the ability to use G_GNUC_PRINTF() and
that is pretty much a killer objection from my perspective. Those
warnings are just too valuable to give up.

We could hijack %#s which has no standard meaning; gcc passes that
currently. But I'm not sure that we can count on that for the future.

Regards,
						Owen





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]