[Gnucash-changes] Add some support for gtkrc files.

David Hampton hampton at cvs.gnucash.org
Sun Apr 3 19:23:44 EDT 2005


Log Message:
-----------
Add some support for gtkrc files.

Tags:
----
gnucash-gnome2-dev

Modified Files:
--------------
    gnucash:
        ChangeLog
    gnucash/src/gnome-utils:
        gnc-gnome-utils.c
        gnc-tree-view-account.c
        gnc-tree-view-commodity.c
        gnc-tree-view-price.c

Added Files:
-----------
    gnucash/doc:
        gtkrc-2.0.gnucash

Revision Data
-------------
Index: ChangeLog
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/ChangeLog,v
retrieving revision 1.1487.2.186
retrieving revision 1.1487.2.187
diff -LChangeLog -LChangeLog -u -r1.1487.2.186 -r1.1487.2.187
--- ChangeLog
+++ ChangeLog
@@ -1,3 +1,17 @@
+2005-04-03  David Hampton  <hampton at employees.org>
+
+	* src/gnome-utils/gnc-gnome-utils.c: Have gnucash read a private
+	RC file.  This makes it easy to apply styles to entire classes of
+	widgets in gnucsah without affecting any other application.
+
+	* src/gnome-utils/gnc-tree-view-account.c:
+	* src/gnome-utils/gnc-tree-view-commodity.c:
+	* src/gnome-utils/gnc-tree-view-price.c: Name a couple of new
+	widgets to make it easier to apply styles to them.
+
+	* doc/gtkrc-2.0.gnucash: Provide a sample RC file for gnucash.
+	This file needs work.
+
 2005-03-25  Neil Williams <linux at codehelp.co.uk>
 	* src/backend/qsf/qsf-backend.c: Support for
 	multiple references in the same entity.
--- /dev/null
+++ doc/gtkrc-2.0.gnucash
@@ -0,0 +1,125 @@
+#
+# This is an example GTK RC file that can be used with Gnucash.
+# Simply copy this file to ~/.gtkrc-2.0.gnucash and then restart
+# gnucash.  Yes the colors are hideous, but then this is a (bad)
+# example that you should customize to your liking.
+#
+# On an FC3 system, the RC files (if they exist) are loaded for in
+# this order:
+#
+#       /usr/share/gtkrc-2.0
+#       /etc/gtk-2.0/gtkrc
+#       ~/.gtkrc-2.0
+#  **   ~/.gtkrc-2.0.gnucash   **
+#       ~/.gnome2/gtkrc-2.0
+#       ~/.themes/Bluecurve/gtk-2.0/gtkrc
+#       /usr/share/themes/Bluecurve/gtk-2.0/gtkrc
+#       ~/.themes/Default/gtk-2.0-key/gtkrc
+#       /usr/share/themes/Default/gtk-2.0-key/gtkrc
+#
+
+##########
+#
+# Define the various styles here
+#
+##########
+
+style "gnc-button"
+{
+  # This shows all the possible states for a button.  The only one that
+  # doesn't apply is the SELECTED state.
+  
+  bg[NORMAL]   = "LightBlue"
+  fg[NORMAL]   = "IndianRed"
+
+  # Mouse over
+  bg[PRELIGHT] = "SkyBlue"
+  fg[PRELIGHT] = "white"
+
+  # Mouse down
+  bg[ACTIVE]   = "SteelBlue"
+  fg[ACTIVE]   = "white"
+
+  bg[INSENSITIVE] = { 1.0, 1.0, 1.0 }
+  fg[INSENSITIVE] = { 1.0, 0, 1.0 }
+}
+
+style "gnc-button2" = "gnc-button"
+{
+  bg[NORMAL]   = "PeachPuff"
+  fg[NORMAL]   = "firebrick"
+}
+
+style "gnc-button3" = "gnc-button"
+{
+  bg[NORMAL]   = "LightGoldenrod1"
+  fg[NORMAL]   = "firebrick"
+}
+
+
+
+style "gnc-entry"
+{
+  base[NORMAL]   = "LightBlue"
+  text[NORMAL]   = "firebrick"
+}
+
+style "gnc-entry2"
+{
+  base[NORMAL]   = "RoyalBlue"
+  text[NORMAL]   = "WhiteSmoke"
+}
+
+
+
+style "gnc-treeview"
+{
+	GtkTreeView::even-row-color = "IndianRed"
+	GtkTreeView::odd-row-color  = "LightBlue"
+}
+
+
+
+##########
+#
+# Program wide changes should go here.
+#
+##########
+class "GtkEntry" style "gnc-entry"
+class "GtkButton" style "gnc-button"
+
+
+##########
+#
+# Individual window changes should go here.
+#
+##########
+
+#
+# Price Selection Dialog
+#
+# widget "Prices Dialog.*.close_button" style "gnc-button"
+# widget "Prices Dialog.*.get_quotes_button" style "gnc-button2"
+# widget "Prices Dialog.*.edit_button" style "gnc-button2"
+# widget "Prices Dialog.*.add_button" style "gnc-button2"
+# widget "Prices Dialog.*.remove_button" style "gnc-button2"
+# widget "Prices Dialog.*.remove_old_button" style "gnc-button2"
+widget "Prices Dialog.*.price_tree" style "gnc-treeview"
+widget "Prices Dialog.*.price_tree.GtkButton" style "gnc-button3"
+
+#
+# Dialog to edit one price
+#
+# widget "Price Dialog.*.cancel_button" style "gnc-button2"
+# widget "Price Dialog.*.ok_button" style "gnc-button2"
+# widget "Price Dialog.*.GNCGeneralSelect" style "gnc-entry"
+# widget "Price Dialog.*.GNCCurrencyEdit" style "gnc-entry"
+# widget "Price Dialog.*.GNCDateEdit.GtkEntry" style "gnc-entry"
+# widget "Price Dialog.*.source_entry" style "gnc-entry"
+# widget "Price Dialog.*.type_option" style "foo"
+widget "Price Dialog.*.GNCAmountEdit" style "gnc-entry2"
+
+#
+# Commodity Dialog
+#
+widget "Commodities Dialog.*.commodity_tree" style "gnc-treeview"
Index: gnc-tree-view-commodity.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/gnome-utils/Attic/gnc-tree-view-commodity.c,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -Lsrc/gnome-utils/gnc-tree-view-commodity.c -Lsrc/gnome-utils/gnc-tree-view-commodity.c -u -r1.1.2.2 -r1.1.2.3
--- src/gnome-utils/gnc-tree-view-commodity.c
+++ src/gnome-utils/gnc-tree-view-commodity.c
@@ -475,7 +475,7 @@
 
   ENTER(" ");
   /* Create our view */
