Re: proposal: built-in gtk's support for ability to specify alternativegtkrc files to load using commandline switch



On 19 Aug 2000, Owen Taylor wrote:

> 
> Vlad Harchev <hvv@hippo.ru> writes:
> 
> >  I think it would be nice if all gtk applications supported (due to builtin
> > support in gtk_init()) a commandline switch named something like --gtkrc, that
> > has a parameter - the list of gtkrc files to load. It's easy to implement
> > (just call gtk_rc_set_default_files() or gtk_rc_add_default_file()), but makes
> > all gtk apps more flexible.
> > 
> >  To be elaborate, I propose one variant of the syntax for the parameter to
> > that commandline switch:
> > 
> >  The parameter is comma separated list of gtkrc filenames (not colon since
> > it's used in pathname on Win32). If the 1st item of the list of filenames is
> > plain dot ".", then it has the special meaning - the filelist will be added to
> > the set of gtk rc files to be parsed, rather than replacing it entirely.
> > Otherwise (if 1st element in the path is not plain dot), the list of default
> > gtkrc files is replaced with the specified.
> > 
> >  Also, I think ability to read some environmental variable (like GTKRCS) whose
> > value obeys the same syntax would be a plus IMO (since it allows to request
> > loading different set of gtkrc files withour changing commandlines of
> > applications).
> 
> >From gtkrc.c:
> 
>   var = g_getenv("GTK_RC_FILES");
>   if (var)
>     {
>       files = g_strsplit (var, G_SEARCHPATH_SEPARATOR_S, 128);
>       i=0;
>       while (files[i])
> 	{
> 	  gtk_rc_add_default_file (files[i]);
> 	  i++;
> 	}
>       g_strfreev (files);
>     }
> 
> (SEARCHPATH_SEPARATOR is ':' on unix and ';' on Win32)

  Oops, I didn't notice this code. 

> I don't really see a point in the command line argument, but if there
> is a problem it solves, it could be added.

  It's very nice that gtk supports $GTK_RC_FILES already, but I would call
support for separate commandline option rather orthogonal, since in case of 
environment variable all child processes of the app will use the same set
of gtkrc files as the parent, while if the set of gtkrc files were specified
via commandline that set of gtkrc files won't be propagated to the childs. I
think this could be important in some situations. So, stricly speaking, the
presence of commandline switch is a useful and is non-interferring 
functionality, so it may be nice to add it.
 
> Regards,
>                                         Owen         

 Best regards,
  -Vlad






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