(large) patch for GnomeDruid, and API change comments



hello,

this patch fixes a number of problems with GnomeDruid in gnome 2.0.  i
plan on comitting it tomorrow if nobody complains, as it makes
GnomeDruid actually work.

fixes:

    GnomeDruidPageStandard infinitely loops
    
    GnomeDruidPageEdge, GnomeDruid, and GnomeDruidPageStandard don't
    layout reversed when in a RTL locale
    
    GnomeDruidPageEdge doesn't use the same default colors as
    GnomeDruidPageStandard
    
    GnomeDruid doesn't use the new button layout style
    
    GnomeDruidPageStandard leaks memory when getting properties

outstanding issues:

    setting the logo_background has no effect, as GtkImage is a nowindow
    widget.  this can be fixed by adding an event box around the image,
    but i never found this feature to be attractive.  so i am pushing
    for deprecating this part of the api.
    
    GnomeDruidPageStandard and GnomeDruidPageEdge both hold references
    on pixbufs and dup strings that they don't have to.  however, they
    are in public places in the headers.  i would like to deprecate this
    so we can remove it later.
    
    GnomeDruidPageStandard has GObject properties but GnomeDruidPageEdge
    does not.  For consistencies sake i'd like to add these.
    
    since GnomeDruidPageEdge no longer uses the canvas, the antialiased
    argument in gnome_druid_page_edge_construct() is useless, as is
    gnome_druid_page_ege_new_aa().  i'd like to remove these.
    
    GnomeDruid could use some style properties in the same light as
    GtkDialog for the button box layout.

note that for the api changes, due to the first bug above, nobody has
been able to use GnomeDruid (or has attempted, since nobody's complained
about it either) so even at this late stage it won't do any damage.

comments appreciated.

jacob
-- 
"In fact, can you imagine anything more terrifying than a zombie clown?"
	-- moby
Index: gnome-druid.c
===================================================================
RCS file: /cvs/gnome/libgnomeui/libgnomeui/gnome-druid.c,v
retrieving revision 1.43
diff -u -r1.43 gnome-druid.c
--- gnome-druid.c	2001/11/13 01:09:28	1.43
+++ gnome-druid.c	2002/01/10 20:25:19
@@ -36,6 +36,8 @@
 	GnomeDruidPage *current;
 	GList *children;
 
+	GtkWidget *bbox;
+
 	gboolean show_finish : 1; /* if TRUE, then we are showing the finish button instead of the next button */
 	gboolean show_help : 1;
 };
@@ -178,17 +180,36 @@
 	GTK_WIDGET_SET_FLAGS (druid->finish, GTK_CAN_DEFAULT);
 	druid->help = gtk_button_new_from_stock (GTK_STOCK_HELP);
 	GTK_WIDGET_SET_FLAGS (druid->help, GTK_CAN_DEFAULT);
-	gtk_widget_set_parent (druid->back, GTK_WIDGET (druid));
-	gtk_widget_set_parent (druid->next, GTK_WIDGET (druid));
-	gtk_widget_set_parent (druid->cancel, GTK_WIDGET (druid));
-	gtk_widget_set_parent (druid->finish, GTK_WIDGET (druid));
-	gtk_widget_set_parent (druid->help, GTK_WIDGET (druid));
 	gtk_widget_show (druid->back);
 	gtk_widget_show (druid->next);
 	gtk_widget_show (druid->cancel);
-	gtk_widget_show (druid->finish);
-	gtk_widget_show (druid->help);
 
+	druid->_priv->bbox = gtk_hbutton_box_new ();
+	gtk_button_box_set_layout (GTK_BUTTON_BOX (druid->_priv->bbox),
+				   GTK_BUTTONBOX_END);
+	/* FIXME: use a style property for these */
+	gtk_box_set_spacing (GTK_BOX (druid->_priv->bbox), 10);
+	gtk_container_set_border_width (GTK_CONTAINER (druid->_priv->bbox), 5);
+	gtk_widget_set_parent (druid->_priv->bbox, GTK_WIDGET (druid));
+	gtk_widget_show (druid->_priv->bbox);
+
+	gtk_box_pack_end (GTK_BOX (druid->_priv->bbox), druid->help,
+			  FALSE, TRUE, 0);
+	gtk_button_box_set_child_secondary (GTK_BUTTON_BOX (druid->_priv->bbox),
+					    druid->help, TRUE);
+
+	gtk_box_pack_end (GTK_BOX (druid->_priv->bbox), druid->cancel,
+			  FALSE, TRUE, 0);
+
+	gtk_box_pack_end (GTK_BOX (druid->_priv->bbox), druid->back,
+			  FALSE, TRUE, 0);
+
+	gtk_box_pack_end (GTK_BOX (druid->_priv->bbox), druid->next,
+			  FALSE, TRUE, 0);
+
+	gtk_box_pack_end (GTK_BOX (druid->_priv->bbox), druid->finish,
+			  FALSE, TRUE, 0);
+
 	/* other flags */
 	druid->_priv->current = NULL;
 	druid->_priv->children = NULL;
@@ -231,24 +252,13 @@
 
 	druid = GNOME_DRUID (object);
 
-	if(druid->back) {
-		gtk_widget_destroy (druid->back);
+	if(druid->_priv->bbox) {
+		gtk_widget_destroy (druid->_priv->bbox);
+		druid->_priv->bbox = NULL;
 		druid->back = NULL;
-	}
-	if(druid->next) {
-		gtk_widget_destroy (druid->next);
 		druid->next = NULL;
-	}
-	if(druid->cancel) {
-		gtk_widget_destroy (druid->cancel);
 		druid->cancel = NULL;
-	}
-	if(druid->finish) {
-		gtk_widget_destroy (druid->finish);
 		druid->finish = NULL;
-	}
-	if(druid->help) {
-		gtk_widget_destroy (druid->help);
 		druid->help = NULL;
 	}
 
@@ -352,6 +362,7 @@
         requisition->width = temp_width + 2 * border;
         requisition->height = temp_height + 2 * border;
 
+#if 0
 	/* In an Attempt to show how the widgets are packed,
 	 * here's a little diagram.
 	 * 
@@ -389,10 +400,13 @@
 	temp_height += GNOME_PAD_SMALL;
 
 	temp_width = temp_width * 21/4  + GNOME_PAD_SMALL * 3;
+#endif
+
+	gtk_widget_size_request (druid->_priv->bbox, &child_requisition);
 
 	/* pick which is bigger, the buttons, or the GnomeDruidPages */
-	requisition->width = MAX (temp_width, requisition->width);
-	requisition->height += temp_height + GNOME_PAD_SMALL * 2;
+	requisition->width = MAX (child_requisition.width, requisition->width);
+	requisition->height += child_requisition.height + GNOME_PAD_SMALL * 2;
 }
 
 static void
@@ -413,6 +427,7 @@
 
 	border = GTK_CONTAINER(widget)->border_width;
 
+#if 0
 	/* deal with the buttons */
 	child_allocation.width = child_allocation.height = 0;
 	child_allocation.width = druid->back->requisition.width;
@@ -443,6 +458,13 @@
 	gtk_widget_size_allocate (druid->back, &child_allocation);
 	child_allocation.x = allocation->x + border;
 	gtk_widget_size_allocate (druid->help, &child_allocation);
+#endif
+	button_height = druid->_priv->bbox->requisition.height;
+	child_allocation.x = allocation->x;
+	child_allocation.y = allocation->y + allocation->height - button_height;
+	child_allocation.height = button_height;
+	child_allocation.width = allocation->width;
+	gtk_widget_size_allocate (druid->_priv->bbox, &child_allocation);
 	
 	/* Put up the GnomeDruidPage */
 	child_allocation.x = allocation->x + border;
@@ -478,6 +500,7 @@
 	druid = GNOME_DRUID (widget);
 	GTK_WIDGET_SET_FLAGS (druid, GTK_MAPPED);
 
+#if 0
 	gtk_widget_map (druid->back);
 	if (druid->_priv->show_finish)
 		gtk_widget_map (druid->finish);
@@ -486,6 +509,8 @@
 	if (druid->_priv->show_help)
 		gtk_widget_map (druid->help);
 	gtk_widget_map (druid->cancel);
