+static void
+set_bg_color (GtkCellRendererText *celltext,
+ GdkColor *color)
+{
+ if (color)
+ {
+ if (!celltext->background_set)
+ {
+ celltext->background_set = TRUE;
+ g_object_notify (G_OBJECT (celltext), "background_set");
+ }
+
+ celltext->background.red = color->red;
+ celltext->background.green = color->green;
+ celltext->background.blue = color->blue;
+ }
+ else
+ {
+ if (celltext->background_set)
+ {
+ celltext->background_set = FALSE;
+ g_object_notify (G_OBJECT (celltext), "background_set");
+ }
+ }
+}
+
+
+static void
+set_fg_color (GtkCellRendererText *celltext,
+ GdkColor *color)
+{
+ if (color)
+ {
+ if (!celltext->foreground_set)
+ {
+ celltext->foreground_set = TRUE;
+ g_object_notify (G_OBJECT (celltext), "foreground_set");
+ }
+
+ celltext->foreground.red = color->red;
+ celltext->foreground.green = color->green;
+ celltext->foreground.blue = color->blue;
+ }
+ else
+ {
+ if (celltext->foreground_set)
+ {
+ celltext->foreground_set = FALSE;
+ g_object_notify (G_OBJECT (celltext), "foreground_set");
+ }
+ }
+}
+
+static void
+set_font_description (GtkCellRendererText *celltext,
+ PangoFontDescription *font_desc)
+{
+ if (font_desc != NULL)
+ {
+ /* pango_font_description_from_string() will sometimes return
+ * a NULL family or -1 size, so handle those cases.
+ */
+
+ if (font_desc->family_name)
+ g_object_set (G_OBJECT (celltext),
+ "family", font_desc->family_name,
+ NULL);
+
+ if (font_desc->size >= 0)
+ g_object_set (G_OBJECT (celltext),
+ "size", font_desc->size,
+ NULL);
+
+ g_object_set (G_OBJECT (celltext),
+ "style", font_desc->style,
+ "variant", font_desc->variant,
+ "weight", font_desc->weight,
+ "stretch", font_desc->stretch,
+ NULL);
+ }
+ else
+ {
+ if (celltext->family_set)
+ {
+ celltext->family_set = FALSE;
+ g_object_notify (G_OBJECT (celltext), "family_set");
+ }
+ if (celltext->style_set)
+ {
+ celltext->style_set = FALSE;
+ g_object_notify (G_OBJECT (celltext), "style_set");
+ }
+ if (celltext->variant_set)
+ {
+ celltext->variant_set = FALSE;
+ g_object_notify (G_OBJECT (celltext), "variant_set");
+ }
+ if (celltext->weight_set)
+ {
+ celltext->weight_set = FALSE;
+ g_object_notify (G_OBJECT (celltext), "weight_set");
+ }
+ if (celltext->stretch_set)
+ {
+ celltext->stretch_set = FALSE;
+ g_object_notify (G_OBJECT (celltext), "stretch_set");
+ }
+ if (celltext->size_set)
+ {
+ celltext->size_set = FALSE;
+ g_object_notify (G_OBJECT (celltext), "size_set");
+ }
+ }
+}
+