gtkrc file handling - suggestion and patch



  As of the latest version of GTK+, gtk_init() parses ~/.gtkrc when it is run.
This allows for centralized configuration of the look and feel of GTK+ programs,
but Gnome still uses ~/gnome/gtkrc for its GTK+ configuration.  This means that
without doing things such as linking ~/.gtkrc to ~/gnome/gtkrc, you can't easily
share GTK configuration files between Gnome and non-Gnome programs, and even
causes problems when you've set gtkrc separately since you can end up with
conflicting configuration information from .gtkrc and gnome/.gtkrc.  I think
that the proper solution is to eliminate gnome/gtkrc and have the theme-switcher
capplet modify ~/.gtkrc.  I've poked around in Gnome and there appear to be
only two places where this really has to be modified; I did that and it's
working on my system.  One other program loads ~/.gtkrc manually, that line can
probably be eliminated.  (I don't remember which but I've attached the
output of 'grep gtkrc `find ~/gnome -iname "*.[ch]"`' to this message)  The
per-application gtkrc files look like a good idea to me, but there's a
load of "gnomedatadir/gtkrc" that I don't know what to do with.

  The first patch applies to gnome-libs/libgnomeui, the second to
control-center/capplets/theme-switcher.

  One other minor themes quibble, in a lot of themes with larger text, menu
items get truncated wholesale.  Not sure what a better behavior would be though.
And is there any way to fix the tiny buttons on the Win95-theme scrollbars?
I actually like the theme aside from that (although I'll probably keep using
thinice..)

-- 
  Daniel Burrows

  Things are not as bad as they seem.

  PROOF:
(a) Assume the opposite
(b) If things really are as bad as they seem, then they cannot get any worse
(c) If things cannot get any worse, then that is something good about them
(d) Therefore, things are not as bad as they seem.  QED
Index: gnome-init.c
===================================================================
RCS file: /cvs/gnome/gnome-libs/libgnomeui/gnome-init.c,v
retrieving revision 1.62.2.1
diff -c -r1.62.2.1 gnome-init.c
*** gnome-init.c	1998/12/17 02:16:00	1.62.2.1
--- gnome-init.c	1998/12/19 22:03:03
***************
*** 403,409 ****
   * Parse:
   * $gnomedatadir/gtkrc
   * $gnomedatadir/$apprc
-  * ~/.gnome/gtkrc
   * ~/.gnome/$apprc
   *
   * appname is derived from argv[0].  IMHO this is a great solution.
--- 403,408 ----
***************
*** 450,462 ****
  
  	/* <gnomedatadir>/<progname> */
  	file = gnome_datadir_file(apprc);
- 	if (file){
- 		gtk_rc_parse (file);
- 		g_free (file);
- 	}
- 	
- 	/* ~/.gnome/gtkrc */
- 	file = gnome_util_home_file("gtkrc");
  	if (file){
  		gtk_rc_parse (file);
  		g_free (file);
--- 449,454 ----
Index: lister.c
===================================================================
RCS file: /cvs/gnome/control-center/capplets/theme-switcher/lister.c,v
retrieving revision 1.1
diff -c -r1.1 lister.c
*** lister.c	1998/09/23 02:39:17	1.1
--- lister.c	1998/12/19 21:19:07
***************
*** 63,69 ****
    home = getenv("HOME");
    if (!home)
      return;
!   g_snprintf(s, sizeof(s), "%s/.gnome/gtkrc", home);
    srand(time(NULL));
    g_snprintf(gtkrc_tmp, sizeof(gtkrc_tmp), "/tmp/%i-gtkrc-%i", time(NULL), rand());
    cp(s, gtkrc_tmp);
--- 63,69 ----
    home = getenv("HOME");
    if (!home)
      return;
!   g_snprintf(s, sizeof(s), "%s/.gtkrc", home);
    srand(time(NULL));
    g_snprintf(gtkrc_tmp, sizeof(gtkrc_tmp), "/tmp/%i-gtkrc-%i", time(NULL), rand());
    cp(s, gtkrc_tmp);
***************
*** 77,83 ****
    home = getenv("HOME");
    if (!home)
      return;
!   g_snprintf(s, sizeof(s), "%s/.gnome/gtkrc", home);
    edit_file_to_use(s, theme);
  }
  