+#endif
+	gtk_widget_map (druid->_priv->bbox);
 	if (druid->_priv->current &&
 	    GTK_WIDGET_VISIBLE (druid->_priv->current) &&
 	    !GTK_WIDGET_MAPPED (druid->_priv->current)) {
@@ -503,7 +528,7 @@
 
 	druid = GNOME_DRUID (widget);
 	GTK_WIDGET_UNSET_FLAGS (druid, GTK_MAPPED);
-
+#if 0
 	gtk_widget_unmap (druid->back);
 	if (druid->_priv->show_finish)
 		gtk_widget_unmap (druid->finish);
@@ -512,6 +537,8 @@
 	gtk_widget_unmap (druid->cancel);	
 	if (druid->_priv->show_help)
 		gtk_widget_unmap (druid->help);
+#endif
+	gtk_widget_unmap (druid->_priv->bbox);
 	if (druid->_priv->current &&
 	    GTK_WIDGET_VISIBLE (druid->_priv->current) &&
 	    GTK_WIDGET_MAPPED (druid->_priv->current))
@@ -579,11 +606,15 @@
 		(* callback) (GTK_WIDGET (child), callback_data);
 	}
 	if (include_internals) {
+		/* FIXME: should this be gtk_contianer_forall() ? */
+		(* callback) (druid->_priv->bbox, callback_data);
+#if 0
 		(* callback) (druid->back, callback_data);
 		(* callback) (druid->next, callback_data);
 		(* callback) (druid->cancel, callback_data);
 		(* callback) (druid->finish, callback_data);
 		(* callback) (druid->help, callback_data);
+#endif
 	}
 }
 
@@ -611,6 +642,9 @@
 							child, event);
 		}
 		gtk_container_propagate_expose (GTK_CONTAINER (widget),
+						druid->_priv->bbox, event);
+#if 0
+		gtk_container_propagate_expose (GTK_CONTAINER (widget),
 						druid->back, event);
 		gtk_container_propagate_expose (GTK_CONTAINER (widget),
 						druid->next, event);
@@ -620,6 +654,7 @@
 						druid->finish, event);
 		gtk_container_propagate_expose (GTK_CONTAINER (widget),
 						druid->help, event);
+#endif
 	}
 	return FALSE;
 }
@@ -872,19 +907,11 @@
 		return;
 
 	if (show_finish) {
-		undefault_button (druid->next);
-
-		if (GTK_WIDGET_MAPPED (druid->next)) {
-			gtk_widget_unmap (druid->next);
-			gtk_widget_map (druid->finish);
-		}
+		gtk_widget_hide (druid->next);
+		gtk_widget_show (druid->finish);
 	} else {
-		undefault_button (druid->finish);
-
-		if (GTK_WIDGET_MAPPED (druid->finish)) {
-			gtk_widget_unmap (druid->finish);
-			gtk_widget_map (druid->next);
-		}
+		gtk_widget_hide (druid->finish);
+		gtk_widget_show (druid->next);
 	}
 	druid->_priv->show_finish = show_finish?TRUE:FALSE;
 }
@@ -906,12 +933,9 @@
 		return;
 
 	if (show_help) {
-		if (GTK_WIDGET_MAPPED (druid))
-			gtk_widget_map (druid->help);
+		gtk_widget_show (druid->help);
 	} else {
-		undefault_button (druid->help);
-		if (GTK_WIDGET_MAPPED (druid->help))
-			gtk_widget_unmap (druid->help);
+		gtk_widget_hide (druid->help);
 	}
 	druid->_priv->show_finish = show_help?TRUE:FALSE;
 }
Index: gnome-druid-page-standard.c
===================================================================
RCS file: /cvs/gnome/libgnomeui/libgnomeui/gnome-druid-page-standard.c,v
retrieving revision 1.38
diff -u -r1.38 gnome-druid-page-standard.c
--- gnome-druid-page-standard.c	2001/12/27 01:27:07	1.38
+++ gnome-druid-page-standard.c	2002/01/10 20:25:19
@@ -41,15 +41,11 @@
 
 struct _GnomeDruidPageStandardPrivate
 {
-	GtkWidget *top_bar;
+	GtkWidget *background;
 	GtkWidget *watermark;
 	GtkWidget *logo;
 	GtkWidget *title_label;
 
-	GtkWidget *left_line;
-	GtkWidget *right_line;
-	GtkWidget *bottom_line;
-
 	GtkWidget *evbox;
 
 	guint title_foreground_set : 1;
@@ -74,15 +70,8 @@
 						     GtkStyle                    *old_style);
 static void gnome_druid_page_standard_prepare       (GnomeDruidPage              *page,
 						     GtkWidget                   *druid);
-static void gnome_druid_page_standard_size_allocate (GtkWidget                   *widget,
-						     GtkAllocation               *allocation);
-static void gnome_druid_page_standard_layout_setup  (GnomeDruidPageStandard      *druid_page_standard);
 static void gnome_druid_page_standard_set_color     (GnomeDruidPageStandard      *druid_page_standard);
 
