Re: [gtk-list] Newbie gtk questions



On Mon, 20 Oct 1997, Eric J. Schwertfeger wrote:

> 
> I'm doing some quick prototyping of my next project (a mini-quicken app),
> using both gtk and Qt, using this as a basis to choose my next widget kit.
> So far, most of the problems I've encountered with gtk have been a lack of
> documentation, but between the source to gtk and gimp, I've been able to
> figure out most things.

Hmm.. I'm wondering why so many people fail to find this tutorial:

http://www.levien.com/~slow/gtk

> First question: Has anyone been able to compile gubi on a non-Linux
> platform? The MAP_ANONYMOUS define used with mmap() doesn't exist on FreeBSD
> or Solaris.

No, ask Tim :)  He develops on Linux, so it may have some specifics he was
unaware of.

> 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
> 	
> Of these, which fits best into the concepts of gtk? Ideally, I'd like to
> have values compiled into the program, with a way for them to be
> overridden/modified by a global config file, and further a way to
> override/modify the global file with a local one.

If you want to hardcode your styles, set them before calling
gtk_rc_parse().. gtk_rc_parse will override any style defined in the file. 

My suggestion however, is to use rc files for all your styles.. it's
easier, and fairly powerful.. you should read the section on it in the GTK
tutorial.  To give you some ideas, you can set any widget to be 'named' so
that you can set it's style individually in the rc file.

rc files should be cumulative.. in the code, everytime something is set,
it checks the old style, free's the memory if it's allocated, and then
assigns it to the new style.

I'd like to recommend that everyone use the same config file for gtk..
like /etc/gtkrc and ~/.gtkrc so that all gtk applications can be
configured in one place... GNOME helps this, but not all apps are gnome
apps..    Heh, you could put it in gtk_init() so all apps do it whether
they like it or not. :)

[snip]

> Fifth question:  If I can't get the above dual rc file idea to work, is
> there some way to provide defaults that the rc file can override? I'd
> rather avoid doing the traditional "copy the rc file from a master file
> the first time the user starts up the application" type of defaults.

The dual rc files should work.. And if it doesn't send a patch ;-).
 
> 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.

Nope, not currently.. Not unless you wanted to do something really ugly,
but I don't think you do..

> 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'm guessing, but it's probably because it's compiled with debugging by
default.  GTK is pretty lean.. if you check your 'ps' output, you'll find
the memory footprint is pretty small.  Smaller than Motif or Qt.


Regards,

Ian




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