-  view = g_object_new (GNC_TYPE_TREE_VIEW_COMMODITY, NULL);
+  view = g_object_new (GNC_TYPE_TREE_VIEW_COMMODITY, "name", "commodity_tree", NULL);
   tree_view = GTK_TREE_VIEW (view);
 
   /* Create/get a pointer to the existing model for this set of books. */
Index: gnc-tree-view-price.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/gnome-utils/Attic/gnc-tree-view-price.c,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -Lsrc/gnome-utils/gnc-tree-view-price.c -Lsrc/gnome-utils/gnc-tree-view-price.c -u -r1.1.2.2 -r1.1.2.3
--- src/gnome-utils/gnc-tree-view-price.c
+++ src/gnome-utils/gnc-tree-view-price.c
@@ -414,7 +414,7 @@
 
   ENTER(" ");
   /* Create our view */
-  view = g_object_new (GNC_TYPE_TREE_VIEW_PRICE, NULL);
+  view = g_object_new (GNC_TYPE_TREE_VIEW_PRICE, "name", "price_tree", NULL);
   tree_view = GTK_TREE_VIEW (view);
 
   /* Create/get a pointer to the existing model for this set of books. */
Index: gnc-tree-view-account.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/gnome-utils/Attic/gnc-tree-view-account.c,v
retrieving revision 1.1.2.13
retrieving revision 1.1.2.14
diff -Lsrc/gnome-utils/gnc-tree-view-account.c -Lsrc/gnome-utils/gnc-tree-view-account.c -u -r1.1.2.13 -r1.1.2.14
--- src/gnome-utils/gnc-tree-view-account.c
+++ src/gnome-utils/gnc-tree-view-account.c
@@ -380,7 +380,7 @@
 
   ENTER(" ");
   /* Create our view */
-  account_view = g_object_new (GNC_TYPE_TREE_VIEW_ACCOUNT, NULL);
+  account_view = g_object_new (GNC_TYPE_TREE_VIEW_ACCOUNT, "name", "account_tree", NULL);
   tree_view = GTK_TREE_VIEW (account_view);
 
   /* Create/get a pointer to the existing model for this set of books. */
Index: gnc-gnome-utils.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/gnome-utils/gnc-gnome-utils.c,v
retrieving revision 1.2.4.6
retrieving revision 1.2.4.7
diff -Lsrc/gnome-utils/gnc-gnome-utils.c -Lsrc/gnome-utils/gnc-gnome-utils.c -u -r1.2.4.6 -r1.2.4.7
--- src/gnome-utils/gnc-gnome-utils.c
+++ src/gnome-utils/gnc-gnome-utils.c
@@ -103,6 +103,20 @@
   return fullname;
 }
 
+static void
+gnc_gtk_add_rc_file (void)
+{
+  const gchar *var;
+  gchar *str;
+
+  var = g_get_home_dir ();
+  if (var) {
+    str = g_build_filename (var, ".gtkrc-2.0.gnucash", NULL);
+    gtk_rc_add_default_file (str);
+    g_free (str);
+  }
+}
+
 SCM
 gnc_gnome_init (const char * arg0,
                 const char * progname,
@@ -131,6 +145,7 @@
 
   restargc = argv_length (restargv);
 
+  gnc_gtk_add_rc_file();
   gnucash_program =
     gnome_program_init("gnucash", version, LIBGNOMEUI_MODULE,
 		       restargc, restargv,


More information about the gnucash-changes mailing list