-
-#define LOGO_WIDTH 48
-#define DRUID_PAGE_WIDTH 508
-
 enum {
 	PROP_0,
 	PROP_TITLE,
@@ -122,7 +111,6 @@
 	gobject_class->set_property = gnome_druid_page_standard_set_property;
 	gobject_class->finalize = gnome_druid_page_standard_finalize;
 	object_class->destroy = gnome_druid_page_standard_destroy;
-	widget_class->size_allocate = gnome_druid_page_standard_size_allocate;
 	widget_class->realize = gnome_druid_page_standard_realize;
 	widget_class->style_set = gnome_druid_page_standard_style_set;
 	druid_page_class->prepare = gnome_druid_page_standard_prepare;
@@ -227,60 +215,42 @@
 static void
 gnome_druid_page_standard_instance_init (GnomeDruidPageStandard *druid_page_standard)
 {
-
-	GtkWidget *vbox;
-	GtkWidget *hbox;
+	GtkWidget *table;
 
 	druid_page_standard->_priv = g_new0(GnomeDruidPageStandardPrivate, 1);
 
-	/* Top VBox */
-	vbox = gtk_vbox_new (FALSE, 0);
-	gtk_container_add (GTK_CONTAINER (druid_page_standard), vbox);
-	gtk_widget_show (vbox);
+	/* FIXME: we should be a windowed widget, so we can set the
+	 * style on ourself rather than doing this eventbox hack 
+	 */
+
+	/* Top bar background */
+	druid_page_standard->_priv->background = gtk_event_box_new ();
+	gtk_container_add (GTK_CONTAINER (druid_page_standard),
+			   druid_page_standard->_priv->background);
+	gtk_widget_show (druid_page_standard->_priv->background);
 
 	/* Top bar layout widget */
-	druid_page_standard->_priv->top_bar = gtk_layout_new (NULL, NULL);
-	gtk_box_pack_start (GTK_BOX (vbox),
-			    druid_page_standard->_priv->top_bar,
-	                    FALSE, FALSE, 0);
-	gtk_widget_set_size_request (druid_page_standard->_priv->top_bar, -1, 52);
-	gtk_widget_show (druid_page_standard->_priv->top_bar);
+	table = gtk_table_new (2, 2, FALSE);
+	gtk_container_add (GTK_CONTAINER (druid_page_standard->_priv->background),
+			   table);
+	gtk_widget_show (table);
 
 	/* Top Bar Watermark */
-	druid_page_standard->_priv->watermark = gtk_image_new_from_pixbuf (NULL);
-	gtk_layout_put (GTK_LAYOUT (druid_page_standard->_priv->top_bar),
-	                druid_page_standard->_priv->watermark, 0, 0);
+	druid_page_standard->_priv->watermark = gtk_image_new ();
+	gtk_misc_set_alignment (GTK_MISC (druid_page_standard->_priv->watermark), 0.0, 0.0);
 	gtk_widget_show (druid_page_standard->_priv->watermark);
-
+	
 	/* Title label */
 	druid_page_standard->_priv->title_label = gtk_label_new (NULL);
-	gtk_layout_put (GTK_LAYOUT (druid_page_standard->_priv->top_bar),
-	                druid_page_standard->_priv->title_label, 16, 2);
-	gtk_widget_set_size_request (druid_page_standard->_priv->title_label, -1, LOGO_WIDTH);
+	gtk_misc_set_alignment (GTK_MISC (druid_page_standard->_priv->title_label), 0.0, 0.5);
 	gtk_widget_show (druid_page_standard->_priv->title_label);
 
 	/* Top bar logo*/
-	druid_page_standard->_priv->logo = gtk_image_new_from_pixbuf (NULL);
-	gtk_layout_put (GTK_LAYOUT (druid_page_standard->_priv->top_bar),
-	                druid_page_standard->_priv->logo,
-	                (DRUID_PAGE_WIDTH - (LOGO_WIDTH + 2)), 2);
+	druid_page_standard->_priv->logo = gtk_image_new ();
 	gtk_widget_show (druid_page_standard->_priv->logo);
 
-	/* HBox for contents row */
-	hbox = gtk_hbox_new (FALSE, 0);
-	gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
-	gtk_widget_show (hbox);
-
-	/* Left line */
-	druid_page_standard->_priv->left_line = gtk_drawing_area_new ();
-	gtk_drawing_area_size (GTK_DRAWING_AREA (druid_page_standard->_priv->left_line), 1, 1);
-	gtk_box_pack_start (GTK_BOX (hbox), druid_page_standard->_priv->left_line,
-	                    FALSE, FALSE, 0);
-	gtk_widget_show (druid_page_standard->_priv->left_line);
-
 	/* Contents Event Box (used for styles) */
 	druid_page_standard->_priv->evbox = gtk_event_box_new ();
-	gtk_box_pack_start (GTK_BOX (hbox), druid_page_standard->_priv->evbox, TRUE, TRUE, 0);
 	gtk_widget_show (druid_page_standard->_priv->evbox);
 
 	/* Contents Vbox */
@@ -288,33 +258,35 @@
 	gtk_container_set_border_width (GTK_CONTAINER (druid_page_standard->vbox), 16);
 	gtk_container_add (GTK_CONTAINER (druid_page_standard->_priv->evbox), druid_page_standard->vbox);
 	gtk_widget_show (druid_page_standard->vbox);
-
-	/* Right line */
-	druid_page_standard->_priv->right_line = gtk_drawing_area_new ();
-	gtk_drawing_area_size (GTK_DRAWING_AREA (druid_page_standard->_priv->right_line),
-	                       1, 1);
-	gtk_box_pack_start (GTK_BOX (hbox), druid_page_standard->_priv->right_line,
-	                    FALSE, FALSE, 0);
-	gtk_widget_show (druid_page_standard->_priv->right_line);
-
-	/* Bottom line */
-	druid_page_standard->_priv->bottom_line = gtk_drawing_area_new ();
-	gtk_drawing_area_size (GTK_DRAWING_AREA (druid_page_standard->_priv->bottom_line),
-	                       1, 1);
-	gtk_box_pack_start (GTK_BOX (vbox), druid_page_standard->_priv->bottom_line,
-	                    FALSE, FALSE, 0);
-	gtk_widget_show (druid_page_standard->_priv->bottom_line);
-}
-
-static void
-get_color_arg (GValue *value, GdkColor *orig)
-{
-  GdkColor *color;
 
-  color = g_new (GdkColor, 1);
-  *color = *orig;
-  g_value_init (value, GDK_TYPE_COLOR);
-  g_value_set_boxed (value, color);
+	/* do this order exactly, so that it displays with the correct
+	 * z-ordering */
+	gtk_table_attach (GTK_TABLE (table),
+			  druid_page_standard->_priv->logo,
+			  1, 2, 0, 1,
+			  0, 0,
+			  5, 5);
+
+	gtk_table_attach (GTK_TABLE (table),
+			  druid_page_standard->_priv->title_label,
+			  0, 1, 0, 1,
+			  GTK_EXPAND | GTK_FILL,
+			  GTK_FILL,
+			  5, 5);
+
+	gtk_table_attach (GTK_TABLE (table),
+			  druid_page_standard->_priv->watermark,
+			  0, 2, 0, 1, 
+			  GTK_EXPAND | GTK_FILL,
+			  GTK_FILL,
+			  0, 0);
+
+	gtk_table_attach (GTK_TABLE (table),
+			  druid_page_standard->_priv->evbox,
+			  0, 2, 1, 2,
+			  GTK_EXPAND | GTK_FILL,
+			  GTK_EXPAND | GTK_FILL,
+			  1, 1);
 }
 
 static void
@@ -336,25 +308,25 @@
 		g_value_set_object (value, druid_page_standard->top_watermark);
 		break;
 	case PROP_TITLE_FOREGROUND_GDK:
-		get_color_arg (value, & (druid_page_standard->title_foreground));
+		g_value_set_boxed (value, &druid_page_standard->title_foreground);
 		break;
 	case PROP_TITLE_FOREGROUND_SET:
 		g_value_set_boolean (value, druid_page_standard->_priv->title_foreground_set);
 		break;
 	case PROP_BACKGROUND_GDK:
-		get_color_arg (value, & (druid_page_standard->background));
+		g_value_set_boxed (value, &druid_page_standard->background);
 		break;
 	case PROP_BACKGROUND_SET:
 		g_value_set_boolean (value, druid_page_standard->_priv->background_set);
 		break;
 	case PROP_LOGO_BACKGROUND_GDK:
-		get_color_arg (value, & (druid_page_standard->logo_background));
+		g_value_set_boxed (value, &druid_page_standard->logo_background);
 		break;
 	case PROP_LOGO_BACKGROUND_SET:
 		g_value_set_boolean (value, druid_page_standard->_priv->logo_background_set);
 		break;
 	case PROP_CONTENTS_BACKGROUND_GDK:
-		get_color_arg (value, & (druid_page_standard->contents_background));
+		g_value_set_boxed (value, &druid_page_standard->contents_background);
 		break;
 	case PROP_CONTENTS_BACKGROUND_SET:
 		g_value_set_boolean (value, druid_page_standard->_priv->contents_background_set);
@@ -363,8 +335,6 @@
 		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
 		break;
 	}
-
-	GNOME_CALL_PARENT (G_OBJECT_CLASS, get_property, (object, prop_id, value, pspec));
 }
 
 static void
@@ -397,10 +367,6 @@
 			break;
 		}
 		gnome_druid_page_standard_set_title_foreground (druid_page_standard, &color);
-		if (druid_page_standard->_priv->title_foreground_set == FALSE) {
-			druid_page_standard->_priv->title_foreground_set = TRUE;
-			g_object_notify (object, "title_foreground_set");
-		}
 		break;
 	case PROP_TITLE_FOREGROUND_SET:
 		druid_page_standard->_priv->title_foreground_set = g_value_get_boolean (value);
@@ -414,10 +380,6 @@
 			break;
 		}
 		gnome_druid_page_standard_set_background (druid_page_standard, &color);
-		if (druid_page_standard->_priv->background_set == FALSE) {
-			druid_page_standard->_priv->background_set = TRUE;
-			g_object_notify (object, "background_set");
-		}
 		break;
 	case PROP_BACKGROUND_SET:
 		druid_page_standard->_priv->background_set = g_value_get_boolean (value);
@@ -431,10 +393,6 @@
 			break;
 		}
 		gnome_druid_page_standard_set_logo_background (druid_page_standard, &color);
-		if (druid_page_standard->_priv->logo_background_set == FALSE) {
-			druid_page_standard->_priv->logo_background_set = TRUE;
-			g_object_notify (object, "logo_background_set");
-		}
 		break;
 	case PROP_LOGO_BACKGROUND_SET:
 		druid_page_standard->_priv->logo_background_set = g_value_get_boolean (value);
@@ -448,10 +406,6 @@
 			break;
 		}
 		gnome_druid_page_standard_set_contents_background (druid_page_standard, &color);
-		if (druid_page_standard->_priv->contents_background_set == FALSE) {
-			druid_page_standard->_priv->contents_background_set = TRUE;
-			g_object_notify (object, "contents_background_set");
-		}
 		break;
 	case PROP_CONTENTS_BACKGROUND_SET:
 		druid_page_standard->_priv->contents_background_set = g_value_get_boolean (value);
