Re: Gtk rc file parsing question



* Owen Taylor (otaylor@redhat.com) wrote:
> 
> Tom Gilbert <gilbertt@tomgilbert.freeserve.co.uk> writes:
> 
> > Hi folks,
> > 
> > My application parses a special rc file, assigning special styles to
> > some of my widgets, using named styles, and gtk_widget_set_name.
> > 
> > This works beautifully.
> > 
> > I have two different rc files (at the moment), in separate
> > directories. One uses colours to change the widgets, the other is a
> > pixmap engine theme, assigning backgroung pixmaps to the widgets.
> > 
> > I have a properties box, allowing users to change between these rc
> > files.
> 
> [ I'll avoid commenting on whether this is good user interface
>   design. What happens if the user has some theme selected
>   already? ]

I think you misunderstand me... The gtkrc uses named styles, and the
rc file only applies to a specific part of the app.

The game is a scrabble clone, and the rc file only applies styles for
the board and the letter tiles. The users theme is unaffected.

The themes are things like 'scifi', 'classic' etc, and just change the
board.

My interface design rules! ;)

Check out www.tomgilbert.freeserve.co.uk/gnerudite.html to see a
screenshot. See how changing the board theme leaves the surrounding
theme unaffected?

I am trying to give an option to use the user's current theme only, but
to still set the background colour of the 'special' tiles.

This I can do, but I can not get the theme to change without
restarting the app.

I'm about to go back and try this kludge:
1) Call gtk_rc_parse on the new theme
2) Change the names of the widgets to their original names (switch to
users theme)
3) gtk_reparse_all
4) gtk_reset_all_styles(window)
5) Change names back to themed ones.
(something like that anyway, code not in front of me)

I don't know if this'll work, but even if it does, its not pretty ;)

Tom.
-- 
            .-------------------------------------------------------.
    .^.     | Tom Gilbert, England | tom@tomgilbert.freeserve.co.uk |
    /V\     |----------------------| www.tomgilbert.freeserve.co.uk |
   // \\    | Sites I recommend:   `--------------------------------|
  /(   )\   | www.freshmeat.net www.enlightenment.org www.gnome.org |
   ^^-^^    `-------------------------------------------------------'



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