allow the inclusion of other rc-files.

Tue Apr 28 15:46:41 1998  Tim Janik  <timj@gtk.org>

        * gtk/gtkrc.c (gtk_rc_parse_statement): allow the inclusion of other
                rc-files.
This commit is contained in:
Tim Janik
1998-04-28 13:49:05 +00:00
committed by Tim Janik
parent 2f6ee99191
commit 2bec3fad18
13 changed files with 144 additions and 34 deletions

View File

@@ -1,3 +1,8 @@
Tue Apr 28 15:46:41 1998 Tim Janik <timj@gtk.org>
* gtk/gtkrc.c (gtk_rc_parse_statement): allow the inclusion of other
rc-files.
Mon Apr 27 15:11:52 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_grab_focus): only allow grabbing of focus

View File

@@ -1,3 +1,8 @@
Tue Apr 28 15:46:41 1998 Tim Janik <timj@gtk.org>
* gtk/gtkrc.c (gtk_rc_parse_statement): allow the inclusion of other
rc-files.
Mon Apr 27 15:11:52 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_grab_focus): only allow grabbing of focus

View File

@@ -1,3 +1,8 @@
Tue Apr 28 15:46:41 1998 Tim Janik <timj@gtk.org>
* gtk/gtkrc.c (gtk_rc_parse_statement): allow the inclusion of other
rc-files.
Mon Apr 27 15:11:52 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_grab_focus): only allow grabbing of focus

View File

@@ -1,3 +1,8 @@
Tue Apr 28 15:46:41 1998 Tim Janik <timj@gtk.org>
* gtk/gtkrc.c (gtk_rc_parse_statement): allow the inclusion of other
rc-files.
Mon Apr 27 15:11:52 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_grab_focus): only allow grabbing of focus

View File

@@ -1,3 +1,8 @@
Tue Apr 28 15:46:41 1998 Tim Janik <timj@gtk.org>
* gtk/gtkrc.c (gtk_rc_parse_statement): allow the inclusion of other
rc-files.
Mon Apr 27 15:11:52 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_grab_focus): only allow grabbing of focus

View File

@@ -1,3 +1,8 @@
Tue Apr 28 15:46:41 1998 Tim Janik <timj@gtk.org>
* gtk/gtkrc.c (gtk_rc_parse_statement): allow the inclusion of other
rc-files.
Mon Apr 27 15:11:52 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_grab_focus): only allow grabbing of focus

View File

@@ -1,3 +1,8 @@
Tue Apr 28 15:46:41 1998 Tim Janik <timj@gtk.org>
* gtk/gtkrc.c (gtk_rc_parse_statement): allow the inclusion of other
rc-files.
Mon Apr 27 15:11:52 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.c (gtk_widget_grab_focus): only allow grabbing of focus

View File

@@ -203,6 +203,7 @@ EXTRA_DIST = \
line-arrow.xbm \
line-wrap.xbm \
testgtkrc \
testgtkrc2 \
gtk.defs \
runelisp \
gentypeinfo.el \

View File