@@ -460,8 +414,6 @@
 		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
 		break;
 	}
-
-	GNOME_CALL_PARENT (G_OBJECT_CLASS, set_property, (object, prop_id, value, pspec));
 }
 
 static void
@@ -640,9 +592,7 @@
 	g_return_if_fail (GNOME_IS_DRUID_PAGE_STANDARD (druid_page_standard));
 	g_return_if_fail (color != NULL);
 
-	druid_page_standard->title_foreground.red = color->red;
-	druid_page_standard->title_foreground.green = color->green;
-	druid_page_standard->title_foreground.blue = color->blue;
+	druid_page_standard->title_foreground = *color;
 
 	gtk_widget_modify_fg (druid_page_standard->_priv->title_label, GTK_STATE_NORMAL, color);
 
@@ -660,15 +610,9 @@
 	g_return_if_fail (GNOME_IS_DRUID_PAGE_STANDARD (druid_page_standard));
 	g_return_if_fail (color != NULL);
 
-	druid_page_standard->background.red = color->red;
-	druid_page_standard->background.green = color->green;
-	druid_page_standard->background.blue = color->blue;
-
-	gtk_widget_modify_bg (druid_page_standard->_priv->top_bar, GTK_STATE_NORMAL, color);
-	gtk_widget_modify_bg (druid_page_standard->_priv->left_line, GTK_STATE_NORMAL, color);
-	gtk_widget_modify_bg (druid_page_standard->_priv->right_line, GTK_STATE_NORMAL, color);
-	gtk_widget_modify_bg (druid_page_standard->_priv->bottom_line, GTK_STATE_NORMAL, color);
+	druid_page_standard->background = *color;
 
+	gtk_widget_modify_bg (druid_page_standard->_priv->background, GTK_STATE_NORMAL, color);
 	g_object_notify (G_OBJECT (druid_page_standard), "background");
 	if (druid_page_standard->_priv->background_set == FALSE) {
 		druid_page_standard->_priv->background_set = TRUE;
@@ -683,9 +627,7 @@
 	g_return_if_fail (GNOME_IS_DRUID_PAGE_STANDARD (druid_page_standard));
 	g_return_if_fail (color != NULL);
 
-	druid_page_standard->logo_background.red = color->red;
-	druid_page_standard->logo_background.green = color->green;
-	druid_page_standard->logo_background.blue = color->blue;
+	druid_page_standard->logo_background = *color;
 
 	gtk_widget_modify_bg (druid_page_standard->_priv->logo, GTK_STATE_NORMAL, color);
 	g_object_notify (G_OBJECT (druid_page_standard), "logo_background");
@@ -703,9 +645,7 @@
 	g_return_if_fail (GNOME_IS_DRUID_PAGE_STANDARD (druid_page_standard));
 	g_return_if_fail (color != NULL);
 
-	druid_page_standard->contents_background.red = color->red;
-	druid_page_standard->contents_background.green = color->green;
-	druid_page_standard->contents_background.blue = color->blue;
+	druid_page_standard->contents_background = *color;
 
 	gtk_widget_modify_bg (druid_page_standard->_priv->evbox, GTK_STATE_NORMAL, color);
 
@@ -780,56 +720,23 @@
 }
 
 static void
-gnome_druid_page_standard_size_allocate (GtkWidget *widget,
-					 GtkAllocation *allocation)
-{
-	GNOME_CALL_PARENT (GTK_WIDGET_CLASS, size_allocate,
-				   (widget, allocation));
-	gnome_druid_page_standard_layout_setup (GNOME_DRUID_PAGE_STANDARD (widget));
-}
-
-static void
-gnome_druid_page_standard_layout_setup (GnomeDruidPageStandard *druid_page_standard)
-{
-	g_return_if_fail (druid_page_standard != NULL);
-	g_return_if_fail (GNOME_IS_DRUID_PAGE_STANDARD (druid_page_standard));
-
-	gtk_layout_move (GTK_LAYOUT (druid_page_standard->_priv->top_bar),
-	                 druid_page_standard->_priv->logo,
-	                 (druid_page_standard->_priv->top_bar->allocation.width - (LOGO_WIDTH + 2)), 2);
-	gtk_layout_move (GTK_LAYOUT (druid_page_standard->_priv->top_bar),
-	                 druid_page_standard->_priv->title_label, 16, 2);
-}
-
-static void
 gnome_druid_page_standard_set_color (GnomeDruidPageStandard *druid_page_standard)
 {
 	GtkWidget *widget = GTK_WIDGET (druid_page_standard);
 	if (druid_page_standard->_priv->background_set == FALSE) {
-		druid_page_standard->background.red = widget->style->bg[GTK_STATE_SELECTED].red;
-		druid_page_standard->background.green = widget->style->bg[GTK_STATE_SELECTED].green;
-		druid_page_standard->background.blue = widget->style->bg[GTK_STATE_SELECTED].blue;
+		druid_page_standard->background = widget->style->bg[GTK_STATE_SELECTED];
 	}
 	if (druid_page_standard->_priv->logo_background_set == FALSE) {
-		druid_page_standard->logo_background.red = widget->style->bg[GTK_STATE_SELECTED].red;
-		druid_page_standard->logo_background.green = widget->style->bg[GTK_STATE_SELECTED].green;
-		druid_page_standard->logo_background.blue = widget->style->bg[GTK_STATE_SELECTED].blue;
+		druid_page_standard->logo_background = widget->style->bg[GTK_STATE_SELECTED];
 	}
 	if (druid_page_standard->_priv->title_foreground_set == FALSE) {
-		druid_page_standard->title_foreground.red = widget->style->fg[GTK_STATE_SELECTED].red;
-		druid_page_standard->title_foreground.green = widget->style->fg[GTK_STATE_SELECTED].green;
-		druid_page_standard->title_foreground.blue = widget->style->fg[GTK_STATE_SELECTED].blue;
+		druid_page_standard->title_foreground = widget->style->fg[GTK_STATE_SELECTED];
 	}
 	if (druid_page_standard->_priv->contents_background_set == FALSE) {
-		druid_page_standard->contents_background.red = widget->style->bg[GTK_STATE_PRELIGHT].red;
-		druid_page_standard->contents_background.green = widget->style->bg[GTK_STATE_PRELIGHT].green;
-		druid_page_standard->contents_background.blue = widget->style->bg[GTK_STATE_PRELIGHT].blue;
+		druid_page_standard->contents_background = widget->style->bg[GTK_STATE_PRELIGHT];
 	}
 
 	gtk_widget_modify_fg (druid_page_standard->_priv->title_label, GTK_STATE_NORMAL, &(druid_page_standard->title_foreground));
-	gtk_widget_modify_bg (druid_page_standard->_priv->top_bar, GTK_STATE_NORMAL, &(druid_page_standard->background));
-	gtk_widget_modify_bg (druid_page_standard->_priv->left_line, GTK_STATE_NORMAL, &(druid_page_standard->background));
-	gtk_widget_modify_bg (druid_page_standard->_priv->right_line, GTK_STATE_NORMAL, &(druid_page_standard->background));
-	gtk_widget_modify_bg (druid_page_standard->_priv->bottom_line, GTK_STATE_NORMAL, &(druid_page_standard->background));
+	gtk_widget_modify_bg (druid_page_standard->_priv->background, GTK_STATE_NORMAL, &(druid_page_standard->background));
 	gtk_widget_modify_bg (druid_page_standard->_priv->evbox, GTK_STATE_NORMAL,&(druid_page_standard->contents_background));
 }
Index: gnome-druid-page-edge.c
===================================================================
RCS file: /cvs/gnome/libgnomeui/libgnomeui/gnome-druid-page-edge.c,v
retrieving revision 1.28
diff -u -r1.28 gnome-druid-page-edge.c
--- gnome-druid-page-edge.c	2001/12/27 01:27:07	1.28
+++ gnome-druid-page-edge.c	2002/01/10 20:25:19
@@ -22,6 +22,12 @@
   @NOTATION@
 */
 
