[gtk+/gtk-style-context: 507/533] Make tests compile without using GtkStyle api
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-style-context: 507/533] Make tests compile without using GtkStyle api
- Date: Wed, 1 Dec 2010 02:48:28 +0000 (UTC)
commit 0560b7a1bf0438d33ba833b4979e216908b3fa9c
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Nov 25 12:49:16 2010 -0500
Make tests compile without using GtkStyle api
tests/testcalendar.c | 27 +++++------
tests/testcombochange.c | 27 ++++++----
tests/testexpand.c | 20 ++++----
tests/testframe.c | 84 +++++++++++++++++++++++++--------
tests/testgrid.c | 6 +-
tests/testgtk.c | 119 +++++++++++++++++++++++++++++++----------------
tests/testtooltips.c | 4 +-
tests/testwindows.c | 5 +-
8 files changed, 189 insertions(+), 103 deletions(-)
---
diff --git a/tests/testcalendar.c b/tests/testcalendar.c
index 1960c5e..a029276 100644
--- a/tests/testcalendar.c
+++ b/tests/testcalendar.c
@@ -243,18 +243,15 @@ void calendar_select_font (GtkWidget *button,
CalendarData *calendar)
{
const char *font = NULL;
- GtkRcStyle *style;
+ PangoFontDescription *font_desc;
if (calendar->window)
- font = gtk_font_button_get_font_name (GTK_FONT_BUTTON (button));
-
- if (font)
- {
- style = gtk_rc_style_new ();
- pango_font_description_free (style->font_desc);
- style->font_desc = pango_font_description_from_string (font);
- gtk_widget_modify_style (calendar->window, style);
- }
+ {
+ font = gtk_font_button_get_font_name (GTK_FONT_BUTTON (button));
+ font_desc = pango_font_description_from_string (font);
+ gtk_widget_override_font (calendar->window, font_desc);
+ pango_font_description_free (font_desc);
+ }
}
static gchar*
@@ -399,7 +396,8 @@ create_calendar(void)
GtkWidget *frame, *label, *bbox, *align, *details;
GtkSizeGroup *size;
- GtkStyle *style;
+ GtkStyleContext *context;
+ PangoFontDescription *font_desc;
gchar *font;
gint i;
@@ -478,10 +476,11 @@ create_calendar(void)
gtk_box_pack_start (GTK_BOX (rpane), frame, FALSE, TRUE, 0);
size = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
- gtk_widget_ensure_style (calendar);
- style = gtk_widget_get_style (calendar);
- font = pango_font_description_to_string (style->font_desc);
+ context = gtk_widget_get_style_context (calendar);
+ gtk_style_context_get (context, 0, "font", &font_desc, NULL);
+ font = pango_font_description_to_string (font_desc);
button = gtk_font_button_new_with_font (font);
+ pango_font_description_free (font_desc);
g_free (font);
g_signal_connect (button, "font-set",
diff --git a/tests/testcombochange.c b/tests/testcombochange.c
index c9da758..042c4bf 100644
--- a/tests/testcombochange.c
+++ b/tests/testcombochange.c
@@ -94,16 +94,9 @@ create_combo (const char *name,
{
GtkCellRenderer *cell_renderer;
GtkWidget *combo;
- char *rc_string;
-
- rc_string = g_strdup_printf ("style \"%s-style\" {\n"
- " GtkComboBox::appears-as-list = %d\n"
- "}\n"
- "\n"
- "widget \"*.%s\" style \"%s-style\"",
- name, is_list, name, name);
- gtk_rc_parse_string (rc_string);
- g_free (rc_string);
+ GtkCssProvider *provider;
+ GtkStyleContext *context;
+ gchar *css_data;
combo = gtk_combo_box_new_with_model (GTK_TREE_MODEL (model));
cell_renderer = gtk_cell_renderer_text_new ();
@@ -112,7 +105,19 @@ create_combo (const char *name,
"text", 0, NULL);
gtk_widget_set_name (combo, name);
-
+
+ context = gtk_widget_get_style_context (combo);
+
+ provider = gtk_css_provider_new ();
+ css_data = g_strdup_printf ("#%s { -GtkComboBox-appears-as-list: %s }",
+ name, is_list ? "true" : "false");
+ gtk_css_provider_load_from_data (provider, css_data, -1, NULL);
+ g_free (css_data);
+
+ gtk_style_context_add_provider (context,
+ GTK_STYLE_PROVIDER (provider),
+ GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+
return combo;
}
diff --git a/tests/testexpand.c b/tests/testexpand.c
index 937b811..e7f0d99 100644
--- a/tests/testexpand.c
+++ b/tests/testexpand.c
@@ -58,7 +58,7 @@ create_box_window (void)
GtkWidget *toggle;
GtkWidget *alignment;
GtkWidget *colorbox;
- GdkColor red, blue;
+ GdkRGBA red, blue;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "Boxes");
@@ -94,11 +94,11 @@ create_box_window (void)
gtk_label_new ("VBox 3 Bottom"),
FALSE, FALSE, 0);
- gdk_color_parse ("red", &red);
- gdk_color_parse ("blue", &blue);
+ gdk_rgba_parse (&red, "red");
+ gdk_rgba_parse (&blue, "blue");
colorbox = gtk_event_box_new ();
- gtk_widget_modify_bg (colorbox, GTK_STATE_NORMAL, &red);
+ gtk_widget_override_background_color (colorbox, 0, &red);
alignment = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 5, 5, 5, 5);
@@ -114,7 +114,7 @@ create_box_window (void)
FALSE, TRUE, 0);
colorbox = gtk_event_box_new ();
- gtk_widget_modify_bg (colorbox, GTK_STATE_NORMAL, &blue);
+ gtk_widget_override_background_color (colorbox, 0, &blue);
alignment = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 5, 5, 5, 5);
@@ -140,7 +140,7 @@ create_table_window (void)
GtkWidget *toggle;
GtkWidget *alignment;
GtkWidget *colorbox;
- GdkColor red, blue;
+ GdkRGBA red, blue;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "Table");
@@ -164,11 +164,11 @@ create_table_window (void)
2, 3, 1, 3,
GTK_FILL, GTK_FILL, 0, 0);
- gdk_color_parse ("red", &red);
- gdk_color_parse ("blue", &blue);
+ gdk_rgba_parse (&red, "red");
+ gdk_rgba_parse (&blue, "blue");
colorbox = gtk_event_box_new ();
- gtk_widget_modify_bg (colorbox, GTK_STATE_NORMAL, &red);
+ gtk_widget_override_background_color (colorbox, GTK_STATE_NORMAL, &red);
alignment = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 5, 5, 5, 5);
@@ -185,7 +185,7 @@ create_table_window (void)
GTK_FILL, GTK_FILL, 0, 0);
colorbox = gtk_event_box_new ();
- gtk_widget_modify_bg (colorbox, GTK_STATE_NORMAL, &blue);
+ gtk_widget_override_background_color (colorbox, 0, &blue);
alignment = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 5, 5, 5, 5);
diff --git a/tests/testframe.c b/tests/testframe.c
index 1ab6e29..0070f5a 100644
--- a/tests/testframe.c
+++ b/tests/testframe.c
@@ -24,28 +24,68 @@ static void
spin_ythickness_cb (GtkSpinButton *spin, gpointer user_data)
{
GtkWidget *frame = user_data;
- GtkRcStyle *rcstyle;
-
- rcstyle = gtk_rc_style_new ();
- rcstyle->xthickness = gtk_widget_get_style (frame)->xthickness;
- rcstyle->ythickness = gtk_spin_button_get_value (spin);
- gtk_widget_modify_style (frame, rcstyle);
-
- g_object_unref (rcstyle);
+ GtkCssProvider *provider;
+ GtkStyleContext *context;
+ gchar *data;
+ GtkBorder *pad;
+
+ context = gtk_widget_get_style_context (frame);
+ provider = g_object_get_data (G_OBJECT (frame), "provider");
+ if (provider == NULL)
+ {
+ provider = gtk_css_provider_new ();
+ g_object_set_data (G_OBJECT (frame), "provider", provider);
+ gtk_style_context_add_provider (context,
+ GTK_STYLE_PROVIDER (provider),
+ GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+ }
+
+ gtk_style_context_get (context, 0, "padding", &pad, NULL);
+
+ data = g_strdup_printf ("GtkFrame { padding: %d %d }",
+ pad->top,
+ (gint)gtk_spin_button_get_value (spin));
+
+ gtk_css_provider_load_from_data (provider, data, -1, NULL);
+ g_free (data);
+ gtk_border_free (pad);
+
+ gtk_style_context_invalidate (context);
+ gtk_widget_queue_resize (frame);
}
static void
spin_xthickness_cb (GtkSpinButton *spin, gpointer user_data)
{
GtkWidget *frame = user_data;
- GtkRcStyle *rcstyle;
-
- rcstyle = gtk_rc_style_new ();
- rcstyle->xthickness = gtk_spin_button_get_value (spin);
- rcstyle->ythickness = gtk_widget_get_style (frame)->ythickness;
- gtk_widget_modify_style (frame, rcstyle);
-
- g_object_unref (rcstyle);
+ GtkCssProvider *provider;
+ GtkStyleContext *context;
+ gchar *data;
+ GtkBorder *pad;
+
+ context = gtk_widget_get_style_context (frame);
+ provider = g_object_get_data (G_OBJECT (frame), "provider");
+ if (provider == NULL)
+ {
+ provider = gtk_css_provider_new ();
+ g_object_set_data (G_OBJECT (frame), "provider", provider);
+ gtk_style_context_add_provider (context,
+ GTK_STYLE_PROVIDER (provider),
+ GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+ }
+
+ gtk_style_context_get (context, 0, "padding", &pad, NULL);
+
+ data = g_strdup_printf ("GtkFrame { padding: %d %d }",
+ (gint)gtk_spin_button_get_value (spin),
+ pad->left);
+
+ gtk_css_provider_load_from_data (provider, data, -1, NULL);
+ g_free (data);
+ gtk_border_free (pad);
+
+ gtk_style_context_invalidate (context);
+ gtk_widget_queue_resize (frame);
}
/* Function to normalize rounding errors in FP arithmetic to
@@ -88,7 +128,8 @@ spin_yalign_cb (GtkSpinButton *spin, GtkFrame *frame)
int main (int argc, char **argv)
{
- GtkStyle *style;
+ GtkStyleContext *context;
+ GtkBorder *pad;
GtkWidget *window, *frame, *xthickness_spin, *ythickness_spin, *vbox;
GtkWidget *xalign_spin, *yalign_spin, *button, *table, *label;
gfloat xalign, yalign;
@@ -113,7 +154,8 @@ int main (int argc, char **argv)
table = gtk_table_new (4, 2, FALSE);
gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
- style = gtk_widget_get_style (frame);
+ context = gtk_widget_get_style_context (frame);
+ gtk_style_context_get (context, 0, "padding", &pad, NULL);
/* Spin to control xthickness */
label = gtk_label_new ("xthickness: ");
@@ -121,7 +163,7 @@ int main (int argc, char **argv)
xthickness_spin = gtk_spin_button_new_with_range (0, 250, 1);
g_signal_connect (G_OBJECT (xthickness_spin), "value-changed", G_CALLBACK (spin_xthickness_cb), frame);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (xthickness_spin), style->xthickness);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (xthickness_spin), pad->left);
gtk_table_attach_defaults (GTK_TABLE (table), xthickness_spin, 1, 2, 0, 1);
/* Spin to control ythickness */
@@ -130,9 +172,11 @@ int main (int argc, char **argv)
ythickness_spin = gtk_spin_button_new_with_range (0, 250, 1);
g_signal_connect (G_OBJECT (ythickness_spin), "value-changed", G_CALLBACK (spin_ythickness_cb), frame);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (ythickness_spin), style->ythickness);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (ythickness_spin), pad->top);
gtk_table_attach_defaults (GTK_TABLE (table), ythickness_spin, 1, 2, 1, 2);
+ gtk_border_free (pad);
+
gtk_frame_get_label_align (GTK_FRAME (frame), &xalign, &yalign);
/* Spin to control label xalign */
diff --git a/tests/testgrid.c b/tests/testgrid.c
index d576848..9c1b38a 100644
--- a/tests/testgrid.c
+++ b/tests/testgrid.c
@@ -5,13 +5,13 @@ oriented_test_widget (const gchar *label, const gchar *color, gdouble angle)
{
GtkWidget *box;
GtkWidget *widget;
- GdkColor c;
+ GdkRGBA c;
widget = gtk_label_new (label);
gtk_label_set_angle (GTK_LABEL (widget), angle);
box = gtk_event_box_new ();
- gdk_color_parse (color, &c);
- gtk_widget_modify_bg (box, GTK_STATE_NORMAL, &c);
+ gdk_rgba_parse (color, &c);
+ gtk_widget_override_background_color (box, 0, &c);
gtk_container_add (GTK_CONTAINER (box), widget);
return box;
diff --git a/tests/testgtk.c b/tests/testgtk.c
index 29f5dc4..ddd5d90 100644
--- a/tests/testgtk.c
+++ b/tests/testgtk.c
@@ -399,7 +399,7 @@ create_composited_window (GtkWidget *widget)
if (!window)
{
GtkWidget *event, *button;
- GdkColor red;
+ GdkRGBA red;
/* make the widgets */
button = gtk_button_new_with_label ("A Button");
@@ -411,8 +411,8 @@ create_composited_window (GtkWidget *widget)
&window);
/* put a red background on the window */
- gdk_color_parse ("red", &red);
- gtk_widget_modify_bg (window, GTK_STATE_NORMAL, &red);
+ gdk_rgba_parse ("red", &red);
+ gtk_widget_override_background_color (window, 0, &red);
/* set our event box to have a fully-transparent background
* drawn on it. currently there is no way to simply tell gtk
@@ -1202,8 +1202,7 @@ create_button_box (GtkWidget *widget)
static GtkWidget*
new_pixbuf (char *filename,
- GdkWindow *window,
- GdkColor *background)
+ GdkWindow *window)
{
GtkWidget *widget;
GdkPixbuf *pixbuf;
@@ -1379,8 +1378,7 @@ create_toolbar (GtkWidget *widget)
{
GtkWidget *icon;
- icon = new_pixbuf ("test.xpm", gtk_widget_get_window (window),
- >k_widget_get_style (window)->bg[GTK_STATE_NORMAL]);
+ icon = new_pixbuf ("test.xpm", gtk_widget_get_window (window));
toolitem = gtk_tool_button_new (icon, create_toolbar_items[i].label);
}
if (create_toolbar_items[i].callback)
@@ -1450,8 +1448,7 @@ make_toolbar (GtkWidget *window)
toolitem = gtk_separator_tool_item_new ();
continue;
}
- icon = new_pixbuf ("test.xpm", gtk_widget_get_window (window),
- >k_widget_get_style (window)->bg[GTK_STATE_NORMAL]);
+ icon = new_pixbuf ("test.xpm", gtk_widget_get_window (window));
toolitem = gtk_tool_button_new (icon, make_toolbar_items[i].label);
gtk_tool_item_set_tooltip_text (toolitem, make_toolbar_items[i].tooltip);
if (make_toolbar_items[i].callback != NULL)
@@ -2200,7 +2197,7 @@ create_rotated_text (GtkWidget *widget)
if (!window)
{
- const GdkColor white = { 0, 0xffff, 0xffff, 0xffff };
+ const GdkRGBA white = { 1.0, 1.0, 1.0, 1.0 };
GtkRequisition requisition;
GtkWidget *content_area;
GtkWidget *drawing_area;
@@ -2225,7 +2222,7 @@ create_rotated_text (GtkWidget *widget)
drawing_area = gtk_drawing_area_new ();
gtk_box_pack_start (GTK_BOX (content_area), drawing_area, TRUE, TRUE, 0);
- gtk_widget_modify_bg (drawing_area, GTK_STATE_NORMAL, &white);
+ gtk_widget_override_background_color (drawing_area, 0, &white);
tile_pixbuf = gdk_pixbuf_new_from_file ("marble.xpm", NULL);
@@ -2400,15 +2397,47 @@ grippy_button_press (GtkWidget *area, GdkEventButton *event, GdkWindowEdge edge)
static gboolean
grippy_draw (GtkWidget *area, cairo_t *cr, GdkWindowEdge edge)
{
- gtk_paint_resize_grip (gtk_widget_get_style (area),
- cr,
- gtk_widget_get_state (area),
- area,
- "statusbar",
- edge,
- 0, 0,
- gtk_widget_get_allocated_width (area),
- gtk_widget_get_allocated_height (area));
+ GtkStyleContext *context;
+ GtkJunctionSides sides;
+
+ switch (edge)
+ {
+ case GDK_WINDOW_EDGE_NORTH_WEST:
+ sides = GTK_JUNCTION_CORNER_TOPLEFT;
+ break;
+ case GDK_WINDOW_EDGE_NORTH:
+ sides = GTK_JUNCTION_TOP;
+ break;
+ case GDK_WINDOW_EDGE_NORTH_EAST:
+ sides = GTK_JUNCTION_CORNER_TOPRIGHT;
+ break;
+ case GDK_WINDOW_EDGE_WEST:
+ sides = GTK_JUNCTION_LEFT;
+ break;
+ case GDK_WINDOW_EDGE_EAST:
+ sides = GTK_JUNCTION_RIGHT;
+ break;
+ case GDK_WINDOW_EDGE_SOUTH_WEST:
+ sides = GTK_JUNCTION_CORNER_BOTTOMLEFT;
+ break;
+ case GDK_WINDOW_EDGE_SOUTH:
+ sides = GTK_JUNCTION_BOTTOM;
+ break;
+ case GDK_WINDOW_EDGE_SOUTH_EAST:
+ sides = GTK_JUNCTION_CORNER_BOTTOMRIGHT;
+ break;
+ }
+
+ context = gtk_widget_get_style_context (area);
+ gtk_style_context_save (context);
+ gtk_style_context_add_class (context, "grip");
+ gtk_style_context_set_junction_sides (context, sides);
+ gtk_render_handle (context, cr,
+ 0, 0,
+ gtk_widget_get_allocated_width (area),
+ gtk_widget_get_allocated_height (area));
+
+ gtk_style_context_restore (context);
return TRUE;
}
@@ -2708,7 +2737,7 @@ create_pixbuf (GtkWidget *widget)
gdk_window = gtk_widget_get_window (window);
- pixbufwid = new_pixbuf ("test.xpm", gdk_window, NULL);
+ pixbufwid = new_pixbuf ("test.xpm", gdk_window);
label = gtk_label_new ("Pixbuf\ntest");
box3 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
@@ -2720,7 +2749,7 @@ create_pixbuf (GtkWidget *widget)
button = gtk_button_new ();
gtk_box_pack_start (GTK_BOX (box2), button, FALSE, FALSE, 0);
- pixbufwid = new_pixbuf ("test.xpm", gdk_window, NULL);
+ pixbufwid = new_pixbuf ("test.xpm", gdk_window);
label = gtk_label_new ("Pixbuf\ntest");
box3 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
@@ -4148,13 +4177,14 @@ create_event_box (GtkWidget *widget)
GtkWidget *label;
GtkWidget *visible_window_check;
GtkWidget *above_child_check;
- GdkColor color;
+ GdkRGBA color;
if (!window)
{
color.red = 0;
- color.blue = 65535;
+ color.blue = 1;
color.green = 0;
+ color.alpha = 1;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_screen (GTK_WINDOW (window),
@@ -4169,7 +4199,7 @@ create_event_box (GtkWidget *widget)
box1 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add (GTK_CONTAINER (window), box1);
- gtk_widget_modify_bg (window, GTK_STATE_NORMAL, &color);
+ gtk_widget_override_background_color (window, 0, &color);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_box_pack_start (GTK_BOX (box1), hbox, TRUE, FALSE, 0);
@@ -4796,6 +4826,8 @@ cursor_draw (GtkWidget *widget,
gpointer user_data)
{
int width, height;
+ GtkStyleContext *context;
+ GdkRGBA *bg;
width = gtk_widget_get_allocated_width (widget);
height = gtk_widget_get_allocated_height (widget);
@@ -4808,7 +4840,10 @@ cursor_draw (GtkWidget *widget,
cairo_rectangle (cr, 0, height / 2, width, height / 2);
cairo_fill (cr);
- gdk_cairo_set_source_color (cr, >k_widget_get_style (widget)->bg[GTK_STATE_NORMAL]);
+ context = gtk_widget_get_style_context (widget);
+ gtk_style_context_get (context, 0, "background-color", &bg, NULL);
+ gdk_cairo_set_source_rgba (cr, bg);
+ gdk_rgba_free (bg);
cairo_rectangle (cr, width / 3, height / 3, width / 3, height / 3);
cairo_fill (cr);
@@ -9546,8 +9581,9 @@ create_rc_file (GtkWidget *widget)
gtk_container_set_border_width (GTK_CONTAINER (window), 0);
button = gtk_button_new_with_label ("Reload");
- g_signal_connect (button, "clicked",
- G_CALLBACK (gtk_rc_reparse_all), NULL);
+ g_signal_connect_swapped (button, "clicked",
+ G_CALLBACK (gtk_style_context_reset_widgets),
+ gtk_widget_get_screen (button));
gtk_widget_set_can_default (button, TRUE);
gtk_box_pack_start (GTK_BOX (action_area), button, TRUE, TRUE, 0);
gtk_widget_grab_default (button);
@@ -9760,6 +9796,8 @@ void create_layout (GtkWidget *widget)
gtk_widget_destroy (window);
}
+#if 0
+/* FIXME: need to completely redo this for GtkStyleContext */
void
create_styles (GtkWidget *widget)
{
@@ -9769,11 +9807,11 @@ create_styles (GtkWidget *widget)
GtkWidget *button;
GtkWidget *entry;
GtkWidget *vbox;
- static GdkColor red = { 0, 0xffff, 0, 0 };
- static GdkColor green = { 0, 0, 0xffff, 0 };
- static GdkColor blue = { 0, 0, 0, 0xffff };
- static GdkColor yellow = { 0, 0xffff, 0xffff, 0 };
- static GdkColor cyan = { 0, 0 , 0xffff, 0xffff };
+ static GdkRGBA red = { 1,0,0,1 };
+ static GdkRGBA green = { 0,1,0,1 };
+ static GdkRGBA blue = { 0,0,1,1 };
+ static GdkRGBA yellow = { 1,1,0,1 };
+ static GdkRGBA cyan = { 0,1,1,1 };
PangoFontDescription *font_desc;
GtkRcStyle *rc_style;
@@ -9810,8 +9848,7 @@ create_styles (GtkWidget *widget)
font_desc = pango_font_description_from_string ("Helvetica,Sans Oblique 18");
button = gtk_button_new_with_label ("Some Text");
- gtk_widget_modify_font (gtk_bin_get_child (GTK_BIN (button)),
- font_desc);
+ gtk_widget_override_font (gtk_bin_get_child (GTK_BIN (button)), font_desc);
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
label = gtk_label_new ("Foreground:");
@@ -9819,8 +9856,7 @@ create_styles (GtkWidget *widget)
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
button = gtk_button_new_with_label ("Some Text");
- gtk_widget_modify_fg (gtk_bin_get_child (GTK_BIN (button)),
- GTK_STATE_NORMAL, &red);
+ gtk_widget_override_color (gtk_bin_get_child (GTK_BIN (button)), 0, &red);
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
label = gtk_label_new ("Background:");
@@ -9828,7 +9864,7 @@ create_styles (GtkWidget *widget)
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
button = gtk_button_new_with_label ("Some Text");
- gtk_widget_modify_bg (button, GTK_STATE_NORMAL, &green);
+ gtk_widget_override_background_color (button, 0, &green);
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
label = gtk_label_new ("Text:");
@@ -9837,7 +9873,7 @@ create_styles (GtkWidget *widget)
entry = gtk_entry_new ();
gtk_entry_set_text (GTK_ENTRY (entry), "Some Text");
- gtk_widget_modify_text (entry, GTK_STATE_NORMAL, &blue);
+ gtk_widget_override_color (entry, 0, &blue);
gtk_box_pack_start (GTK_BOX (vbox), entry, FALSE, FALSE, 0);
label = gtk_label_new ("Base:");
@@ -9846,7 +9882,7 @@ create_styles (GtkWidget *widget)
entry = gtk_entry_new ();
gtk_entry_set_text (GTK_ENTRY (entry), "Some Text");
- gtk_widget_modify_base (entry, GTK_STATE_NORMAL, &yellow);
+ gtk_widget_override_background_color (entry, 0, &yellow);
gtk_box_pack_start (GTK_BOX (vbox), entry, FALSE, FALSE, 0);
label = gtk_label_new ("Cursor:");
@@ -9892,6 +9928,7 @@ create_styles (GtkWidget *widget)
else
gtk_widget_destroy (window);
}
+#endif
/*
* Main Window and Exit
@@ -9955,7 +9992,9 @@ struct {
{ "snapshot", create_snapshot },
{ "spinbutton", create_spins },
{ "statusbar", create_statusbar },
+#if 0
{ "styles", create_styles },
+#endif
{ "test idle", create_idle_test },
{ "test mainloop", create_mainloop, TRUE },
{ "test scrolling", create_scroll_test },
diff --git a/tests/testtooltips.c b/tests/testtooltips.c
index 9cb1fcc..54c2e05 100644
--- a/tests/testtooltips.c
+++ b/tests/testtooltips.c
@@ -46,10 +46,10 @@ query_tooltip_custom_cb (GtkWidget *widget,
GtkTooltip *tooltip,
gpointer data)
{
- GdkColor color = { 0, 0, 65535 };
+ GdkRGBA color = { 0, 0, 1, 1 };
GtkWindow *window = gtk_widget_get_tooltip_window (widget);
- gtk_widget_modify_bg (GTK_WIDGET (window), GTK_STATE_NORMAL, &color);
+ gtk_widget_override_background_color (GTK_WIDGET (window), 0, &color);
return TRUE;
}
diff --git a/tests/testwindows.c b/tests/testwindows.c
index e3e9ab2..82aa57e 100644
--- a/tests/testwindows.c
+++ b/tests/testwindows.c
@@ -788,7 +788,7 @@ main (int argc, char **argv)
GtkWidget *button, *scrolled, *table;
GtkTreeViewColumn *column;
GtkCellRenderer *renderer;
- GdkColor black = {0};
+ GdkRGBA black = {0,0,0,1};
GFile *file;
gtk_init (&argc, &argv);
@@ -821,8 +821,7 @@ main (int argc, char **argv)
gtk_container_add (GTK_CONTAINER (frame), darea);
gtk_widget_realize (darea);
gtk_widget_show (darea);
- gtk_widget_modify_bg (darea, GTK_STATE_NORMAL,
- &black);
+ gtk_widget_override_background_color (darea, 0, &black);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]