@@ -26,6 +26,7 @@
enum {
TOKEN_INVALID = G_TOKEN_LAST,
TOKEN_INCLUDE,
TOKEN_ACTIVE,
TOKEN_BASE,
TOKEN_BG,
@@ -47,7 +48,8 @@ enum {
enum {
PARSE_OK,
PARSE_ERROR,
PARSE_SYNTAX
PARSE_SYNTAX,
PARSE_DONE
};
enum {
@@ -175,30 +177,28 @@ static GScannerConfig gtk_rc_scanner_config =
static struct
{
char *name;
int token;
} symbols[] =
{
{ "ACTIVE", TOKEN_ACTIVE },
{ "base", TOKEN_BASE },
{ "bg", TOKEN_BG },
{ "bg_pixmap", TOKEN_BG_PIXMAP },
{ "fg", TOKEN_FG },
{ "font", TOKEN_FONT },
{ "fontset", TOKEN_FONTSET },
{ "INSENSITIVE", TOKEN_INSENSITIVE },
{ "NORMAL", TOKEN_NORMAL },
{ "pixmap_path", TOKEN_PIXMAP_PATH },
{ "PRELIGHT", TOKEN_PRELIGHT },
{ "SELECTED", TOKEN_SELECTED },
{ "style", TOKEN_STYLE },
{ "text", TOKEN_TEXT },
{ "widget", TOKEN_WIDGET },
{ "widget_class", TOKEN_WIDGET_CLASS },
};
static int nsymbols = sizeof (symbols) / sizeof (symbols[0]);
static int done;
gchar *name;
gint token;
} symbols[] = {
{ "include", TOKEN_INCLUDE },
{ "ACTIVE", TOKEN_ACTIVE },
{ "base", TOKEN_BASE },
{ "bg", TOKEN_BG },
{ "bg_pixmap", TOKEN_BG_PIXMAP },
{ "fg", TOKEN_FG },
{ "font", TOKEN_FONT },
{ "fontset", TOKEN_FONTSET },
{ "INSENSITIVE", TOKEN_INSENSITIVE },
{ "NORMAL", TOKEN_NORMAL },
{ "pixmap_path", TOKEN_PIXMAP_PATH },
{ "PRELIGHT", TOKEN_PRELIGHT },
{ "SELECTED", TOKEN_SELECTED },
{ "style", TOKEN_STYLE },
{ "text", TOKEN_TEXT },
{ "widget", TOKEN_WIDGET },
{ "widget_class", TOKEN_WIDGET_CLASS },
};
static guint nsymbols = sizeof (symbols) / sizeof (symbols[0]);
static GHashTable *rc_style_ht = NULL;
static GSList *widget_sets = NULL;
@@ -341,6 +341,7 @@ gtk_rc_parse_any (const gchar *input_name,
{
GScanner *scanner;
guint i;
gboolean done;
scanner = g_scanner_new (&gtk_rc_scanner_config);
@@ -363,8 +364,15 @@ gtk_rc_parse_any (const gchar *input_name,
done = FALSE;
while (!done)
{
if (gtk_rc_parse_statement (scanner) != PARSE_OK)
gint return_val;
return_val = gtk_rc_parse_statement (scanner);
switch (return_val)
{
case PARSE_OK:
break;
default:
if (scanner->next_token != G_TOKEN_NONE)
g_scanner_get_next_token (scanner);
@@ -375,8 +383,10 @@ gtk_rc_parse_any (const gchar *input_name,
g_warning ("rc file parse error: \"%s\" line %d",
input_name,
scanner->line);
/* fall through */
case PARSE_DONE:
done = TRUE;
break;
}
}
g_scanner_destroy (scanner);
@@ -569,8 +579,18 @@ gtk_rc_parse_statement (GScanner *scanner)
token = g_scanner_peek_next_token (scanner);
if (token == G_TOKEN_EOF)
return PARSE_DONE;
if (token == TOKEN_INCLUDE)
{
done = TRUE;
g_scanner_get_next_token (scanner);
token = g_scanner_get_next_token (scanner);
if (token != G_TOKEN_STRING)
return PARSE_ERROR;
gtk_rc_parse (scanner->value.v_string);
return PARSE_OK;
}

View File

@@ -1,5 +1,7 @@
# pixmap_path "<dir 1>:<dir 2>:<dir 3>:..."
#
# include "rc-file"
#
# style <name> [= <name>]
# {
# <option>
@@ -8,6 +10,9 @@
# widget <widget_set> style <style_name>
# widget_class <widget_class_set> style <style_name>
# testgtkrc2 introduces the green color in the button list
include "testgtkrc2"
pixmap_path "."
style "default"
@@ -33,10 +38,11 @@ style "button"
# bg[PRELIGHT] = { 0, 0, 0.75 }
}
style 'main_button' = 'button'
# we set want buttons in the main window to be blue by default
style 'main_buttons' = 'button'
{
font = "-adobe-helvetica-medium-r-normal--*-100-*-*-*-*-*-*"
bg[PRELIGHT] = { 0, 0.75, 0x00 }
bg[PRELIGHT] = { 0, 0, 0.75 }
}
style "toggle_button" = "button"
@@ -74,5 +80,5 @@ widget_class "*GtkButton*" style "button"
widget_class "*Ruler" style "ruler"
widget_class "*GtkText" style "text"
widget_class "*" style "default"
widget "main window.*GtkButton*" style "main_button"
widget "main window.*GtkButton*" style "main_buttons"
widget "*GtkCurve" style "curve"

21
gtk/testgtkrc2 Normal file
View File

@@ -0,0 +1,21 @@
# pixmap_path "<dir 1>:<dir 2>:<dir 3>:..."
#
# include "rc-file"
#
# style <name> [= <name>]
# {
# <option>
# }
#
# widget <widget_set> style <style_name>
# widget_class <widget_class_set> style <style_name>
# this file gets included from testgtkrc
style 'button_list' = 'button'
{
font = "-adobe-helvetica-medium-r-normal--*-100-*-*-*-*-*-*"
bg[PRELIGHT] = { 0, 0.75, 0x00 }
}
widget "main window.*GtkScrolledWindow.*GtkButton*" style "button_list"

View File

@@ -1,5 +1,7 @@
# pixmap_path "<dir 1>:<dir 2>:<dir 3>:..."
#
# include "rc-file"
#
# style <name> [= <name>]
# {
# <option>
@@ -8,6 +10,9 @@
# widget <widget_set> style <style_name>
# widget_class <widget_class_set> style <style_name>
# testgtkrc2 introduces the green color in the button list
include "testgtkrc2"
pixmap_path "."
style "default"
@@ -33,10 +38,11 @@ style "button"
# bg[PRELIGHT] = { 0, 0, 0.75 }
}
style 'main_button' = 'button'
# we set want buttons in the main window to be blue by default
style 'main_buttons' = 'button'
{
font = "-adobe-helvetica-medium-r-normal--*-100-*-*-*-*-*-*"
bg[PRELIGHT] = { 0, 0.75, 0x00 }
bg[PRELIGHT] = { 0, 0, 0.75 }
}
style "toggle_button" = "button"
@@ -74,5 +80,5 @@ widget_class "*GtkButton*" style "button"
widget_class "*Ruler" style "ruler"
widget_class "*GtkText" style "text"
widget_class "*" style "default"
widget "main window.*GtkButton*" style "main_button"
widget "main window.*GtkButton*" style "main_buttons"
widget "*GtkCurve" style "curve"

21
tests/testgtkrc2 Normal file
View File

@@ -0,0 +1,21 @@
# pixmap_path "<dir 1>:<dir 2>:<dir 3>:..."
#
# include "rc-file"
#
# style <name> [= <name>]
# {
# <option>
# }
#
# widget <widget_set> style <style_name>
# widget_class <widget_class_set> style <style_name>
# this file gets included from testgtkrc
style 'button_list' = 'button'
{
font = "-adobe-helvetica-medium-r-normal--*-100-*-*-*-*-*-*"
bg[PRELIGHT] = { 0, 0.75, 0x00 }
}
widget "main window.*GtkScrolledWindow.*GtkButton*" style "button_list"