diff options
author | Timm Bäder <mail@baedert.org> | 2016-10-20 19:51:43 +0200 |
---|---|---|
committer | Timm Bäder <mail@baedert.org> | 2016-10-20 20:12:08 +0200 |
commit | a5867ffe710695fd1a4676336d856548c68ea530 (patch) | |
tree | 8f39749557ffd8d4b159a09921db6c72b28ca438 | |
parent | f65af48d51eabb86955c66c07254d36683e35fba (diff) | |
download | gtk+-a5867ffe710695fd1a4676336d856548c68ea530.tar.gz |
Remove some more GdkColor propertieswip/baedert/box
-rw-r--r-- | gtk/a11y/gtktextviewaccessible.c | 12 | ||||
-rw-r--r-- | gtk/gtkcellrenderertext.c | 108 | ||||
-rw-r--r-- | gtk/gtkcellview.c | 87 | ||||
-rw-r--r-- | gtk/gtkcellview.h | 4 | ||||
-rw-r--r-- | gtk/gtktextattributes.c | 28 | ||||
-rw-r--r-- | gtk/gtktextattributes.h | 3 | ||||
-rw-r--r-- | gtk/gtktextdisplay.c | 27 | ||||
-rw-r--r-- | gtk/gtktextlayout.c | 12 | ||||
-rw-r--r-- | gtk/gtktextlayout.h | 2 | ||||
-rw-r--r-- | gtk/gtktexttag.c | 13 | ||||
-rw-r--r-- | gtk/inspector/prop-editor.c | 59 |
11 files changed, 8 insertions, 347 deletions
diff --git a/gtk/a11y/gtktextviewaccessible.c b/gtk/a11y/gtktextviewaccessible.c index 549439d033..7adcc62d22 100644 --- a/gtk/a11y/gtktextviewaccessible.c +++ b/gtk/a11y/gtktextviewaccessible.c @@ -1341,7 +1341,7 @@ gtk_text_view_accessible_set_run_attributes (AtkEditableText *text, GtkTextIter start; GtkTextIter end; gint j; - GdkColor *color; + GdkRGBA *color; gchar** RGB_vals; GSList *l; @@ -1450,11 +1450,11 @@ gtk_text_view_accessible_set_run_attributes (AtkEditableText *text, else if (!strcmp (name, atk_text_attribute_get_name (ATK_TEXT_ATTR_BG_COLOR))) { RGB_vals = g_strsplit (value, ",", 3); - color = g_malloc (sizeof (GdkColor)); - color->red = atoi (RGB_vals[0]); - color->green = atoi (RGB_vals[1]); - color->blue = atoi (RGB_vals[2]); - g_object_set (G_OBJECT (tag), "background-gdk", color, NULL); + color = g_malloc (sizeof (GdkRGBA)); + color->red = atoi (RGB_vals[0]) / 65535.0; + color->green = atoi (RGB_vals[1]) / 65535.0; + color->blue = atoi (RGB_vals[2]) / 65535.0; + g_object_set (G_OBJECT (tag), "background-rgba", color, NULL); } else if (!strcmp (name, atk_text_attribute_get_name (ATK_TEXT_ATTR_FG_COLOR))) diff --git a/gtk/gtkcellrenderertext.c b/gtk/gtkcellrenderertext.c index 15beed09bf..4070fdae9b 100644 --- a/gtk/gtkcellrenderertext.c +++ b/gtk/gtkcellrenderertext.c @@ -112,8 +112,6 @@ enum { /* Style args */ PROP_BACKGROUND, PROP_FOREGROUND, - PROP_BACKGROUND_GDK, - PROP_FOREGROUND_GDK, PROP_BACKGROUND_RGBA, PROP_FOREGROUND_RGBA, PROP_FONT, @@ -286,22 +284,6 @@ gtk_cell_renderer_text_class_init (GtkCellRendererTextClass *class) GTK_PARAM_WRITABLE); /** - * GtkCellRendererText:background-gdk: - * - * Background color as a #GdkColor - * - * Deprecated: 3.4: Use #GtkCellRendererText:background-rgba instead. - */ -G_GNUC_BEGIN_IGNORE_DEPRECATIONS - text_cell_renderer_props[PROP_BACKGROUND_GDK] = - g_param_spec_boxed ("background-gdk", - P_("Background color"), - P_("Background color as a GdkColor"), - GDK_TYPE_COLOR, - GTK_PARAM_READWRITE | G_PARAM_DEPRECATED); -G_GNUC_END_IGNORE_DEPRECATIONS - - /** * GtkCellRendererText:background-rgba: * * Background color as a #GdkRGBA @@ -322,22 +304,6 @@ G_GNUC_END_IGNORE_DEPRECATIONS GTK_PARAM_WRITABLE); /** - * GtkCellRendererText:foreground-gdk: - * - * Foreground color as a #GdkColor - * - * Deprecated: 3.4: Use #GtkCellRendererText:foreground-rgba instead. - */ -G_GNUC_BEGIN_IGNORE_DEPRECATIONS - text_cell_renderer_props[PROP_FOREGROUND_GDK] = - g_param_spec_boxed ("foreground-gdk", - P_("Foreground color"), - P_("Foreground color as a GdkColor"), - GDK_TYPE_COLOR, - GTK_PARAM_READWRITE | G_PARAM_DEPRECATED); -G_GNUC_END_IGNORE_DEPRECATIONS - - /** * GtkCellRendererText:foreground-rgba: * * Foreground color as a #GdkRGBA @@ -760,30 +726,6 @@ gtk_cell_renderer_text_get_property (GObject *object, g_value_set_boolean (value, priv->single_paragraph); break; - case PROP_BACKGROUND_GDK: - { - GdkColor color; - - color.red = (guint16) (priv->background.red * 65535); - color.green = (guint16) (priv->background.green * 65535); - color.blue = (guint16) (priv->background.blue * 65535); - - g_value_set_boxed (value, &color); - } - break; - - case PROP_FOREGROUND_GDK: - { - GdkColor color; - - color.red = (guint16) (priv->foreground.red * 65535); - color.green = (guint16) (priv->foreground.green * 65535); - color.blue = (guint16) (priv->foreground.blue * 65535); - - g_value_set_boxed (value, &color); - } - break; - case PROP_BACKGROUND_RGBA: g_value_set_boxed (value, &priv->background); break; @@ -1188,8 +1130,6 @@ gtk_cell_renderer_text_set_property (GObject *object, set_bg_color (celltext, &rgba); else g_warning ("Don't know color '%s'", g_value_get_string (value)); - - g_object_notify_by_pspec (object, text_cell_renderer_props[PROP_BACKGROUND_GDK]); } break; @@ -1203,54 +1143,6 @@ gtk_cell_renderer_text_set_property (GObject *object, set_fg_color (celltext, &rgba); else g_warning ("Don't know color '%s'", g_value_get_string (value)); - - g_object_notify_by_pspec (object, text_cell_renderer_props[PROP_FOREGROUND_GDK]); - } - break; - - case PROP_BACKGROUND_GDK: - { - GdkColor *color; - - color = g_value_get_boxed (value); - if (color) - { - GdkRGBA rgba; - - rgba.red = color->red / 65535.; - rgba.green = color->green / 65535.; - rgba.blue = color->blue / 65535.; - rgba.alpha = 1; - - set_bg_color (celltext, &rgba); - } - else - { - set_bg_color (celltext, NULL); - } - } - break; - - case PROP_FOREGROUND_GDK: - { - GdkColor *color; - - color = g_value_get_boxed (value); - if (color) - { - GdkRGBA rgba; - - rgba.red = color->red / 65535.; - rgba.green = color->green / 65535.; - rgba.blue = color->blue / 65535.; - rgba.alpha = 1; - - set_fg_color (celltext, &rgba); - } - else - { - set_fg_color (celltext, NULL); - } } break; diff --git a/gtk/gtkcellview.c b/gtk/gtkcellview.c index a07d84f842..e02b112173 100644 --- a/gtk/gtkcellview.c +++ b/gtk/gtkcellview.c @@ -170,7 +170,6 @@ enum PROP_0, PROP_ORIENTATION, PROP_BACKGROUND, - PROP_BACKGROUND_GDK, PROP_BACKGROUND_RGBA, PROP_BACKGROUND_SET, PROP_MODEL, @@ -220,22 +219,6 @@ gtk_cell_view_class_init (GtkCellViewClass *klass) GTK_PARAM_WRITABLE)); /** - * GtkCellView:background-gdk: - * - * The background color as a #GdkColor - * - * Deprecated: 3.4: Use #GtkCellView:background-rgba instead. - */ -G_GNUC_BEGIN_IGNORE_DEPRECATIONS - g_object_class_install_property (gobject_class, - PROP_BACKGROUND_GDK, - g_param_spec_boxed ("background-gdk", - P_("Background color"), - P_("Background color as a GdkColor"), - GDK_TYPE_COLOR, - GTK_PARAM_READWRITE | G_PARAM_DEPRECATED)); -G_GNUC_END_IGNORE_DEPRECATIONS - /** * GtkCellView:background-rgba: * * The background color as a #GdkRGBA @@ -406,18 +389,6 @@ gtk_cell_view_get_property (GObject *object, case PROP_ORIENTATION: g_value_set_enum (value, view->priv->orientation); break; - case PROP_BACKGROUND_GDK: - { - GdkColor color; - - color.red = (guint) (view->priv->background.red * 65535); - color.green = (guint) (view->priv->background.green * 65535); - color.blue = (guint) (view->priv->background.blue * 65535); - color.pixel = 0; - - g_value_set_boxed (value, &color); - } - break; case PROP_BACKGROUND_RGBA: g_value_set_boxed (value, &view->priv->background); break; @@ -480,22 +451,6 @@ gtk_cell_view_set_property (GObject *object, g_warning ("Don't know color '%s'", g_value_get_string (value)); g_object_notify (object, "background-rgba"); - g_object_notify (object, "background-gdk"); - } - break; - case PROP_BACKGROUND_GDK: - { - GdkColor *color; - GdkRGBA rgba; - - color = g_value_get_boxed (value); - - rgba.red = color->red / 65535.0; - rgba.green = color->green / 65535.0; - rgba.blue = color->blue / 65535.0; - rgba.alpha = 1.0; - - gtk_cell_view_set_background_rgba (view, &rgba); } break; case PROP_BACKGROUND_RGBA: @@ -1389,48 +1344,6 @@ gtk_cell_view_get_size_of_row (GtkCellView *cell_view, } /** - * gtk_cell_view_set_background_color: - * @cell_view: a #GtkCellView - * @color: the new background color - * - * Sets the background color of @view. - * - * Since: 2.6 - * - * Deprecated: 3.4: Use gtk_cell_view_set_background_rgba() instead. - */ -void -gtk_cell_view_set_background_color (GtkCellView *cell_view, - const GdkColor *color) -{ - g_return_if_fail (GTK_IS_CELL_VIEW (cell_view)); - - if (color) - { - if (!cell_view->priv->background_set) - { - cell_view->priv->background_set = TRUE; - g_object_notify (G_OBJECT (cell_view), "background-set"); - } - - cell_view->priv->background.red = color->red / 65535.; - cell_view->priv->background.green = color->green / 65535.; - cell_view->priv->background.blue = color->blue / 65535.; - cell_view->priv->background.alpha = 1; - } - else - { - if (cell_view->priv->background_set) - { - cell_view->priv->background_set = FALSE; - g_object_notify (G_OBJECT (cell_view), "background-set"); - } - } - - gtk_widget_queue_draw (GTK_WIDGET (cell_view)); -} - -/** * gtk_cell_view_set_background_rgba: * @cell_view: a #GtkCellView * @rgba: the new background color diff --git a/gtk/gtkcellview.h b/gtk/gtkcellview.h index af82655545..7a3ff56a44 100644 --- a/gtk/gtkcellview.h +++ b/gtk/gtkcellview.h @@ -107,10 +107,6 @@ GDK_DEPRECATED_IN_3_0_FOR(gtk_widget_get_preferred_size) gboolean gtk_cell_view_get_size_of_row (GtkCellView *cell_view, GtkTreePath *path, GtkRequisition *requisition); -GDK_DEPRECATED_IN_3_4_FOR(gtk_cell_view_set_background_rgba) -void gtk_cell_view_set_background_color (GtkCellView *cell_view, - const GdkColor *color); - G_END_DECLS #endif /* __GTK_CELL_VIEW_H__ */ diff --git a/gtk/gtktextattributes.c b/gtk/gtktextattributes.c index 21a9d05609..8fc9d10bc1 100644 --- a/gtk/gtktextattributes.c +++ b/gtk/gtktextattributes.c @@ -129,11 +129,6 @@ gtk_text_attributes_copy_values (GtkTextAttributes *src, if (dest->font) pango_font_description_free (dest->font); -G_GNUC_BEGIN_IGNORE_DEPRECATIONS - if (dest->pg_bg_color) - gdk_color_free (dest->pg_bg_color); -G_GNUC_END_IGNORE_DEPRECATIONS - if (dest->pg_bg_rgba) gdk_rgba_free (dest->pg_bg_rgba); @@ -159,11 +154,6 @@ G_GNUC_END_IGNORE_DEPRECATIONS if (src->font) dest->font = pango_font_description_copy (src->font); -G_GNUC_BEGIN_IGNORE_DEPRECATIONS - if (src->pg_bg_color) - dest->pg_bg_color = gdk_color_copy (src->pg_bg_color); -G_GNUC_END_IGNORE_DEPRECATIONS - if (src->pg_bg_rgba) dest->pg_bg_rgba = gdk_rgba_copy (src->pg_bg_rgba); @@ -220,11 +210,6 @@ gtk_text_attributes_unref (GtkTextAttributes *values) if (values->font) pango_font_description_free (values->font); -G_GNUC_BEGIN_IGNORE_DEPRECATIONS - if (values->pg_bg_color) - gdk_color_free (values->pg_bg_color); -G_GNUC_END_IGNORE_DEPRECATIONS - if (values->pg_bg_rgba) gdk_rgba_free (values->pg_bg_rgba); @@ -294,21 +279,8 @@ _gtk_text_attributes_fill_from_tags (GtkTextAttributes *dest, dest->pg_bg_rgba = NULL; } - if (dest->pg_bg_color) - { -G_GNUC_BEGIN_IGNORE_DEPRECATIONS - gdk_color_free (dest->pg_bg_color); - dest->pg_bg_color = NULL; -G_GNUC_END_IGNORE_DEPRECATIONS - } - if (vals->pg_bg_rgba) dest->pg_bg_rgba = gdk_rgba_copy (vals->pg_bg_rgba); - -G_GNUC_BEGIN_IGNORE_DEPRECATIONS - if (vals->pg_bg_color) - dest->pg_bg_color = gdk_color_copy (vals->pg_bg_color); -G_GNUC_END_IGNORE_DEPRECATIONS } if (vals->font) diff --git a/gtk/gtktextattributes.h b/gtk/gtktextattributes.h index 77c70f1a63..ac98c1437e 100644 --- a/gtk/gtktextattributes.h +++ b/gtk/gtktextattributes.h @@ -192,9 +192,6 @@ struct _GtkTextAttributes PangoLanguage *language; - /*< private >*/ - GdkColor *pg_bg_color; - /*< public >*/ guint invisible : 1; guint bg_full_height : 1; diff --git a/gtk/gtktextdisplay.c b/gtk/gtktextdisplay.c index eaa42c1932..0945b6ea9f 100644 --- a/gtk/gtktextdisplay.c +++ b/gtk/gtktextdisplay.c @@ -236,31 +236,8 @@ gtk_text_renderer_prepare_run (PangoRenderer *renderer, { if (!text_renderer->error_color) { - GdkColor *color = NULL; - - gtk_style_context_get_style (context, - "error-underline-color", &color, - NULL); - - if (color) - { - GdkRGBA rgba; - - rgba.red = color->red / 65535.; - rgba.green = color->green / 65535.; - rgba.blue = color->blue / 65535.; - rgba.alpha = 1; -G_GNUC_BEGIN_IGNORE_DEPRECATIONS - gdk_color_free (color); -G_GNUC_END_IGNORE_DEPRECATIONS - - text_renderer->error_color = gdk_rgba_copy (&rgba); - } - else - { - static const GdkRGBA red = { 1, 0, 0, 1 }; - text_renderer->error_color = gdk_rgba_copy (&red); - } + static const GdkRGBA red = { 1, 0, 0, 1 }; + text_renderer->error_color = gdk_rgba_copy (&red); } text_renderer_set_rgba (text_renderer, PANGO_RENDER_PART_UNDERLINE, text_renderer->error_color); diff --git a/gtk/gtktextlayout.c b/gtk/gtktextlayout.c index 9bd55829ae..337e15ad19 100644 --- a/gtk/gtktextlayout.c +++ b/gtk/gtktextlayout.c @@ -1426,13 +1426,6 @@ set_para_values (GtkTextLayout *layout, } display->total_width = MAX (layout->screen_width, layout->width) - h_margin - h_padding; -G_GNUC_BEGIN_IGNORE_DEPRECATIONS - if (style->pg_bg_color) - display->pg_bg_color = gdk_color_copy (style->pg_bg_color); - else - display->pg_bg_color = NULL; -G_GNUC_END_IGNORE_DEPRECATIONS - if (style->pg_bg_rgba) display->pg_bg_rgba = gdk_rgba_copy (style->pg_bg_rgba); else @@ -2633,11 +2626,6 @@ gtk_text_layout_free_line_display (GtkTextLayout *layout, if (display->cursors) g_array_free (display->cursors, TRUE); -G_GNUC_BEGIN_IGNORE_DEPRECATIONS - if (display->pg_bg_color) - gdk_color_free (display->pg_bg_color); -G_GNUC_END_IGNORE_DEPRECATIONS - if (display->pg_bg_rgba) gdk_rgba_free (display->pg_bg_rgba); diff --git a/gtk/gtktextlayout.h b/gtk/gtktextlayout.h index ba5318cf21..1b7b82684f 100644 --- a/gtk/gtktextlayout.h +++ b/gtk/gtktextlayout.h @@ -248,8 +248,6 @@ struct _GtkTextLineDisplay gint insert_index; /* Byte index of insert cursor within para or -1 */ GtkTextLine *line; - - GdkColor *pg_bg_color; GdkRectangle block_cursor; guint cursors_invalid : 1; diff --git a/gtk/gtktexttag.c b/gtk/gtktexttag.c index ff1e796781..e710806f0d 100644 --- a/gtk/gtktexttag.c +++ b/gtk/gtktexttag.c @@ -1022,18 +1022,10 @@ set_pg_bg_rgba (GtkTextTag *tag, GdkRGBA *rgba) if (priv->values->pg_bg_rgba) gdk_rgba_free (priv->values->pg_bg_rgba); -G_GNUC_BEGIN_IGNORE_DEPRECATIONS - if (priv->values->pg_bg_color) - gdk_color_free (priv->values->pg_bg_color); -G_GNUC_END_IGNORE_DEPRECATIONS - priv->values->pg_bg_rgba = NULL; - priv->values->pg_bg_color = NULL; if (rgba) { - GdkColor color = { 0, }; - if (!priv->pg_bg_color_set) { priv->pg_bg_color_set = TRUE; @@ -1041,11 +1033,6 @@ G_GNUC_END_IGNORE_DEPRECATIONS } priv->values->pg_bg_rgba = gdk_rgba_copy (rgba); - - copy_rgba_to_gdk_color (rgba, &color); -G_GNUC_BEGIN_IGNORE_DEPRECATIONS - priv->values->pg_bg_color = gdk_color_copy (&color); -G_GNUC_END_IGNORE_DEPRECATIONS } else { diff --git a/gtk/inspector/prop-editor.c b/gtk/inspector/prop-editor.c index 8c32ed6f4e..823efdb9c5 100644 --- a/gtk/inspector/prop-editor.c +++ b/gtk/inspector/prop-editor.c @@ -764,52 +764,6 @@ rgba_changed (GObject *object, GParamSpec *pspec, gpointer data) } static void -color_modified (GtkColorButton *cb, GParamSpec *ignored, ObjectProperty *p) -{ - GdkRGBA rgba; - GdkColor color; - GValue val = G_VALUE_INIT; - - gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (cb), &rgba); - color.red = 65535 * rgba.red; - color.green = 65535 * rgba.green; - color.blue = 65535 * rgba.blue; - - g_value_init (&val, p->spec->value_type); - g_value_set_boxed (&val, &color); - set_property_value (p->obj, p->spec, &val); - g_value_unset (&val); -} - -G_GNUC_BEGIN_IGNORE_DEPRECATIONS -static void -color_changed (GObject *object, GParamSpec *pspec, gpointer data) -{ - GtkColorChooser *cb = GTK_COLOR_CHOOSER (data); - GValue val = G_VALUE_INIT; - GdkColor *color; - GdkRGBA rgba; - - g_value_init (&val, GDK_TYPE_COLOR); - get_property_value (object, pspec, &val); - color = g_value_get_boxed (&val); - rgba.red = color->red / 65535.0; - rgba.green = color->green / 65535.0; - rgba.blue = color->blue / 65535.0; - rgba.alpha = 1.0; - - if (g_value_get_boxed (&val)) - { - block_controller (G_OBJECT (cb)); - gtk_color_chooser_set_rgba (cb, &rgba); - unblock_controller (G_OBJECT (cb)); - } - - g_value_unset (&val); -} -G_GNUC_END_IGNORE_DEPRECATIONS - -static void font_modified (GtkFontChooser *fb, GParamSpec *pspec, ObjectProperty *p) { GValue val = G_VALUE_INIT; @@ -1095,19 +1049,6 @@ property_editor (GObject *object, object, spec, G_CALLBACK (rgba_modified)); } else if (type == G_TYPE_PARAM_BOXED && - G_PARAM_SPEC_VALUE_TYPE (spec) == g_type_from_name ("GdkColor")) - { - prop_edit = gtk_color_chooser_widget_new (); - gtk_color_chooser_set_use_alpha (GTK_COLOR_CHOOSER (prop_edit), FALSE); - - g_object_connect_property (object, spec, - G_CALLBACK (color_changed), - prop_edit, G_OBJECT (prop_edit)); - - connect_controller (G_OBJECT (prop_edit), "notify::rgba", - object, spec, G_CALLBACK (color_modified)); - } - else if (type == G_TYPE_PARAM_BOXED && G_PARAM_SPEC_VALUE_TYPE (spec) == PANGO_TYPE_FONT_DESCRIPTION) { prop_edit = gtk_font_chooser_widget_new (); |