Re: theme-switch hack



On Tue, 2003-05-20 at 19:33, suk wrote:
> Hi again, 
> I was looking at theme-switch from muhri. He allows to preview themes
> before he switch them. And he does this with:
> 
> 1) locate theme
> 2) fork another process
>         inside the child he does
> 
>         gchar *default_files[2] = { located_theme , NULL };
>         gtk_rc_set_default_files( default_files );
>         gtk_init( &argc, &argv );
> 
>         create preview_window with plenty widgets
> 
> This is because he needs really fresh gtk. Tweaking default_files 
> after gtk_init is too late. When I first do gtk_init and then change 
> gtk_rc_set_default_files, or call reparse_all or anything, I will always 
> get some strange merge of several themes.
>         As I don't understand gtkrc exactly, I think that the problem
> might be in static variable global_rc_files in gtkrc.c. Every new theme 
> is added there, but never removed. Is my intention correct ? 
> 
> I'd like to write theme-switch in similar way as gnomecc. No need to
> fork. Have some widgets in container and say them to change theme.
> But I don't understand gnomecc code. I was completely lost, when even
> browsing through it. 
> Can someone gimme a hint please ?

Every GTK+ program effectively has only a single theme. That's why
a fork is necessary if you want to both standard and "preview"
widgets.

You can override the default really easily with GTK+-2.2 for the
current application.

 GtkSettings *settings = gtk_settings_get_default ();
 g_object_set (settings, "gtk-theme-name", "MyTheme", NULL);

Regards,
                                           Owen





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