summaryrefslogtreecommitdiff
path: root/gtk/gtkrc.c
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2002-02-02 16:37:23 +0000
committerOwen Taylor <otaylor@src.gnome.org>2002-02-02 16:37:23 +0000
commita9981124723ee141f52f0fbb3272d4aabb811a6d (patch)
treed94381542df0d4e4c9a94c307c25602b97482a69 /gtk/gtkrc.c
parent69f27e17929ad9ccbf0887846081b5351d676ad2 (diff)
downloadgtk+-a9981124723ee141f52f0fbb3272d4aabb811a6d.tar.gz
Support engine "" {} to mean override to the default engine. (#70205)
Fri Feb 1 23:54:00 2002 Owen Taylor <otaylor@redhat.com> * gtk/gtkrc.[ch] (gtk_rc_parse_engine): Support engine "" {} to mean override to the default engine. (#70205)
Diffstat (limited to 'gtk/gtkrc.c')
-rw-r--r--gtk/gtkrc.c82
1 files changed, 57 insertions, 25 deletions
diff --git a/gtk/gtkrc.c b/gtk/gtkrc.c
index 9b9e75a9c0..6738950620 100644
--- a/gtk/gtkrc.c
+++ b/gtk/gtkrc.c
@@ -1940,9 +1940,10 @@ gtk_rc_init_style (GSList *rc_styles)
GSList *tmp_styles;
GType rc_style_type = GTK_TYPE_RC_STYLE;
- /* Find the first derived style in the list, and use that to
- * create the merged style. If we only have raw GtkRcStyles, use
- * the first style to create the merged style.
+ /* Find the the first style where the RC file specified engine "" {}
+ * or the first derived style and use that to create the
+ * merged style. If we only have raw GtkRcStyles, use the first
+ * style to create the merged style.
*/
base_style = rc_styles->data;
tmp_styles = rc_styles;
@@ -1950,7 +1951,8 @@ gtk_rc_init_style (GSList *rc_styles)
{
GtkRcStyle *rc_style = tmp_styles->data;
- if (G_OBJECT_TYPE (rc_style) != rc_style_type)
+ if (rc_style->engine_specified ||
+ G_OBJECT_TYPE (rc_style) != rc_style_type)
{
base_style = rc_style;
break;
@@ -3013,34 +3015,62 @@ gtk_rc_parse_engine (GtkRcContext *context,
if (token != G_TOKEN_STRING)
return G_TOKEN_STRING;
- engine = gtk_theme_engine_get (scanner->value.v_string);
-
- token = g_scanner_get_next_token (scanner);
- if (token != G_TOKEN_LEFT_CURLY)
- return G_TOKEN_LEFT_CURLY;
-
- if (engine)
+ if (!scanner->value.v_string[0])
{
- GtkRcStyleClass *new_class;
+ /* Support engine "" {} to mean override to the default engine
+ */
+ token = g_scanner_get_next_token (scanner);
+ if (token != G_TOKEN_LEFT_CURLY)
+ return G_TOKEN_LEFT_CURLY;
- new_style = gtk_theme_engine_create_rc_style (engine);
- g_type_module_unuse (G_TYPE_MODULE (engine));
+ token = g_scanner_get_next_token (scanner);
+ if (token != G_TOKEN_RIGHT_CURLY)
+ return G_TOKEN_RIGHT_CURLY;
- new_class = GTK_RC_STYLE_GET_CLASS (new_style);
+ parsed_curlies = TRUE;
- new_class->merge (new_style, *rc_style);
- if ((*rc_style)->name)
- new_style->name = g_strdup ((*rc_style)->name);
+ if (G_OBJECT_TYPE (*rc_style) != GTK_TYPE_RC_STYLE)
+ {
+ new_style = gtk_rc_style_new ();
+ gtk_rc_style_real_merge (new_style, *rc_style);
+
+ if ((*rc_style)->name)
+ new_style->name = g_strdup ((*rc_style)->name);
+ }
+ else
+ (*rc_style)->engine_specified = TRUE;
+ }
+ else
+ {
+ engine = gtk_theme_engine_get (scanner->value.v_string);
- if (new_class->parse)
+ token = g_scanner_get_next_token (scanner);
+ if (token != G_TOKEN_LEFT_CURLY)
+ return G_TOKEN_LEFT_CURLY;
+
+ if (engine)
{
- parsed_curlies = TRUE;
- result = new_class->parse (new_style, context->settings, scanner);
-
- if (result != G_TOKEN_NONE)
+ GtkRcStyleClass *new_class;
+
+ new_style = gtk_theme_engine_create_rc_style (engine);
+ g_type_module_unuse (G_TYPE_MODULE (engine));
+
+ new_class = GTK_RC_STYLE_GET_CLASS (new_style);
+
+ new_class->merge (new_style, *rc_style);
+ if ((*rc_style)->name)
+ new_style->name = g_strdup ((*rc_style)->name);
+
+ if (new_class->parse)
{
- g_object_unref (G_OBJECT (new_style));
- new_style = NULL;
+ parsed_curlies = TRUE;
+ result = new_class->parse (new_style, context->settings, scanner);
+
+ if (result != G_TOKEN_NONE)
+ {
+ g_object_unref (G_OBJECT (new_style));
+ new_style = NULL;
+ }
}
}
}
@@ -3069,6 +3099,8 @@ gtk_rc_parse_engine (GtkRcContext *context,
if (new_style)
{
+ new_style->engine_specified = TRUE;
+
g_object_unref (G_OBJECT (*rc_style));
*rc_style = new_style;
}