+/*
+ * FIXME (for gnome 2.2):
+ *
+ * This widget needs properties like GnomeDruidPageStandard
+ */
+
 #include <config.h>
 #include <libgnome/gnome-macros.h>
 
@@ -38,32 +44,34 @@
 
 struct _GnomeDruidPageEdgePrivate
 {
-	GtkWidget *canvas;
-	GnomeCanvasItem *background_item;
-	GnomeCanvasItem *textbox_item;
-	GnomeCanvasItem *text_item;
-	GnomeCanvasItem *logo_item;
-	GnomeCanvasItem *logoframe_item;
-	GnomeCanvasItem *watermark_item;
-	GnomeCanvasItem *top_watermark_item;
-	GnomeCanvasItem *title_item;
+	GtkWidget *background;
+	GtkWidget *top_watermark;
+	GtkWidget *side_watermark;
+	GtkWidget *title_label;
+	GtkWidget *logo;
+	GtkWidget *text_label;
+	GtkWidget *contents;
+
+	gboolean background_color_set : 1;
+	gboolean textbox_color_set : 1;
+	gboolean logo_background_color_set : 1;
+	gboolean title_color_set : 1;
+	gboolean text_color_set : 1;
 };
 
 static void gnome_druid_page_edge_destroy 	(GtkObject                      *object);
 static void gnome_druid_page_edge_finalize 	(GObject                        *object);
-static void gnome_druid_page_edge_setup         (GnomeDruidPageEdge             *druid_page_edge);
-static void gnome_druid_page_edge_configure_canvas(GnomeDruidPageEdge           *druid_page_edge);
-static void gnome_druid_page_edge_size_allocate (GtkWidget                      *widget,
-						 GtkAllocation                  *allocation);
+static void gnome_druid_page_edge_set_color     (GnomeDruidPageEdge             *druid_page_edge);
+static void gnome_druid_page_edge_style_set     (GtkWidget                      *widget,
+						 GtkStyle                       *old_style);
+static void gnome_druid_page_edge_realize       (GtkWidget                      *widget);
 static void gnome_druid_page_edge_prepare	(GnomeDruidPage		        *page,
-						 GtkWidget                      *druid,
-						 gpointer 			*data);
+						 GtkWidget                      *druid);
 
 #define LOGO_WIDTH 50.0
 #define DRUID_PAGE_HEIGHT 318
 #define DRUID_PAGE_WIDTH 516
 #define DRUID_PAGE_LEFT_WIDTH 100.0
-#define GDK_COLOR_TO_RGBA(color) GNOME_CANVAS_COLOR ((color).red/256, (color).green/256, (color).blue/256)
 
 GNOME_CLASS_BOILERPLATE (GnomeDruidPageEdge, gnome_druid_page_edge,
 			 GnomeDruidPage, GNOME_TYPE_DRUID_PAGE);
@@ -74,37 +82,107 @@
 	GtkObjectClass *object_class;
 	GObjectClass *gobject_class;
 	GtkWidgetClass *widget_class;
+	GnomeDruidPageClass *page_class;
 
 	object_class = (GtkObjectClass*) klass;
 	gobject_class = (GObjectClass*) klass;
 	widget_class = (GtkWidgetClass*) klass;
+	page_class = (GnomeDruidPageClass*) klass;
 
 	object_class->destroy = gnome_druid_page_edge_destroy;
 	gobject_class->finalize = gnome_druid_page_edge_finalize;
-	widget_class->size_allocate = gnome_druid_page_edge_size_allocate;
+	widget_class->style_set = gnome_druid_page_edge_style_set;
+	widget_class->realize = gnome_druid_page_edge_realize;
+
+	page_class->prepare = gnome_druid_page_edge_prepare;
 }
 
 static void
-gnome_druid_page_edge_instance_init (GnomeDruidPageEdge *druid_page_edge)
+gnome_druid_page_edge_instance_init (GnomeDruidPageEdge *page)
 {
-	druid_page_edge->_priv = g_new0(GnomeDruidPageEdgePrivate, 1);
+	GtkWidget *table;
+	GtkWidget *box;
+	GnomeDruidPageEdgePrivate *priv;
+
+	priv = g_new0(GnomeDruidPageEdgePrivate, 1);
+	page->_priv = priv;
+
+	/* FIXME: we should be a windowed widget, so we can set the
+	 * background style on ourself rather than doing this eventbox
+	 * hack */
+	priv->background = gtk_event_box_new ();
+	gtk_container_add (GTK_CONTAINER (page), priv->background);
+	gtk_widget_show (priv->background);
+
+	table = gtk_table_new (2, 2, FALSE);
+	gtk_container_add (GTK_CONTAINER (priv->background), table);
+	gtk_widget_show (table);
+
+	/* top bar watermark */
+	priv->top_watermark = gtk_image_new_from_pixbuf (NULL);
+	gtk_misc_set_alignment (GTK_MISC (priv->top_watermark), 0.0, 0.0);
+	gtk_widget_show (priv->top_watermark);
+
+	/* title label */
+	priv->title_label = gtk_label_new (NULL);
+	gtk_misc_set_alignment (GTK_MISC (priv->title_label), 0.0, 0.5);
+	gtk_widget_show (priv->title_label);
+
+	/* top bar logo */
+	priv->logo = gtk_image_new ();
+	gtk_widget_show (priv->logo);
+
+	box = gtk_hbox_new (FALSE, 0);
+	gtk_widget_show (box);
+
+	/* side watermark */
+	priv->side_watermark = gtk_image_new ();
+	gtk_misc_set_alignment (GTK_MISC (priv->side_watermark), 0.0, 1.0);
+	gtk_widget_set_size_request (priv->side_watermark, DRUID_PAGE_LEFT_WIDTH, -1);
+	gtk_box_pack_start (GTK_BOX (box), priv->side_watermark,
+			    FALSE, TRUE, 0);
+	gtk_widget_show (priv->side_watermark);
+
+	/* contents event box (used for styles) */
+	priv->contents = gtk_event_box_new ();
+	gtk_box_pack_start (GTK_BOX (box), priv->contents,
+			    TRUE, TRUE, 0);
+	gtk_widget_show (priv->contents);
+
+	/* contents label */
+	priv->text_label = gtk_label_new (NULL);
+	gtk_label_set_line_wrap (GTK_LABEL (priv->text_label), TRUE);
+	gtk_misc_set_alignment (GTK_MISC (priv->text_label), 0.5, 0.5);
+	gtk_container_add (GTK_CONTAINER (priv->contents), priv->text_label);
+	gtk_widget_show (priv->text_label);
+
+	gtk_table_attach (GTK_TABLE (table),
+			  priv->logo,
+			  1, 2, 0, 1,
+			  0, 0,
+			  5, 5);
+
+	gtk_table_attach (GTK_TABLE (table),
+			  priv->title_label,
+			  0, 1, 0, 1,
+			  GTK_EXPAND | GTK_FILL,
+			  GTK_FILL,
+			  5, 5);
+
+	gtk_table_attach (GTK_TABLE (table),
+			  priv->top_watermark,
+			  0, 2, 0, 1,
+			  GTK_EXPAND | GTK_FILL,
+			  GTK_FILL,
+			  0, 0);
+
+	gtk_table_attach (GTK_TABLE (table),
+			  box,
+			  0, 2, 1, 2,
+			  GTK_EXPAND | GTK_FILL,
+			  GTK_EXPAND | GTK_FILL,
+			  0, 0);
 
-	/* initialize the color values */
-	druid_page_edge->background_color.red = 6400; /* midnight blue */
-	druid_page_edge->background_color.green = 6400;
-	druid_page_edge->background_color.blue = 28672;
-	druid_page_edge->textbox_color.red = 65280; /* white */
-	druid_page_edge->textbox_color.green = 65280;
-	druid_page_edge->textbox_color.blue = 65280;
-	druid_page_edge->logo_background_color.red = 65280; /* white */
-	druid_page_edge->logo_background_color.green = 65280;
-	druid_page_edge->logo_background_color.blue = 65280;
-	druid_page_edge->title_color.red = 65280; /* white */
-	druid_page_edge->title_color.green = 65280;
-	druid_page_edge->title_color.blue = 65280;
-	druid_page_edge->text_color.red = 0; /* black */
-	druid_page_edge->text_color.green = 0;
-	druid_page_edge->text_color.blue = 0;
 }
 
 /**
@@ -122,47 +200,26 @@
 				 GdkPixbuf          *watermark,
 				 GdkPixbuf          *top_watermark)
 {
-	GtkWidget *canvas;
-
-	g_return_if_fail (druid_page_edge != NULL);
 	g_return_if_fail (GNOME_IS_DRUID_PAGE_EDGE (druid_page_edge));
 	g_return_if_fail (position >= GNOME_EDGE_START &&
 			  position < GNOME_EDGE_LAST);
 
-	if (antialiased) {
-		gtk_widget_push_colormap (gdk_rgb_get_colormap ());
-		canvas = gnome_canvas_new_aa();
-		gtk_widget_pop_colormap ();
-	} else {
-		canvas = gnome_canvas_new();
-	}
-
-	druid_page_edge->_priv->canvas = canvas;
-
 	druid_page_edge->position = position;
-	druid_page_edge->title = g_strdup (title ? title : "");
-	druid_page_edge->text = g_strdup (text ? text : "");
 
-	if (logo != NULL)
-		g_object_ref (G_OBJECT (logo));
-	druid_page_edge->logo_image = logo;
+	if (title)
+		gnome_druid_page_edge_set_title (druid_page_edge, title);
 
-	if (watermark != NULL)
-		g_object_ref (G_OBJECT (watermark));
-	druid_page_edge->watermark_image = watermark;
+	if (text)
+		gnome_druid_page_edge_set_text  (druid_page_edge, text);
+
+	if (logo)
+		gnome_druid_page_edge_set_logo (druid_page_edge, logo);
 
-	if (top_watermark != NULL)
-		g_object_ref (G_OBJECT (top_watermark));
-	druid_page_edge->top_watermark_image = top_watermark;
-
-	/* Set up the canvas */
-	gtk_container_set_border_width (GTK_CONTAINER (druid_page_edge), 0);
-	gtk_widget_set_usize (canvas, DRUID_PAGE_WIDTH, DRUID_PAGE_HEIGHT);
-	gtk_widget_show (canvas);
-	gnome_canvas_set_scroll_region (GNOME_CANVAS (canvas), 0.0, 0.0, DRUID_PAGE_WIDTH, DRUID_PAGE_HEIGHT);
-	gtk_container_add (GTK_CONTAINER (druid_page_edge), canvas);
+	if (watermark)
+		gnome_druid_page_edge_set_watermark (druid_page_edge, watermark);
 
