[Epiphany] start-here theming
- From: James Willcox <jwillcox cs indiana edu>
- To: epiphany mozdev org
- Subject: [Epiphany] start-here theming
- Date: 21 Feb 2003 02:42:25 -0500
Hi,
Here's a patch to make start-here: use the theme colors instead of fixed
values. This is what it looks like for me using LighthouseBlue:
http://www.cs.indiana.edu/~jwillcox/ephy-start-here.png
Probably could use some tweaking from someone who has an eye for that
kind of stuff...
Thanks,
James
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/epiphany/ChangeLog,v
retrieving revision 1.126
diff -u -r1.126 ChangeLog
--- ChangeLog 21 Feb 2003 00:02:03 -0000 1.126
+++ ChangeLog 21 Feb 2003 07:34:49 -0000
@@ -1,3 +1,10 @@
+2003-02-21 James Willcox <jwillcox@gnome.org>
+
+ * 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 <marco@it.gnome.org>
* lib/widgets/ephy-autocompletion-window.c:
Index: data/starthere/section.xsl
===================================================================
RCS file: /cvs/gnome/epiphany/data/starthere/section.xsl,v
retrieving revision 1.4
diff -u -r1.4 section.xsl
--- data/starthere/section.xsl 6 Feb 2003 01:55:47 -0000 1.4
+++ data/starthere/section.xsl 21 Feb 2003 07:34:49 -0000
@@ -10,7 +10,45 @@
<xsl:template match="section">
<html>
<head>
- <link rel="stylesheet" href="section.css" type="text/css"/>
+ <style type="text/css">
+ body {
+ margin-left: 150;
+ margin-right: 150;
+ background: <xsl:value-of select="@bg"/>;
+ color: <xsl:value-of select="@text"/>;
+ font-family: Verdana, Helvetica, Arial, sans-serif;
+ font-size: 14px;
+ }
+
+ div.topbar {
+ height: 25px;
+ padding: 7px;
+ color: <xsl:value-of select="@title"/>;
+ background-color: <xsl:value-of select="@title-bg"/>;
+ font-weight: bold;
+ margin-bottom: 50;
+ }
+
+ div.topbar a {
+ margin-right: 15;
+ font-size: 20px;
+ font-weight: bold;
+ color: <xsl:value-of select="@title"/>;
+ }
+
+ h2 {
+ color: <xsl:value-of select="@headings"/>;
+ font-size: 18px;
+ }
+
+ a {
+ color: <xsl:value-of select="@link"/>
+ }
+
+ a.visited {
+ color: <xsl:value-of select="@link"/>
+ }
+ </style>
</head>
<body>
<xsl:apply-templates/>
Index: lib/ephy-start-here.c
===================================================================
RCS file: /cvs/gnome/epiphany/lib/ephy-start-here.c,v
retrieving revision 1.5
diff -u -r1.5 ephy-start-here.c
--- lib/ephy-start-here.c 6 Feb 2003 01:55:48 -0000 1.5
+++ lib/ephy-start-here.c 21 Feb 2003 07:34:49 -0000
@@ -16,6 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+#include <gtk/gtk.h>
#include <libxml/tree.h>
#include <libgnome/gnome-i18n.h>
#include <string.h>
@@ -303,21 +304,71 @@
}
}
+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)
{
attach_content (sh, node, id);
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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]