From 4278f80b4cd2937dac80a12c727e21be3aceae1f Mon Sep 17 00:00:00 2001 From: James Willcox Date: Fri, 21 Feb 2003 23:13:28 +0000 Subject: Make the start-here: page use the theme colors. 2003-02-21 James Willcox * data/starthere/section.xsl: * lib/ephy-start-here.c: (color_to_string), (build_content): Make the start-here: page use the theme colors. --- ChangeLog | 7 ++++++ data/starthere/section.css | 29 ----------------------- data/starthere/section.xsl | 40 +++++++++++++++++++++++++++++++- lib/ephy-start-here.c | 57 +++++++++++++++++++++++++++++++++++++++++++--- 4 files changed, 100 insertions(+), 33 deletions(-) delete mode 100644 data/starthere/section.css diff --git a/ChangeLog b/ChangeLog index 6544ec8c6..dd37d1c36 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2003-02-21 James Willcox + + * data/starthere/section.xsl: + * lib/ephy-start-here.c: (color_to_string), (build_content): + + Make the start-here: page use the theme colors. + 2003-02-21 Marco Pesenti Gritti * lib/widgets/ephy-editable-toolbar.c: diff --git a/data/starthere/section.css b/data/starthere/section.css deleted file mode 100644 index 6b0cf8608..000000000 --- a/data/starthere/section.css +++ /dev/null @@ -1,29 +0,0 @@ -body { - margin-left: 150; - margin-right: 150; - background: #000000; - color: #FFFFFF; - font-family: Verdana, Helvetica, Arial, sans-serif; - font-size: 14px; -} - -div.topbar { - height: 25px; - padding: 7px; - color: #000000; - background-color: #e57f20; - font-weight: bold; - margin-bottom: 50; -} - -div.topbar a { - margin-right: 15; - font-size: 20px; - font-weight: bold; - color: #000000; -} - -h2 { - color: #e57f20; - font-size: 18px; -} diff --git a/data/starthere/section.xsl b/data/starthere/section.xsl index d9d9091e2..b7c6377ee 100644 --- a/data/starthere/section.xsl +++ b/data/starthere/section.xsl @@ -10,7 +10,45 @@ - + diff --git a/lib/ephy-start-here.c b/lib/ephy-start-here.c index 06d08de38..3de8dffa3 100644 --- a/lib/ephy-start-here.c +++ b/lib/ephy-start-here.c @@ -16,6 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include #include #include #include @@ -303,15 +304,21 @@ attach_content (EphyStartHere *sh, xmlNodePtr node, xmlChar *id) } } +static char * +color_to_string (GdkColor color) +{ + return g_strdup_printf ("#%.2x%.2x%.2x", + color.red >> 8, + color.green >> 8, + color.blue >> 8); +} + static void build_content (EphyStartHere *sh, xmlNodePtr node) { while (node) { xmlChar *id; - xmlNodePtr next; - - next = node->next; id = xmlGetProp (node, "id"); if (id) @@ -320,6 +327,50 @@ build_content (EphyStartHere *sh, xmlNodePtr node) xmlFree (id); } + if (xmlStrEqual (node->name, "section")) + { + GtkWidget *widget, *window; + GdkColor color; + char *str; + + /* create a random widget that we will use to get + * the current style + */ + window = gtk_window_new (GTK_WINDOW_TOPLEVEL); + widget = gtk_label_new (""); + gtk_container_add (GTK_CONTAINER (window), widget); + gtk_widget_realize (window); + gtk_widget_realize (widget); + gtk_widget_ensure_style (widget); + + color = widget->style->bg[GTK_STATE_NORMAL]; + str = color_to_string (color); + xmlSetProp (node, "bg", str); + g_free (str); + + color = widget->style->text[GTK_STATE_SELECTED]; + str = color_to_string (color); + xmlSetProp (node, "title", str); + g_free (str); + + color = widget->style->bg[GTK_STATE_ACTIVE]; + str = color_to_string (color); + xmlSetProp (node, "title-bg", str); + g_free (str); + + color = widget->style->bg[GTK_STATE_SELECTED]; + str = color_to_string (color); + xmlSetProp (node, "link", str); + g_free (str); + + color = widget->style->text[GTK_STATE_NORMAL]; + str = color_to_string (color); + xmlSetProp (node, "text", str); + g_free (str); + + gtk_widget_destroy (window); + } + build_content (sh, node->children); node = node->next; } -- cgit v1.2.3