-	gnome_druid_page_edge_setup (druid_page_edge);
+	if (top_watermark)
+		gnome_druid_page_edge_set_top_watermark (druid_page_edge, top_watermark);
 }
 
 static void
@@ -199,178 +256,37 @@
 	GNOME_CALL_PARENT (G_OBJECT_CLASS, finalize, (object));
 }
 
-static void
-gnome_druid_page_edge_configure_canvas (GnomeDruidPageEdge *druid_page_edge)
-{
-	gfloat watermark_width;
-	gfloat watermark_height;
-	gfloat watermark_ypos;
-	int width, height;
-
-	width = GTK_WIDGET (druid_page_edge)->allocation.width;
-	height = GTK_WIDGET (druid_page_edge)->allocation.height;
-
-	watermark_width = DRUID_PAGE_LEFT_WIDTH;
-	watermark_height = (gfloat) height - LOGO_WIDTH + GNOME_PAD * 2.0;
-	watermark_ypos = LOGO_WIDTH + GNOME_PAD * 2.0;
-
-	if (druid_page_edge->watermark_image) {
-		watermark_width = gdk_pixbuf_get_width (druid_page_edge->watermark_image);
-		watermark_height = gdk_pixbuf_get_height (druid_page_edge->watermark_image);
-		watermark_ypos = (gfloat) height - watermark_height;
-		if (watermark_width < 1)
-			watermark_width = 1.0;
-		if (watermark_height < 1)
-			watermark_height = 1.0;
-	}
-
-	gnome_canvas_item_set (druid_page_edge->_priv->background_item,
-			       "x1", 0.0,
-			       "y1", 0.0,
-			       "x2", (double) width,
-			       "y2", (double) height,
-			       NULL);
-	gnome_canvas_item_set (druid_page_edge->_priv->textbox_item,
-			       "x1", (double) watermark_width,
-			       "y1", (double) (LOGO_WIDTH + GNOME_PAD * 2.0),
-			       "x2", (double) width,
-			       "y2", (double) height,
-			       NULL);
-	if (druid_page_edge->logo_image != NULL) {
-		gnome_canvas_item_show (druid_page_edge->_priv->logoframe_item);
-		gnome_canvas_item_set (druid_page_edge->_priv->logoframe_item,
-				       "x1", (double) (width - LOGO_WIDTH -GNOME_PAD),
-				       "y1", (double) (GNOME_PAD),
-				       "x2", (double) (width - GNOME_PAD),
-				       "y2", (double) (GNOME_PAD + LOGO_WIDTH),
-				       "width_units", 1.0,
-				       NULL);
-	} else {
-		gnome_canvas_item_hide (druid_page_edge->_priv->logoframe_item);
-	}
-	gnome_canvas_item_set (druid_page_edge->_priv->logo_item,
-			       "x", (double) (width - GNOME_PAD - LOGO_WIDTH),
-			       "y", (double) (GNOME_PAD),
-			       "width", (double) (LOGO_WIDTH),
-			       "height", (double) (LOGO_WIDTH),
-			       NULL);
-	gnome_canvas_item_set (druid_page_edge->_priv->watermark_item,
-			       "x", 0.0,
-			       "y", (double) watermark_ypos,
-			       "width", (double) watermark_width,
-			       "height", (double) watermark_height,
-			       NULL);
-
-	gnome_canvas_item_set (druid_page_edge->_priv->title_item,
-			       "x", 15.0,
-			       "y", (double) (GNOME_PAD + LOGO_WIDTH / 2.0),
-			       "anchor", GTK_ANCHOR_WEST,
-			       NULL);
-	gnome_canvas_item_set (druid_page_edge->_priv->text_item,
-			       "x", (double) (((width - watermark_width) * 0.5) + watermark_width),
-			       "y", (double) (LOGO_WIDTH + GNOME_PAD * 2.0 + (height - (LOGO_WIDTH + GNOME_PAD * 2.0))/ 2.0),
-			       "anchor", GTK_ANCHOR_CENTER,
-			       NULL);
-}
-
 static void
