mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-25 21:21:21 +00:00
cellview: Remove code to modify the background
GtkCellView has a gadget, so peopl can do all their shenanigans with CSS. And the original use case (overriding the background so that the cellview's GdkWindow shares the background color of the combobox) is outdated since we have transparent backgrounds.
This commit is contained in:
parent
087cb3f987
commit
795f38b4cc
@ -3996,7 +3996,6 @@ gtk_cell_view_set_model
|
||||
gtk_cell_view_get_model
|
||||
gtk_cell_view_set_displayed_row
|
||||
gtk_cell_view_get_displayed_row
|
||||
gtk_cell_view_set_background_rgba
|
||||
gtk_cell_view_set_draw_sensitive
|
||||
gtk_cell_view_get_draw_sensitive
|
||||
gtk_cell_view_set_fit_model
|
||||
|
@ -143,14 +143,11 @@ struct _GtkCellViewPrivate
|
||||
|
||||
GtkCssGadget *gadget;
|
||||
|
||||
GdkRGBA background;
|
||||
|
||||
gulong size_changed_id;
|
||||
gulong row_changed_id;
|
||||
|
||||
GtkOrientation orientation;
|
||||
|
||||
guint background_set : 1;
|
||||
guint draw_sensitive : 1;
|
||||
guint fit_model : 1;
|
||||
};
|
||||
@ -161,9 +158,6 @@ enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_ORIENTATION,
|
||||
PROP_BACKGROUND,
|
||||
PROP_BACKGROUND_RGBA,
|
||||
PROP_BACKGROUND_SET,
|
||||
PROP_MODEL,
|
||||
PROP_CELL_AREA,
|
||||
PROP_CELL_AREA_CONTEXT,
|
||||
@ -199,29 +193,6 @@ gtk_cell_view_class_init (GtkCellViewClass *klass)
|
||||
/* properties */
|
||||
g_object_class_override_property (gobject_class, PROP_ORIENTATION, "orientation");
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_BACKGROUND,
|
||||
g_param_spec_string ("background",
|
||||
P_("Background color name"),
|
||||
P_("Background color as a string"),
|
||||
NULL,
|
||||
GTK_PARAM_WRITABLE));
|
||||
|
||||
/**
|
||||
* GtkCellView:background-rgba:
|
||||
*
|
||||
* The background color as a #GdkRGBA
|
||||
*
|
||||
* Since: 3.0
|
||||
*/
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_BACKGROUND_RGBA,
|
||||
g_param_spec_boxed ("background-rgba",
|
||||
P_("Background RGBA color"),
|
||||
P_("Background color as a GdkRGBA"),
|
||||
GDK_TYPE_RGBA,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
/**
|
||||
* GtkCellView:model:
|
||||
*
|
||||
@ -318,13 +289,6 @@ gtk_cell_view_class_init (GtkCellViewClass *klass)
|
||||
FALSE,
|
||||
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
|
||||
|
||||
|
||||
#define ADD_SET_PROP(propname, propval, nick, blurb) g_object_class_install_property (gobject_class, propval, g_param_spec_boolean (propname, nick, blurb, FALSE, GTK_PARAM_READWRITE))
|
||||
|
||||
ADD_SET_PROP ("background-set", PROP_BACKGROUND_SET,
|
||||
P_("Background set"),
|
||||
P_("Whether this tag affects the background color"));
|
||||
|
||||
gtk_widget_class_set_css_name (widget_class, "cellview");
|
||||
}
|
||||
|
||||
@ -378,12 +342,6 @@ gtk_cell_view_get_property (GObject *object,
|
||||
case PROP_ORIENTATION:
|
||||
g_value_set_enum (value, view->priv->orientation);
|
||||
break;
|
||||
case PROP_BACKGROUND_RGBA:
|
||||
g_value_set_boxed (value, &view->priv->background);
|
||||
break;
|
||||
case PROP_BACKGROUND_SET:
|
||||
g_value_set_boolean (value, view->priv->background_set);
|
||||
break;
|
||||
case PROP_MODEL:
|
||||
g_value_set_object (value, view->priv->model);
|
||||
break;
|
||||
@ -428,26 +386,6 @@ gtk_cell_view_set_property (GObject *object,
|
||||
g_object_notify_by_pspec (object, pspec);
|
||||
}
|
||||
break;
|
||||
case PROP_BACKGROUND:
|
||||
{
|
||||
GdkRGBA color;
|
||||
|
||||
if (!g_value_get_string (value))
|
||||
gtk_cell_view_set_background_rgba (view, NULL);
|
||||
else if (gdk_rgba_parse (&color, g_value_get_string (value)))
|
||||
gtk_cell_view_set_background_rgba (view, &color);
|
||||
else
|
||||
g_warning ("Don't know color '%s'", g_value_get_string (value));
|
||||
|
||||
g_object_notify (object, "background-rgba");
|
||||
}
|
||||
break;
|
||||
case PROP_BACKGROUND_RGBA:
|
||||
gtk_cell_view_set_background_rgba (view, g_value_get_boxed (value));
|
||||
break;
|
||||
case PROP_BACKGROUND_SET:
|
||||
view->priv->background_set = g_value_get_boolean (value);
|
||||
break;
|
||||
case PROP_MODEL:
|
||||
gtk_cell_view_set_model (view, g_value_get_object (value));
|
||||
break;
|
||||
@ -816,14 +754,6 @@ gtk_cell_view_render (GtkCssGadget *gadget,
|
||||
area.width = width;
|
||||
area.height = height;
|
||||
|
||||
/* "blank" background */
|
||||
if (cellview->priv->background_set)
|
||||
{
|
||||
gdk_cairo_rectangle (cr, &area);
|
||||
gdk_cairo_set_source_rgba (cr, &cellview->priv->background);
|
||||
cairo_fill (cr);
|
||||
}
|
||||
|
||||
/* set cell data (if available) */
|
||||
if (cellview->priv->displayed_row)
|
||||
gtk_cell_view_set_cell_data (cellview);
|
||||
@ -1255,43 +1185,6 @@ gtk_cell_view_get_displayed_row (GtkCellView *cell_view)
|
||||
return gtk_tree_row_reference_get_path (cell_view->priv->displayed_row);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_cell_view_set_background_rgba:
|
||||
* @cell_view: a #GtkCellView
|
||||
* @rgba: the new background color
|
||||
*
|
||||
* Sets the background color of @cell_view.
|
||||
*
|
||||
* Since: 3.0
|
||||
*/
|
||||
void
|
||||
gtk_cell_view_set_background_rgba (GtkCellView *cell_view,
|
||||
const GdkRGBA *rgba)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_CELL_VIEW (cell_view));
|
||||
|
||||
if (rgba)
|
||||
{
|
||||
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 = *rgba;
|
||||
}
|
||||
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_get_draw_sensitive:
|
||||
* @cell_view: a #GtkCellView
|
||||
|
@ -90,9 +90,6 @@ void gtk_cell_view_set_displayed_row (GtkCellView *cell_v
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkTreePath *gtk_cell_view_get_displayed_row (GtkCellView *cell_view);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_cell_view_set_background_rgba (GtkCellView *cell_view,
|
||||
const GdkRGBA *rgba);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gtk_cell_view_get_draw_sensitive (GtkCellView *cell_view);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_cell_view_set_draw_sensitive (GtkCellView *cell_view,
|
||||
|
@ -1054,7 +1054,6 @@ main (int argc, char **argv)
|
||||
GtkTreeModel *model;
|
||||
GtkTreePath *path;
|
||||
GtkTreeIter iter;
|
||||
GdkRGBA color;
|
||||
GtkCellArea *area;
|
||||
gchar *text;
|
||||
gint i;
|
||||
@ -1237,11 +1236,6 @@ main (int argc, char **argv)
|
||||
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (tmp), renderer,
|
||||
"text", 1,
|
||||
NULL);
|
||||
color.red = 1.0;
|
||||
color.blue = 1.0;
|
||||
color.green = 0;
|
||||
color.alpha = 1.0;
|
||||
gtk_cell_view_set_background_rgba (GTK_CELL_VIEW (tmp), &color);
|
||||
displayed_row_changed (GTK_COMBO_BOX (combobox), GTK_CELL_VIEW (tmp));
|
||||
g_signal_connect (combobox, "changed", G_CALLBACK (displayed_row_changed), tmp);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user