Re: [gtk-list] Newbie gtk questions




"Eric J. Schwertfeger" <eric@cybernut.com> writes:

> The remaining questions all have to do with GtkStyle and gtk_read_rc(), and
> my desire to provide default values that can be overridden with the rc file.
> I can approach this in several ways, I'm just trying to figure out what is
> most feasible.
> 
> 	1) Create my styles and use them, but then how to override them?
> 	   Create my styles only if the rc file doesn't exist?
> 	2) Have a global rc file that gets copied to some part of the users
> 	   home directory.  What if the file is missing?
> 	3) Have a global rc and a local rc file. Same concern

There are better experts on rc file issues, but I'll try to answer
some of your questions.

You may want to look into making your application a GNOME application
- that is, use the GNOME library, which has support for a search
path, with multiple stacked rc files. (see www.gnome.org)

I wouldn't worry to much about compiling defaults into your program -
if the user can't be bothered to install your program properly,
they'll just have to live with the standard GTK look.

> Third question:  what is the official way to copy a GtkStyle? I have 
> figured out you can't just modify the GtkStyle that gtk_widget_get_style
> returns, as that usually affects more than just the widget you're trying
> to modify. At the moment, I'm just getting a gtk_style_new, but as my
> application grows, I'm going to be wanting to say "style X but with this
> one change" more and more often.

I suspect this won't come up in practice. You probably should just
define all your styles in the rc file (in which some styles _can_
"inherit" from others, see gtk/testgtkrc). Plus, on the
interface-design side of things it's probably best to stick with a 
fairly small number of styles to maintain consistency throughout your
application. (And to allow the user to modify things relatively easily)

> Fourth question:  I've noticed that it is possible to call gtk_rc_parse()
> multiple times (for example a site config file, then a personal config
> file), and changes to existing styles seem to be cumulative, as do new
> style definiitions and new widget_class bindings, but overriding
> previous widget_class bindings, and inherriting styles defined in other 
> rc files doesn't seem to work.  Are there any plans to make this work
> smoother, or is this something that I shouldn't even be toying with?

If this doesn't work now, I'm sure the GNOME people will fix it.

> Last real question:  using gtk_rc_parse(), is there any way to store
> non-gtk application configuration information in the rc file? I'd rather
> avoid having two rc files for the application.

No. You'll probably have to live with that situation, though GNOME
will have a library that should make that more palatable.

> Last question: Why is libgtk so much larger than libqt? i haven't noticed
> that much of a difference in their functionality, but I haven't gotten
> very far into them yet.

I would guess it's because GTK is compiled with debugging enabled,
while libqt is not. (Even if GTK is not compiled with --enable-debug,
the CFLAGS by default will be -g -O2. Developers really should
specify --enable-debug anyways. But you can compile without debugging
by doing CFLAGS=-O2 configure ...)

Good luck with your project,
                                        Owen



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