-gnome_druid_page_edge_setup (GnomeDruidPageEdge *druid_page_edge)
+gnome_druid_page_edge_set_color (GnomeDruidPageEdge *page)
 {
-	GnomeCanvas *canvas;
-	guint32 fill_color;
-	PangoFontDescription *font_desc;
-
-	canvas = GNOME_CANVAS (druid_page_edge->_priv->canvas);
-
-	/* set up the rest of the page */
-	fill_color = GDK_COLOR_TO_RGBA (druid_page_edge->background_color);
-	druid_page_edge->_priv->background_item =
-		gnome_canvas_item_new (gnome_canvas_root (canvas),
-				       GNOME_TYPE_CANVAS_RECT,
-				       "fill_color_rgba", fill_color,
-				       NULL);
-
-	fill_color = GDK_COLOR_TO_RGBA (druid_page_edge->textbox_color);
-	druid_page_edge->_priv->textbox_item =
-		gnome_canvas_item_new (gnome_canvas_root (canvas),
-				       GNOME_TYPE_CANVAS_RECT,
-				       "fill_color_rgba", fill_color,
-				       NULL);
-
-	fill_color = GDK_COLOR_TO_RGBA (druid_page_edge->logo_background_color);
-	druid_page_edge->_priv->logoframe_item =
-		gnome_canvas_item_new (gnome_canvas_root (canvas),
-				       GNOME_TYPE_CANVAS_RECT,
-				       "fill_color_rgba", fill_color,
-				       NULL);
-	if (druid_page_edge->logo_image == NULL) {
-		gnome_canvas_item_hide (druid_page_edge->_priv->logoframe_item);
-	}
-
-	druid_page_edge->_priv->top_watermark_item =
-		gnome_canvas_item_new (gnome_canvas_root (canvas),
-				       GNOME_TYPE_CANVAS_PIXBUF,
-				       "x", 0.0,
-				       "y", 0.0,
-				       NULL);
-
-	if (druid_page_edge->top_watermark_image != NULL)
-		gnome_canvas_item_set (druid_page_edge->_priv->top_watermark_item,
-				       "pixbuf", druid_page_edge->top_watermark_image,
-				       NULL);
-
-	druid_page_edge->_priv->logo_item =
-		gnome_canvas_item_new (gnome_canvas_root (canvas),
-				       GNOME_TYPE_CANVAS_PIXBUF,
-				       NULL);
-
-	if (druid_page_edge->logo_image != NULL)
-		gnome_canvas_item_set (druid_page_edge->_priv->logo_item,
-				       "pixbuf", druid_page_edge->logo_image, NULL);
-
-	druid_page_edge->_priv->watermark_item =
-		gnome_canvas_item_new (gnome_canvas_root (canvas),
-				       GNOME_TYPE_CANVAS_PIXBUF,
-				       NULL);
-
-	if (druid_page_edge->watermark_image != NULL)
-		gnome_canvas_item_set (druid_page_edge->_priv->watermark_item,
-				       "pixbuf", druid_page_edge->watermark_image,
-				       NULL);
-
-	fill_color = GDK_COLOR_TO_RGBA (druid_page_edge->title_color);
-	font_desc = pango_font_description_from_string (_("Helvetical Bold 18"));
-	druid_page_edge->_priv->title_item =
-		gnome_canvas_item_new (gnome_canvas_root (canvas),
-				       GNOME_TYPE_CANVAS_TEXT,
-				       "text", druid_page_edge->title,
-				       "fill_color_rgba", fill_color,
-				       "font_desc", font_desc,
-				       NULL);
-	pango_font_description_free (font_desc);
-
-	fill_color = GDK_COLOR_TO_RGBA (druid_page_edge->text_color);
-	font_desc = pango_font_description_from_string (_("Helvetical Medium 12"));
-	druid_page_edge->_priv->text_item =
-		gnome_canvas_item_new (gnome_canvas_root (canvas),
-				       GNOME_TYPE_CANVAS_TEXT,
-				       "text", druid_page_edge->text,
-				       "justification", GTK_JUSTIFY_LEFT,
-				       "font_desc", font_desc,
-				       "fill_color_rgba", fill_color,
-				       NULL);
-	pango_font_description_free (font_desc);
-
-	gtk_signal_connect (GTK_OBJECT (druid_page_edge),
-			    "prepare",
-			    GTK_SIGNAL_FUNC (gnome_druid_page_edge_prepare),
-			    NULL);
+	GnomeDruidPageEdgePrivate *priv = page->_priv;
+	GtkWidget *widget = GTK_WIDGET (page);
+	
+	if (!priv->background_color_set)
+		page->background_color = widget->style->bg[GTK_STATE_SELECTED];
+
+	if (!priv->textbox_color_set)
+		page->textbox_color = widget->style->bg[GTK_STATE_PRELIGHT];
+
+	if (!priv->logo_background_color_set)
+		page->logo_background_color = widget->style->bg[GTK_STATE_SELECTED];
+
+	if (!priv->title_color_set)
+		page->title_color = widget->style->fg[GTK_STATE_SELECTED];
+
+	if (!priv->text_color_set)
+		page->text_color = widget->style->fg[GTK_STATE_PRELIGHT];
+
+	gtk_widget_modify_bg (priv->background, GTK_STATE_NORMAL, &page->background_color);
+	gtk_widget_modify_bg (priv->contents, GTK_STATE_NORMAL, &page->textbox_color);
+	gtk_widget_modify_bg (priv->logo, GTK_STATE_NORMAL, &page->logo_background_color);
+	gtk_widget_modify_fg (priv->title_label, GTK_STATE_NORMAL, &page->title_color);
+	gtk_widget_modify_fg (priv->text_label, GTK_STATE_NORMAL, &page->text_color);
 }
 
 static void
 gnome_druid_page_edge_prepare (GnomeDruidPage *page,
-			       GtkWidget *druid,
-			       gpointer *data)
+			       GtkWidget *druid)
 {
 	switch (GNOME_DRUID_PAGE_EDGE (page)->position) {
 	case GNOME_EDGE_START:
@@ -393,24 +309,6 @@
 	}
 }
 
