Support for X resource database management in GTK applications. See demo.c. The following three (3) routines are provided: gtk_initialize gtk_get_app_resource gtk_get_app_resources 0) int gtk_initialize(int *argc, char **argv, const char *app_class_name, GTK_CMD_OPT * cmd_opt_table, size_t cmd_opt_count); argc, argv Command line parameters. Returns the values left after parsing. app_class_name The application class name. Should not contain '.', '?', or '*'. If name is inappropriate, a modified copy will be made. cmd_opt_table A table of application command line arguments to be parsed. table_size The size of the table. gtk_initialize builds the application resource database and parses command line options. See XrmParseCommand(3X11). Recognized options are removed from argv and new values for argc and argv returned. We read and merge resource files in the following order: 0. /usr/X11/lib/X11/app-defaults/ 1. $XAPPLRESDIR/ 2. RESOURCE_MANAGER property or ~/.Xdefaults if RESOURCE_MANAGER is empty 3. $XENVIRONMENT or ~/.Xdefaults- if XENVIRONMENT is empty 4. command line options gtk_initialize should only be called after gtk_init_check in gtk/gtkmain.c, since gtk_initialize requires gdk_display and g_get_prgname. This means that if gtk_initialize is called from main(), this should only happen after after gtk_init. In my copies of GTK, I have simply renamed gtk_init to gtk_initialize and call gtk_init_check from within gtk_initialize. One notes that gtk_init takes &argv while gtk_initialize takes just argv. The database that is constructed is attached to the display so the user has access to the database (XrmGetDatabase(3X11)). 1) void gtk_get_app_resources(GTK_resource *resource, size_t size); resource A table of application resource size Table size Retrieves the values of a list of application resources. May only be called after gtk_initialize. 2) char *gtk_get_app_resource(const char *str_name, const char *str_class, GTK_RESOURCE_TYPE type, const char *defval, void *buf, size_t bufsize); str_name The name of the resource to be retrieved. The name does not contain the leading application [class] name. E.g. "foo.debug" instead of myApp.foo.debug str_class The class name of the value to be retrieved. type The data type of the value to be retrieved. GTK_BOOL, GTK_INT, ... buf Buffer where retrieved value should be stored. May be NULL. defval A default value (in string form) if resource entry is not found. bufsize Size of buf if type==GTK_STRING gtk_get_app_resource retrieves a single resource value. gtk_get_app_resource may only be called after gtk_initialize. ---- fotang@yahoo.com. 15Apr99.