[gtk+/gtk-style-context: 121/191] GtkStyleContext: Add gtk_style_context_[gs]et_screen()
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-style-context: 121/191] GtkStyleContext: Add gtk_style_context_[gs]et_screen()
- Date: Tue, 17 Aug 2010 13:58:22 +0000 (UTC)
commit 23ff5ccfb9faefb190edfbaa4e3e802435c5d782
Author: Carlos Garnacho <carlosg gnome org>
Date: Sat Jul 3 13:17:35 2010 +0200
GtkStyleContext: Add gtk_style_context_[gs]et_screen()
gtk/gtkstylecontext.c | 99 +++++++++++++++++++++++++++++++++++++++++++++++++
gtk/gtkstylecontext.h | 4 ++
2 files changed, 103 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c
index 57965e7..7b13323 100644
--- a/gtk/gtkstylecontext.c
+++ b/gtk/gtkstylecontext.c
@@ -27,6 +27,7 @@
#include "gtkthemingengine.h"
#include "gtkintl.h"
#include "gtkwidget.h"
+#include "gtkprivate.h"
#include "gtkalias.h"
@@ -56,6 +57,8 @@ struct PropertyValue
struct GtkStyleContextPrivate
{
+ GdkScreen *screen;
+
GList *providers;
GList *providers_last;
@@ -73,8 +76,22 @@ struct GtkStyleContextPrivate
GtkThemingEngine *theming_engine;
};
+enum {
+ PROP_0,
+ PROP_SCREEN
+};
+
static void gtk_style_context_finalize (GObject *object);
+static void gtk_style_context_impl_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void gtk_style_context_impl_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec);
+
G_DEFINE_TYPE (GtkStyleContext, gtk_style_context, G_TYPE_OBJECT)
@@ -84,6 +101,16 @@ gtk_style_context_class_init (GtkStyleContextClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = gtk_style_context_finalize;
+ object_class->set_property = gtk_style_context_impl_set_property;
+ object_class->get_property = gtk_style_context_impl_get_property;
+
+ g_object_class_install_property (object_class,
+ PROP_SCREEN,
+ g_param_spec_object ("screen",
+ P_("Screen"),
+ P_("The associated GdkScreen"),
+ GDK_TYPE_SCREEN,
+ GTK_PARAM_READWRITE));
g_type_class_add_private (object_class, sizeof (GtkStyleContextPrivate));
}
@@ -166,6 +193,53 @@ gtk_style_context_finalize (GObject *object)
}
static void
+gtk_style_context_impl_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GtkStyleContextPrivate *priv;
+ GtkStyleContext *style_context;
+
+ style_context = GTK_STYLE_CONTEXT (object);
+ priv = style_context->priv;
+
+ switch (prop_id)
+ {
+ case PROP_SCREEN:
+ gtk_style_context_set_screen (style_context,
+ g_value_get_object (value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+gtk_style_context_impl_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ GtkStyleContextPrivate *priv;
+ GtkStyleContext *style_context;
+
+ style_context = GTK_STYLE_CONTEXT (object);
+ priv = style_context->priv;
+
+ switch (prop_id)
+ {
+ case PROP_SCREEN:
+ g_value_set_object (value, priv->screen);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
rebuild_properties (GtkStyleContext *context)
{
GtkStyleContextPrivate *priv;
@@ -863,6 +937,31 @@ gtk_style_context_lookup_icon_set (GtkStyleContext *context,
return gtk_icon_factory_lookup_default (stock_id);
}
+void
+gtk_style_context_set_screen (GtkStyleContext *context,
+ GdkScreen *screen)
+{
+ GtkStyleContextPrivate *priv;
+
+ g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
+
+ priv = context->priv;
+ priv->screen = screen;
+
+ g_object_notify (G_OBJECT (context), "screen");
+}
+
+GdkScreen *
+gtk_style_context_get_screen (GtkStyleContext *context)
+{
+ GtkStyleContextPrivate *priv;
+
+ g_return_val_if_fail (GTK_IS_STYLE_CONTEXT (context), NULL);
+
+ priv = context->priv;
+ return priv->screen;
+}
+
/* Paint methods */
void
gtk_render_check (GtkStyleContext *context,
diff --git a/gtk/gtkstylecontext.h b/gtk/gtkstylecontext.h
index 54f6a25..1fada4f 100644
--- a/gtk/gtkstylecontext.h
+++ b/gtk/gtkstylecontext.h
@@ -103,6 +103,10 @@ void gtk_style_context_get_style_property (GtkStyleContext *context,
GtkIconSet * gtk_style_context_lookup_icon_set (GtkStyleContext *context,
const gchar *stock_id);
+void gtk_style_context_set_screen (GtkStyleContext *context,
+ GdkScreen *screen);
+GdkScreen * gtk_style_context_get_screen (GtkStyleContext *context);
+
/* Semi-private API */
const GValue * _gtk_style_context_peek_style_property (GtkStyleContext *context,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]