[gedit] Initial port to GtkStyleContext.
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit] Initial port to GtkStyleContext.
- Date: Sat, 4 Dec 2010 16:44:18 +0000 (UTC)
commit e5157f6097348ec68bf4730b51361fec276398c4
Author: Ignacio Casal Quinteiro <icq gnome org>
Date: Sat Dec 4 17:23:44 2010 +0100
Initial port to GtkStyleContext.
gedit/gedit-overlay.c | 7 ++++---
gedit/gedit-rounded-frame.c | 17 +++++++++--------
gedit/gedit-view.c | 2 +-
gedit/theatrics/gedit-theatrics-animated-widget.c | 9 ++++-----
4 files changed, 18 insertions(+), 17 deletions(-)
---
diff --git a/gedit/gedit-overlay.c b/gedit/gedit-overlay.c
index 98e2695..666210d 100644
--- a/gedit/gedit-overlay.c
+++ b/gedit/gedit-overlay.c
@@ -263,6 +263,7 @@ gedit_overlay_realize (GtkWidget *widget)
GdkWindow *window;
GdkWindowAttr attributes;
gint attributes_mask;
+ GtkStyleContext *context;
gtk_widget_set_realized (widget, TRUE);
@@ -285,9 +286,9 @@ gedit_overlay_realize (GtkWidget *widget)
gtk_widget_set_window (widget, window);
gdk_window_set_user_data (window, widget);
- gtk_widget_style_attach (widget);
- gtk_style_set_background (gtk_widget_get_style (widget), window,
- GTK_STATE_NORMAL);
+ context = gtk_widget_get_style_context (widget);
+ gtk_style_context_set_state (context, 0);
+ gtk_style_context_set_background (context, window);
}
static void
diff --git a/gedit/gedit-rounded-frame.c b/gedit/gedit-rounded-frame.c
index 540cc7c..06bb30b 100644
--- a/gedit/gedit-rounded-frame.c
+++ b/gedit/gedit-rounded-frame.c
@@ -138,9 +138,9 @@ draw_frame (GeditRoundedFrame *frame,
cairo_t *cr,
GdkRectangle *area)
{
- GtkStyle *style;
- GdkColor bg_color;
- GdkColor border_color;
+ GtkStyleContext *context;
+ GdkRGBA bg_color;
+ GdkRGBA border_color;
gedit_theatrics_utils_draw_round_rectangle (cr,
FALSE,
@@ -153,14 +153,15 @@ draw_frame (GeditRoundedFrame *frame,
area->width,
area->height);
- style = gtk_widget_get_style (GTK_WIDGET (frame));
- bg_color = style->bg[GTK_STATE_NORMAL];
- border_color = style->dark[GTK_STATE_ACTIVE];
+ context = gtk_widget_get_style_context (GTK_WIDGET (frame));
+ gtk_style_context_get_background_color (context, 0, &bg_color);
+ gtk_style_context_get_border_color (context, GTK_STATE_FLAG_ACTIVE,
+ &border_color);
- gdk_cairo_set_source_color (cr, &bg_color);
+ gdk_cairo_set_source_rgba (cr, &bg_color);
cairo_fill_preserve (cr);
- gdk_cairo_set_source_color (cr, &border_color);
+ gdk_cairo_set_source_rgba (cr, &border_color);
cairo_set_line_width (cr, frame->priv->frame_width / 2);
cairo_stroke (cr);
}
diff --git a/gedit/gedit-view.c b/gedit/gedit-view.c
index a8b8cb9..962db1a 100644
--- a/gedit/gedit-view.c
+++ b/gedit/gedit-view.c
@@ -707,7 +707,7 @@ gedit_view_set_font (GeditView *view,
g_return_if_fail (font_desc != NULL);
- gtk_widget_modify_font (GTK_WIDGET (view), font_desc);
+ gtk_widget_override_font (GTK_WIDGET (view), font_desc);
pango_font_description_free (font_desc);
}
diff --git a/gedit/theatrics/gedit-theatrics-animated-widget.c b/gedit/theatrics/gedit-theatrics-animated-widget.c
index 0f3c13d..2dece3c 100644
--- a/gedit/theatrics/gedit-theatrics-animated-widget.c
+++ b/gedit/theatrics/gedit-theatrics-animated-widget.c
@@ -203,12 +203,12 @@ gedit_theatrics_animated_widget_realize (GtkWidget *widget)
GdkWindowAttr attributes;
GdkWindow *parent_window;
GdkWindow *window;
- GtkStyle *style;
+ GtkStyleContext *context;
gtk_widget_set_realized (widget, TRUE);
parent_window = gtk_widget_get_parent_window (widget);
- style = gtk_widget_get_style (widget);
+ context = gtk_widget_get_style_context (widget);
attributes.window_type = GDK_WINDOW_CHILD;
attributes.wclass = GDK_INPUT_OUTPUT;
@@ -217,9 +217,8 @@ gedit_theatrics_animated_widget_realize (GtkWidget *widget)
window = gdk_window_new (parent_window, &attributes, 0);
gdk_window_set_user_data (window, widget);
gtk_widget_set_window (widget, window);
- style = gtk_style_attach (style, window);
- gtk_widget_set_style (widget, style);
- gtk_style_set_background (style, window, GTK_STATE_NORMAL);
+ gtk_style_context_set_state (context, 0);
+ gtk_style_context_set_background (context, window);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]