[gtk+/wip/window-scales2: 39/40] GtkCellRendererPixbuf: Add surface property
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/window-scales2: 39/40] GtkCellRendererPixbuf: Add surface property
- Date: Wed, 3 Jul 2013 12:45:14 +0000 (UTC)
commit b6b24148fbfc5445a6d14c72f95bc151c665848d
Author: Alexander Larsson <alexl redhat com>
Date: Wed Jun 26 16:34:53 2013 +0200
GtkCellRendererPixbuf: Add surface property
gtk/gtkcellrendererpixbuf.c | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkcellrendererpixbuf.c b/gtk/gtkcellrendererpixbuf.c
index 19795b8..e6a8f53 100644
--- a/gtk/gtkcellrendererpixbuf.c
+++ b/gtk/gtkcellrendererpixbuf.c
@@ -17,6 +17,7 @@
#include "config.h"
#include <stdlib.h>
+#include <cairo-gobject.h>
#include "gtkcellrendererpixbuf.h"
#include "gtkiconfactory.h"
#include "gtkiconhelperprivate.h"
@@ -74,6 +75,7 @@ enum {
PROP_PIXBUF,
PROP_PIXBUF_EXPANDER_OPEN,
PROP_PIXBUF_EXPANDER_CLOSED,
+ PROP_SURFACE,
PROP_STOCK_ID,
PROP_STOCK_SIZE,
PROP_STOCK_DETAIL,
@@ -168,6 +170,13 @@ gtk_cell_renderer_pixbuf_class_init (GtkCellRendererPixbufClass *class)
P_("Pixbuf for closed expander"),
GDK_TYPE_PIXBUF,
GTK_PARAM_READWRITE));
+ g_object_class_install_property (object_class,
+ PROP_SURFACE,
+ g_param_spec_boxed ("surface",
+ P_("surface"),
+ P_("The surface to render"),
+ CAIRO_GOBJECT_TYPE_SURFACE,
+ GTK_PARAM_READWRITE));
/**
* GtkCellRendererPixbuf:stock-id:
@@ -279,6 +288,9 @@ gtk_cell_renderer_pixbuf_get_property (GObject *object,
case PROP_PIXBUF_EXPANDER_CLOSED:
g_value_set_object (value, priv->pixbuf_expander_closed);
break;
+ case PROP_SURFACE:
+ g_value_set_boxed (value, _gtk_icon_helper_peek_surface (priv->icon_helper));
+ break;
case PROP_STOCK_ID:
g_value_set_string (value, _gtk_icon_helper_get_stock_id (priv->icon_helper));
break;
@@ -311,6 +323,9 @@ gtk_cell_renderer_pixbuf_reset (GtkCellRendererPixbuf *cellpixbuf)
switch (storage_type)
{
+ case GTK_IMAGE_SURFACE:
+ g_object_notify (G_OBJECT (cellpixbuf), "surface");
+ break;
case GTK_IMAGE_PIXBUF:
g_object_notify (G_OBJECT (cellpixbuf), "pixbuf");
break;
@@ -356,6 +371,10 @@ gtk_cell_renderer_pixbuf_set_property (GObject *object,
g_object_unref (priv->pixbuf_expander_closed);
priv->pixbuf_expander_closed = (GdkPixbuf*) g_value_dup_object (value);
break;
+ case PROP_SURFACE:
+ gtk_cell_renderer_pixbuf_reset (cellpixbuf);
+ _gtk_icon_helper_set_surface (priv->icon_helper, g_value_get_boxed (value));
+ break;
case PROP_STOCK_ID:
gtk_cell_renderer_pixbuf_reset (cellpixbuf);
_gtk_icon_helper_set_stock_id (priv->icon_helper, g_value_get_string (value), priv->icon_size);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]