-static void
-gnome_druid_page_edge_size_allocate   (GtkWidget               *widget,
-				       GtkAllocation           *allocation)
-{
-	GnomeDruidPageEdge *druid_page_edge;
-
-	druid_page_edge = GNOME_DRUID_PAGE_EDGE (widget);
-
-	GNOME_CALL_PARENT (GTK_WIDGET_CLASS, size_allocate,
-				   (widget, allocation));
-
-	gnome_canvas_set_scroll_region (GNOME_CANVAS(druid_page_edge->_priv->canvas),
-					0.0, 0.0,
-					allocation->width,
-					allocation->height);
-	gnome_druid_page_edge_configure_canvas (druid_page_edge);
-}
-
 /**
  * gnome_druid_page_edge_new:
  * @position: Position in druid
@@ -530,129 +428,90 @@
 gnome_druid_page_edge_set_bg_color      (GnomeDruidPageEdge *druid_page_edge,
 					 GdkColor *color)
 {
-	guint fill_color;
-
-	g_return_if_fail (druid_page_edge != NULL);
 	g_return_if_fail (GNOME_IS_DRUID_PAGE_EDGE (druid_page_edge));
 	g_return_if_fail (color != NULL);
+
+	druid_page_edge->background_color = *color;
+	druid_page_edge->_priv->background_color_set = TRUE;
 
-	druid_page_edge->background_color.red = color->red;
-	druid_page_edge->background_color.green = color->green;
-	druid_page_edge->background_color.blue = color->blue;
-
-	fill_color = GDK_COLOR_TO_RGBA (druid_page_edge->background_color);
-
-	gnome_canvas_item_set (druid_page_edge->_priv->background_item,
-			       "fill_color_rgba", fill_color,
-			       NULL);
+	gtk_widget_modify_bg (druid_page_edge->_priv->background, GTK_STATE_NORMAL, color);
 }
 
 void
 gnome_druid_page_edge_set_textbox_color (GnomeDruidPageEdge *druid_page_edge,
 					 GdkColor *color)
 {
-	guint fill_color;
-
-	g_return_if_fail (druid_page_edge != NULL);
 	g_return_if_fail (GNOME_IS_DRUID_PAGE_EDGE (druid_page_edge));
 	g_return_if_fail (color != NULL);
+
+	druid_page_edge->textbox_color = *color;
+	druid_page_edge->_priv->textbox_color_set = TRUE;
 
-	druid_page_edge->textbox_color.red = color->red;
-	druid_page_edge->textbox_color.green = color->green;
-	druid_page_edge->textbox_color.blue = color->blue;
-
-	fill_color = GDK_COLOR_TO_RGBA (druid_page_edge->textbox_color);
-	gnome_canvas_item_set (druid_page_edge->_priv->textbox_item,
-			       "fill_color_rgba", fill_color,
-			       NULL);
+	gtk_widget_modify_bg (druid_page_edge->_priv->contents, GTK_STATE_NORMAL, color);
 }
 
 void
 gnome_druid_page_edge_set_logo_bg_color (GnomeDruidPageEdge *druid_page_edge,
 					 GdkColor *color)
 {
-	guint fill_color;
-
-	g_return_if_fail (druid_page_edge != NULL);
 	g_return_if_fail (GNOME_IS_DRUID_PAGE_EDGE (druid_page_edge));
 	g_return_if_fail (color != NULL);
 
-	druid_page_edge->logo_background_color.red = color->red;
-	druid_page_edge->logo_background_color.green = color->green;
-	druid_page_edge->logo_background_color.blue = color->blue;
-
-	fill_color = GDK_COLOR_TO_RGBA (druid_page_edge->logo_background_color);
-	gnome_canvas_item_set (druid_page_edge->_priv->logoframe_item,
-			       "fill_color_rgba", fill_color,
-			       NULL);
+	druid_page_edge->logo_background_color = *color;
+	druid_page_edge->_priv->logo_background_color_set = TRUE;
+
+	gtk_widget_modify_bg (druid_page_edge->_priv->logo, GTK_STATE_NORMAL, color);
 }
 
 void
 gnome_druid_page_edge_set_title_color   (GnomeDruidPageEdge *druid_page_edge,
 					 GdkColor *color)
 {
-	guint32 fill_color;
-
-	g_return_if_fail (druid_page_edge != NULL);
 	g_return_if_fail (GNOME_IS_DRUID_PAGE_EDGE (druid_page_edge));
 	g_return_if_fail (color != NULL);
+
+	druid_page_edge->title_color = *color;
+	druid_page_edge->_priv->title_color_set = 1;
 
-	druid_page_edge->title_color.red = color->red;
-	druid_page_edge->title_color.green = color->green;
-	druid_page_edge->title_color.blue = color->blue;
-
-	fill_color = GDK_COLOR_TO_RGBA (druid_page_edge->title_color);
-	gnome_canvas_item_set (druid_page_edge->_priv->title_item,
-			       "fill_color_rgba", fill_color,
-			       NULL);
+	gtk_widget_modify_fg (druid_page_edge->_priv->title_label, GTK_STATE_NORMAL, color);
 }
 
 void
 gnome_druid_page_edge_set_text_color    (GnomeDruidPageEdge *druid_page_edge,
 					 GdkColor *color)
 {
-	guint32 fill_color;
-
-	g_return_if_fail (druid_page_edge != NULL);
 	g_return_if_fail (GNOME_IS_DRUID_PAGE_EDGE (druid_page_edge));
 	g_return_if_fail (color != NULL);
+
+	druid_page_edge->text_color = *color;
+	druid_page_edge->_priv->text_color_set = TRUE;
 
-	druid_page_edge->text_color.red = color->red;
-	druid_page_edge->text_color.green = color->green;
-	druid_page_edge->text_color.blue = color->blue;
-
-	fill_color = GDK_COLOR_TO_RGBA (druid_page_edge->text_color);
-	gnome_canvas_item_set (druid_page_edge->_priv->text_item,
-			       "fill_color_rgba", fill_color,
-			       NULL);
+	gtk_widget_modify_fg (druid_page_edge->_priv->text_label, GTK_STATE_NORMAL, color);
 }
 
 void
 gnome_druid_page_edge_set_text (GnomeDruidPageEdge *druid_page_edge,
 				const gchar *text)
 {
-	g_return_if_fail (druid_page_edge != NULL);
 	g_return_if_fail (GNOME_IS_DRUID_PAGE_EDGE (druid_page_edge));
 
 	g_free (druid_page_edge->text);
-	druid_page_edge->text = g_strdup (text ? text : "");
-	gnome_canvas_item_set (druid_page_edge->_priv->text_item,
-			       "text", druid_page_edge->text,
-			       NULL);
+	druid_page_edge->text = g_strdup (text);
+	gtk_label_set_text (GTK_LABEL (druid_page_edge->_priv->text_label), text);
 }
 
 void
 gnome_druid_page_edge_set_title         (GnomeDruidPageEdge *druid_page_edge,
 					 const gchar *title)
 {
-	g_return_if_fail (druid_page_edge != NULL);
 	g_return_if_fail (GNOME_IS_DRUID_PAGE_EDGE (druid_page_edge));
 
 	g_free (druid_page_edge->title);
-	druid_page_edge->title = g_strdup (title ? title : "");
-	gnome_canvas_item_set (druid_page_edge->_priv->title_item,
-			       "text", druid_page_edge->title,
-			       NULL);
+	druid_page_edge->title = g_strconcat ("<span size=\"xx-large\" weight=\"ultrabold\">",
+					      title ? title : "", "</span>", NULL);
+	gtk_label_set_text (GTK_LABEL (druid_page_edge->_priv->title_label),
+			    druid_page_edge->title);
+	gtk_label_set_use_markup (GTK_LABEL (druid_page_edge->_priv->title_label), TRUE);
 }
 
 /**
@@ -667,9 +526,7 @@
 gnome_druid_page_edge_set_logo (GnomeDruidPageEdge *druid_page_edge,
 				GdkPixbuf *logo_image)
 {
-	g_return_if_fail (druid_page_edge != NULL);
 	g_return_if_fail (GNOME_IS_DRUID_PAGE_EDGE (druid_page_edge));
-	g_return_if_fail (logo_image != NULL);
 
 	if (druid_page_edge->logo_image != NULL)
 		g_object_unref (G_OBJECT (druid_page_edge->logo_image));
@@ -677,9 +534,7 @@
 	druid_page_edge->logo_image = logo_image;
 	if (logo_image != NULL )
 		g_object_ref (G_OBJECT (logo_image));
-	gnome_canvas_item_set (druid_page_edge->_priv->logo_item,
-			       "pixbuf", druid_page_edge->logo_image,
-			       NULL);
+	gtk_image_set_from_pixbuf (GTK_IMAGE (druid_page_edge->_priv->logo), logo_image);
 }
 
 /**
@@ -695,9 +550,8 @@
 gnome_druid_page_edge_set_watermark (GnomeDruidPageEdge *druid_page_edge,
 				     GdkPixbuf *watermark)
 {
-	g_return_if_fail (druid_page_edge != NULL);
+	int width = 0;
 	g_return_if_fail (GNOME_IS_DRUID_PAGE_EDGE (druid_page_edge));
-	g_return_if_fail (watermark != NULL);
 
 	if (druid_page_edge->watermark_image != NULL)
 		g_object_unref (G_OBJECT (druid_page_edge->watermark_image));
@@ -705,9 +559,13 @@
 	druid_page_edge->watermark_image = watermark;
 	if (watermark != NULL )
 		g_object_ref (G_OBJECT (watermark));
-	gnome_canvas_item_set (druid_page_edge->_priv->watermark_item,
-			       "pixbuf", druid_page_edge->watermark_image,
-			       NULL);
+	gtk_image_set_from_pixbuf (GTK_IMAGE (druid_page_edge->_priv->side_watermark), watermark);
+
+	if (watermark)
+		width = gdk_pixbuf_get_width (watermark);
+
+	gtk_widget_set_size_request (druid_page_edge->_priv->side_watermark,
+				     width ? -1 : DRUID_PAGE_LEFT_WIDTH, -1);
 }
 
 /**
@@ -723,7 +581,6 @@
 gnome_druid_page_edge_set_top_watermark (GnomeDruidPageEdge *druid_page_edge,
 					 GdkPixbuf *top_watermark_image)
 {
-	g_return_if_fail (druid_page_edge != NULL);
 	g_return_if_fail (GNOME_IS_DRUID_PAGE_EDGE (druid_page_edge));
 
 	if (druid_page_edge->top_watermark_image)
@@ -732,7 +589,21 @@
 	druid_page_edge->top_watermark_image = top_watermark_image;
 	if (top_watermark_image != NULL)
 		g_object_ref (G_OBJECT (top_watermark_image));
-	gnome_canvas_item_set (druid_page_edge->_priv->top_watermark_item,
-			       "pixbuf", druid_page_edge->top_watermark_image,
-			       NULL);
+	gtk_image_set_from_pixbuf (GTK_IMAGE (druid_page_edge->_priv->top_watermark), 
+				   top_watermark_image);
+}
+
+static void
+gnome_druid_page_edge_style_set (GtkWidget *widget,
+				  GtkStyle *old_style)
+{
+	GNOME_CALL_PARENT (GTK_WIDGET_CLASS, style_set, (widget, old_style));
+	gnome_druid_page_edge_set_color (GNOME_DRUID_PAGE_EDGE (widget));
+}
+
+static void
+gnome_druid_page_edge_realize (GtkWidget *widget)
+{
+	GNOME_CALL_PARENT (GTK_WIDGET_CLASS, realize, (widget));
+	gnome_druid_page_edge_set_color (GNOME_DRUID_PAGE_EDGE (widget));
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]