Re: GTK & .Xdefaults/app-defaults/X resources?




robertb@continuumsi.com (Robert Brown) writes:

> I was thinking about converting an existing (Athena widgets) X application to
> use GTK instead.  Half the application is in the app-defaults file.  In order
> to minimize the amount of rewriting needing to be done, I was wondering if
> there's any way I could use the existing app-defaults file structure in
> GTK.  I am willing to modify it a bit, but I'd prefer not to have to convert
> the entire thing to a GTK rc file.
> 
> Neither the GTK+ Tutorial nor the Reference Guide touches upon the use of
> X resources (at least, as far as I could tell).

It was (I believe) an intentional design decision to avoid X
resources entirely when designing GTK+. From what I've seen,
although they promise a lot of flexibility, they don't deliver
it for the end user, and they add a lot of complexity for the
developer.

So you'll need to find alternatives. To my knowledge, there are
pretty much three uses of an resource file in an X program.

 - To set user-configurable parameters. GTK+ itself does not
   contain a mechanism for this in general - the gtkrc only 
   covers colors, background pixmaps, and fonts. The gnome-libs
   package includes gnome-config which is meant for storing
   application specific options.

 - To act as a catalogue of strings and internal parameters.
   The GTK+ way has generally just been to hardcode the strings
   into the source code files. If internationalization is
   a concern, the gettext package can be used to extract 
   strings and provide locale-dependent translations.

 - To store part of the UI design (menus, widget parameters).
   GTK+ has no current scheme for this (except for the MenuFactory
   which allows building menus out of an array). However, 
   a textual description for the user interface is part of the
   plans for user interface builders such as Glade and GLE which
   are under construction.

As you might conclude, there really is no way to convert the
app-default files wholesale into the GTK+ world. I think for that kind
of translation to be feasible, GTK+ would have to look quite
a bit more like an Xt-based toolkit than it does.

Sorry not to be able to provide a more useful answer,

                                        Owen



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