From 1c9b8649742f1842135a14694e51cba83e354074 Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Sat, 2 Feb 2002 04:34:09 +0000 Subject: [PATCH] Parse the RC string here when the first object is created rather than in Fri Feb 1 23:25:33 2002 Owen Taylor * gtk/gtktooltips.c (gtk_tooltips_init): Parse the RC string here when the first object is created rather than in the class_init to not break doc building. (#70341, Havoc Pennington.) * gtk/gtkrc.c (parse_include_file): Use the directories for the currently parsed files as the starting point to look for include files. (#59975) --- ChangeLog | 11 ++++++++++ ChangeLog.pre-2-0 | 11 ++++++++++ ChangeLog.pre-2-10 | 11 ++++++++++ ChangeLog.pre-2-2 | 11 ++++++++++ ChangeLog.pre-2-4 | 11 ++++++++++ ChangeLog.pre-2-6 | 11 ++++++++++ ChangeLog.pre-2-8 | 11 ++++++++++ configure.in | 2 +- gtk/gtkrc.c | 54 +++++++++++++++++++++++++++++++++++++++++++++- gtk/gtktooltips.c | 20 +++++++++++------ 10 files changed, 144 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index d82f07578f..00d7ddd457 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +Fri Feb 1 23:25:33 2002 Owen Taylor + + * gtk/gtktooltips.c (gtk_tooltips_init): Parse the + RC string here when the first object is created + rather than in the class_init to not break doc + building. (#70341, Havoc Pennington.) + + * gtk/gtkrc.c (parse_include_file): Use the directories + for the currently parsed files as the starting point + to look for include files. (#59975) + Fri Feb 1 20:21:56 2002 Manish Singh * gtk/gtkinputdialog.c: use gtk_label_new_with_mnemonic for labels diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index d82f07578f..00d7ddd457 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,14 @@ +Fri Feb 1 23:25:33 2002 Owen Taylor + + * gtk/gtktooltips.c (gtk_tooltips_init): Parse the + RC string here when the first object is created + rather than in the class_init to not break doc + building. (#70341, Havoc Pennington.) + + * gtk/gtkrc.c (parse_include_file): Use the directories + for the currently parsed files as the starting point + to look for include files. (#59975) + Fri Feb 1 20:21:56 2002 Manish Singh * gtk/gtkinputdialog.c: use gtk_label_new_with_mnemonic for labels diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index d82f07578f..00d7ddd457 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,14 @@ +Fri Feb 1 23:25:33 2002 Owen Taylor + + * gtk/gtktooltips.c (gtk_tooltips_init): Parse the + RC string here when the first object is created + rather than in the class_init to not break doc + building. (#70341, Havoc Pennington.) + + * gtk/gtkrc.c (parse_include_file): Use the directories + for the currently parsed files as the starting point + to look for include files. (#59975) + Fri Feb 1 20:21:56 2002 Manish Singh * gtk/gtkinputdialog.c: use gtk_label_new_with_mnemonic for labels diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index d82f07578f..00d7ddd457 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,14 @@ +Fri Feb 1 23:25:33 2002 Owen Taylor + + * gtk/gtktooltips.c (gtk_tooltips_init): Parse the + RC string here when the first object is created + rather than in the class_init to not break doc + building. (#70341, Havoc Pennington.) + + * gtk/gtkrc.c (parse_include_file): Use the directories + for the currently parsed files as the starting point + to look for include files. (#59975) + Fri Feb 1 20:21:56 2002 Manish Singh * gtk/gtkinputdialog.c: use gtk_label_new_with_mnemonic for labels diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index d82f07578f..00d7ddd457 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,14 @@ +Fri Feb 1 23:25:33 2002 Owen Taylor + + * gtk/gtktooltips.c (gtk_tooltips_init): Parse the + RC string here when the first object is created + rather than in the class_init to not break doc + building. (#70341, Havoc Pennington.) + + * gtk/gtkrc.c (parse_include_file): Use the directories + for the currently parsed files as the starting point + to look for include files. (#59975) + Fri Feb 1 20:21:56 2002 Manish Singh * gtk/gtkinputdialog.c: use gtk_label_new_with_mnemonic for labels diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index d82f07578f..00d7ddd457 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,14 @@ +Fri Feb 1 23:25:33 2002 Owen Taylor + + * gtk/gtktooltips.c (gtk_tooltips_init): Parse the + RC string here when the first object is created + rather than in the class_init to not break doc + building. (#70341, Havoc Pennington.) + + * gtk/gtkrc.c (parse_include_file): Use the directories + for the currently parsed files as the starting point + to look for include files. (#59975) + Fri Feb 1 20:21:56 2002 Manish Singh * gtk/gtkinputdialog.c: use gtk_label_new_with_mnemonic for labels diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index d82f07578f..00d7ddd457 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,14 @@ +Fri Feb 1 23:25:33 2002 Owen Taylor + + * gtk/gtktooltips.c (gtk_tooltips_init): Parse the + RC string here when the first object is created + rather than in the class_init to not break doc + building. (#70341, Havoc Pennington.) + + * gtk/gtkrc.c (parse_include_file): Use the directories + for the currently parsed files as the starting point + to look for include files. (#59975) + Fri Feb 1 20:21:56 2002 Manish Singh * gtk/gtkinputdialog.c: use gtk_label_new_with_mnemonic for labels diff --git a/configure.in b/configure.in index c3a0f9aeef..7295a1c7ee 100644 --- a/configure.in +++ b/configure.in @@ -1296,7 +1296,7 @@ fi ]) AC_PATH_PROG(SGML2HTML, sgml2html, no) -AM_CONDITIONAL(HAVE_SGML2HTML, ! test x$SGML2HTML = xno) +AM_CONDITIONAL(HAVE_SGML2HTML, test x$SGML2HTML != xno) AC_OUTPUT([ config.h.win32 diff --git a/gtk/gtkrc.c b/gtk/gtkrc.c index 3958add6e2..9b9e75a9c0 100644 --- a/gtk/gtkrc.c +++ b/gtk/gtkrc.c @@ -2201,6 +2201,58 @@ is_c_identifier (const gchar *string) return is_varname; } +static void +parse_include_file (GtkRcContext *context, + GScanner *scanner, + const gchar *filename) +{ + char *to_parse = NULL; + + if (g_path_is_absolute (filename)) + { + /* For abolute paths, we call gtk_rc_parse_file unconditionally. We + * don't print an error in this case. + */ + to_parse = g_strdup (filename); + } + else + { + /* if a relative path, we look relative to all the RC files in the + * include stack. We require the file to be found in this case + * so we can give meaningful error messages, and because on reparsing + * non-absolute paths don't make sense. + */ + GSList *tmp_list = rc_dir_stack; + while (tmp_list) + { + gchar *tmpname = g_build_filename (tmp_list->data, filename, NULL); + + if (g_file_test (tmpname, G_FILE_TEST_EXISTS)) + { + to_parse = tmpname; + break; + } + + g_free (tmpname); + + tmp_list = tmp_list->next; + } + } + + if (to_parse) + { + gtk_rc_parse_file (context, to_parse, context->default_priority, FALSE); + g_free (to_parse); + } + else + { + g_scanner_warn (scanner, + _("Unable to find include file: \"%s\""), + filename); + } + +} + static guint gtk_rc_parse_statement (GtkRcContext *context, GScanner *scanner) @@ -2217,7 +2269,7 @@ gtk_rc_parse_statement (GtkRcContext *context, token = g_scanner_get_next_token (scanner); if (token != G_TOKEN_STRING) return G_TOKEN_STRING; - gtk_rc_parse_file (context, scanner->value.v_string, context->default_priority, FALSE); + parse_include_file (context, scanner, scanner->value.v_string); return G_TOKEN_NONE; case GTK_RC_TOKEN_STYLE: diff --git a/gtk/gtktooltips.c b/gtk/gtktooltips.c index 8b609a6ca8..6f035292cb 100644 --- a/gtk/gtktooltips.c +++ b/gtk/gtktooltips.c @@ -99,18 +99,24 @@ gtk_tooltips_class_init (GtkTooltipsClass *class) parent_class = gtk_type_class (GTK_TYPE_OBJECT); object_class->destroy = gtk_tooltips_destroy; - - gtk_rc_parse_string ("style \"gtk-default-tooltips-style\" {\n" - " bg[NORMAL] = \"#ffffc0\"\n" - " fg[NORMAL] = \"#000000\"\n" - "}\n" - "\n" - "widget \"gtk-tooltips*\" style : gtk \"gtk-default-tooltips-style\"\n"); } static void gtk_tooltips_init (GtkTooltips *tooltips) { + static gboolean have_rc = FALSE; + if (have_rc) + { + have_rc = TRUE; + + gtk_rc_parse_string ("style \"gtk-default-tooltips-style\" {\n" + " bg[NORMAL] = \"#ffffc0\"\n" + " fg[NORMAL] = \"#000000\"\n" + "}\n" + "\n" + "widget \"gtk-tooltips*\" style : gtk \"gtk-default-tooltips-style\"\n"); + } + tooltips->tip_window = NULL; tooltips->active_tips_data = NULL; tooltips->tips_data_list = NULL;