--- 77,83 ----
    home = getenv("HOME");
    if (!home)
      return;
!   g_snprintf(s, sizeof(s), "%s/.gtkrc", home);
    edit_file_to_use(s, theme);
  }
  
./gnome-libs/libgnomeui/gnome-init.c:/* automagically parse all the gtkrc files for us.
./gnome-libs/libgnomeui/gnome-init.c: * $gnomedatadir/gtkrc
./gnome-libs/libgnomeui/gnome-init.c: * ~/.gnome/gtkrc
./gnome-libs/libgnomeui/gnome-init.c:	/* <gnomedatadir>/gtkrc */
./gnome-libs/libgnomeui/gnome-init.c:	file = gnome_datadir_file("gtkrc");
./gnome-libs/libgnomeui/gnome-init.c:	/* ~/.gnome/gtkrc */
./gnome-libs/libgnomeui/gnome-init.c:	file = gnome_util_home_file("gtkrc");
./gtk+/gtk/gtk.h:#include <gtk/gtkrc.h>
./gtk+/gtk/gtkbindings.c:#include "gtkrc.h"
./gtk+/gtk/gtkmain.c:#include "gtkrc.h"
./gtk+/gtk/gtkrc.c:#include "gtkrc.h"
./gtk+/gtk/gtkrc.c:      str = g_malloc (strlen(GTK_SYSCONFDIR) + strlen("/gtk/gtkrc") + 1);
./gtk+/gtk/gtkrc.c:      sprintf (str, "%s%s", GTK_SYSCONFDIR, "/gtk/gtkrc");
./gtk+/gtk/gtkrc.c:      str = g_malloc (strlen(var) + strlen("/.gtkrc") + 1);
./gtk+/gtk/gtkrc.c:      sprintf (str, "%s%s", var, "/.gtkrc");
./gtk+/gtk/gtkrc.h:/* Tell gtkrc to use a custom routine to load images specified in rc files instead of
./gtk+/gtk/gtkstyle.c:#include "gtkrc.h"
./gtk+/gtk/gtkthemes.c:#include "gtkrc.h"
./gtk+/gtk/gtkwidget.c:#include "gtkrc.h"
./gtk+/gtk/gtkwindow.c:#include "gtkrc.h"
./gtk+/gtk/testgtk.c:  gtk_rc_add_default_file ("testgtkrc");
./control-center/capplets/theme-switcher/da.h:extern gchar      gtkrc_tmp[1024];
./control-center/capplets/theme-switcher/demo.c:  gtk_rc_parse(gtkrc_tmp);  
./control-center/capplets/theme-switcher/globals.c:gchar      gtkrc_tmp[1024];
./control-center/capplets/theme-switcher/lister.c:  g_snprintf(tmp, sizeof(tmp), "/tmp/gtkrc_%i", rand());
./control-center/capplets/theme-switcher/lister.c:  g_snprintf(s, sizeof(s), "%s/.gnome/gtkrc", home);
./control-center/capplets/theme-switcher/lister.c:  g_snprintf(gtkrc_tmp, sizeof(gtkrc_tmp), "/tmp/%i-gtkrc-%i", time(NULL), rand());
./control-center/capplets/theme-switcher/lister.c:  cp(s, gtkrc_tmp);
./control-center/capplets/theme-switcher/lister.c:  g_snprintf(s, sizeof(s), "%s/.gnome/gtkrc", home);
./control-center/capplets/theme-switcher/lister.c:  edit_file_to_use(gtkrc_tmp, theme);
./control-center/capplets/theme-switcher/lister.c:      g_snprintf(tmp, sizeof(tmp), "%s/%s/gtk/gtkrc", dir, dir_listing[i]);
./gtk-engines/metal/metal_theme.h:#include <gtk/gtkrc.h>
./gnome-core/gemvt/gvtmain.c:  /* parse ~/.gtkrc, (this file also ommitted by the gnome_init stuff
./gnome-core/gemvt/gvtmain.c:  string = "gtkrc";
./gnome-admin/gxsnmp/app/main.c:  gtk_rc_parse ("./gxsnmpgtkrc");
./gtk--/src/gtk--/rc.h:#include <gtk/gtkrc.h>
./gtkicq/src/gtkicq.c:	gtk_rc_parse ( ".gtkrc" );

PGP signature



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