Re: Call for vetoes: Setting the global C++ locale in Gtk::Main
- From: Alexander Shaduri <ashaduri gmail com>
- To: Daniel Elstner <daniel kitta googlemail com>
- Cc: gtkmm mailing list <gtkmm-list gnome org>
- Subject: Re: Call for vetoes: Setting the global C++ locale in Gtk::Main
- Date: Sun, 25 Apr 2010 17:40:30 +0400
Hello,
On Tue, 30 Mar 2010 19:18:14 +0200
Daniel Elstner <daniel kitta googlemail com> wrote:
> the attached patch is currently being considered for application to
> gtkmm, both stable and unstable. Since it changes user-visible
> behavior, it is possible that it may break some odd piece of code out
> there.
>
> If it breaks your code, raise your veto now. :-)
This doesn't exactly break my code (and maybe my issue is
a bit off-topic), but I just had a look at my code and noticed the
following source of potential issues:
Using gtk_get_option_group() and g_option_context_parse()
initializes gtk. (I don't use the glibmm version due to some reason
I don't remember anymore).
Now, for example, I don't want to use the system locale and
want to stick with the classic one.
I could use gtk_disable_setlocale() before g_option_context_parse()
to avoid changing the system locale when that happens.
To initialize gtkmm as well (without changing the locale), I would use
Gtk::Main m(argc, argv, false);
This would prevent it to set the C++ locale (the end result will
be that both C and C++ locales are set to classic).
However, this generates a warning:
Gtk-WARNING **: gtk_disable_setlocale() must be called before gtk_init(),
probably due to the fact that Gtk::Main::Main() also calls the
gtk_disable_setlocale() if the use_locale parameter is false.
To avoid this warning I have to save the C++ locale before the
Gtk::Main::Main() call and restore it afterwards.
Perhaps the more correct way to fix this would be to check
if GTK is initialized before calling gtk_disable_setlocale()
in Gtk::Main's constructor? (not sure how to do that though).
Thanks,
Alexander
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]