[gimp/gtk3-port: 175/226] app: port GimpTagEntry to GtkStyleContext
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gtk3-port: 175/226] app: port GimpTagEntry to GtkStyleContext
- Date: Sun, 29 Mar 2015 19:24:21 +0000 (UTC)
commit f7199d6cf97ba46ea4644ee8379bda2dbf84de2a
Author: Michael Natterer <mitch gimp org>
Date: Sun Feb 6 13:22:47 2011 +0100
app: port GimpTagEntry to GtkStyleContext
app/widgets/gimptagentry.c | 42 ++++++++++++++++++++++--------------------
1 files changed, 22 insertions(+), 20 deletions(-)
---
diff --git a/app/widgets/gimptagentry.c b/app/widgets/gimptagentry.c
index 3db23b8..5c4d3a1 100644
--- a/app/widgets/gimptagentry.c
+++ b/app/widgets/gimptagentry.c
@@ -1271,15 +1271,16 @@ static gboolean
gimp_tag_entry_draw (GtkWidget *widget,
cairo_t *cr)
{
- GimpTagEntry *tag_entry = GIMP_TAG_ENTRY (widget);
- GdkRectangle text_area;
- PangoLayout *layout;
- PangoAttrList *attr_list;
- PangoAttribute *attribute;
- gint layout_width;
- gint layout_height;
- gint offset;
- const char *display_text;
+ GimpTagEntry *tag_entry = GIMP_TAG_ENTRY (widget);
+ GtkStyleContext *style = gtk_widget_get_style_context (widget);
+ GdkRectangle text_area;
+ PangoLayout *layout;
+ PangoAttrList *attr_list;
+ PangoAttribute *attribute;
+ gint layout_width;
+ gint layout_height;
+ gint offset;
+ const char *display_text;
if (! GIMP_TAG_ENTRY (widget)->description_shown)
return FALSE;
@@ -1307,17 +1308,18 @@ gimp_tag_entry_draw (GtkWidget *widget,
pango_layout_get_pixel_size (layout, &layout_width, &layout_height);
offset = (text_area.height - layout_height) / 2;
- gtk_paint_layout (gtk_widget_get_style (widget),
- cr,
- GTK_STATE_INSENSITIVE,
- TRUE,
- widget,
- NULL,
- (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL) ?
- text_area.width - layout_width - offset :
- text_area.x + offset,
- text_area.y + offset,
- layout);
+ gtk_style_context_save (style);
+
+ gtk_style_context_set_state (style, GTK_STATE_FLAG_INSENSITIVE);
+
+ gtk_render_layout (style, cr,
+ (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL) ?
+ text_area.width - layout_width - offset :
+ text_area.x + offset,
+ text_area.y + offset,
+ layout);
+
+ gtk_style_context_restore (style);
g_object_unref (layout);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]