diff options
author | Benjamin Otte <otte@redhat.com> | 2012-12-01 01:24:12 +0100 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2012-12-01 01:24:12 +0100 |
commit | 3ff7f1fd43965d425f2e7fe81f9caa03f1fa97ea (patch) | |
tree | d81a0874b3c5da4cd0c2ad955e2fd35d5357acd0 | |
parent | 41f8ba3c35d05cf5635f15bad282ae39ec57dcd3 (diff) | |
download | gtk+-3ff7f1fd43965d425f2e7fe81f9caa03f1fa97ea.tar.gz |
style: Add _gtk_style_provider_private_get_settings()
This gives a GtkSettings object for resolving system-dependant things -
like the default font family and font size.
No code does this yet, but we have an API.
Only GtkSettings implements this.
-rw-r--r-- | gtk/gtksettings.c | 7 | ||||
-rw-r--r-- | gtk/gtkstylecascade.c | 24 | ||||
-rw-r--r-- | gtk/gtkstyleproviderprivate.c | 15 | ||||
-rw-r--r-- | gtk/gtkstyleproviderprivate.h | 2 |
4 files changed, 48 insertions, 0 deletions
diff --git a/gtk/gtksettings.c b/gtk/gtksettings.c index 2996c98f7d..0aefce6374 100644 --- a/gtk/gtksettings.c +++ b/gtk/gtksettings.c @@ -1454,6 +1454,12 @@ gtk_settings_provider_iface_init (GtkStyleProviderIface *iface) { } +static GtkSettings * +gtk_settings_style_provider_get_settings (GtkStyleProviderPrivate *provider) +{ + return GTK_SETTINGS (provider); +} + static void gtk_settings_style_provider_lookup (GtkStyleProviderPrivate *provider, const GtkCssMatcher *matcher, @@ -1472,6 +1478,7 @@ gtk_settings_style_provider_lookup (GtkStyleProviderPrivate *provider, static void gtk_settings_provider_private_init (GtkStyleProviderPrivateInterface *iface) { + iface->get_settings = gtk_settings_style_provider_get_settings; iface->lookup = gtk_settings_style_provider_lookup; } diff --git a/gtk/gtkstylecascade.c b/gtk/gtkstylecascade.c index a71a55e2a8..ea63fc86f6 100644 --- a/gtk/gtkstylecascade.c +++ b/gtk/gtkstylecascade.c @@ -123,6 +123,29 @@ gtk_style_cascade_provider_iface_init (GtkStyleProviderIface *iface) iface->get_style_property = gtk_style_cascade_get_style_property; } +static GtkSettings * +gtk_style_cascade_get_settings (GtkStyleProviderPrivate *provider) +{ + GtkStyleCascade *cascade = GTK_STYLE_CASCADE (provider); + GtkStyleCascadeIter iter; + GtkSettings *settings; + GtkStyleProvider *item; + + for (item = gtk_style_cascade_iter_init (cascade, &iter); + item; + item = gtk_style_cascade_iter_next (cascade, &iter)) + { + if (!GTK_IS_STYLE_PROVIDER_PRIVATE (item)) + continue; + + settings = _gtk_style_provider_private_get_settings (GTK_STYLE_PROVIDER_PRIVATE (item)); + if (settings) + return settings; + } + + return NULL; +} + static GtkCssValue * gtk_style_cascade_get_color (GtkStyleProviderPrivate *provider, const char *name) @@ -233,6 +256,7 @@ static void gtk_style_cascade_provider_private_iface_init (GtkStyleProviderPrivateInterface *iface) { iface->get_color = gtk_style_cascade_get_color; + iface->get_settings = gtk_style_cascade_get_settings; iface->get_keyframes = gtk_style_cascade_get_keyframes; iface->lookup = gtk_style_cascade_lookup; iface->get_change = gtk_style_cascade_get_change; diff --git a/gtk/gtkstyleproviderprivate.c b/gtk/gtkstyleproviderprivate.c index 7fb59d31c7..1f62b88807 100644 --- a/gtk/gtkstyleproviderprivate.c +++ b/gtk/gtkstyleproviderprivate.c @@ -125,3 +125,18 @@ _gtk_style_provider_private_changed (GtkStyleProviderPrivate *provider) g_signal_emit (provider, signals[CHANGED], 0); } +GtkSettings * +_gtk_style_provider_private_get_settings (GtkStyleProviderPrivate *provider) +{ + GtkStyleProviderPrivateInterface *iface; + + g_return_val_if_fail (GTK_IS_STYLE_PROVIDER_PRIVATE (provider), NULL); + + iface = GTK_STYLE_PROVIDER_PRIVATE_GET_INTERFACE (provider); + + if (!iface->get_settings) + return NULL; + + return iface->get_settings (provider); +} + diff --git a/gtk/gtkstyleproviderprivate.h b/gtk/gtkstyleproviderprivate.h index 76e2a98f71..c619d8d75b 100644 --- a/gtk/gtkstyleproviderprivate.h +++ b/gtk/gtkstyleproviderprivate.h @@ -41,6 +41,7 @@ struct _GtkStyleProviderPrivateInterface GtkCssValue * (* get_color) (GtkStyleProviderPrivate *provider, const char *name); + GtkSettings * (* get_settings) (GtkStyleProviderPrivate *provider); GtkCssKeyframes * (* get_keyframes) (GtkStyleProviderPrivate *provider, const char *name); void (* lookup) (GtkStyleProviderPrivate *provider, @@ -55,6 +56,7 @@ struct _GtkStyleProviderPrivateInterface GType _gtk_style_provider_private_get_type (void) G_GNUC_CONST; +GtkSettings * _gtk_style_provider_private_get_settings (GtkStyleProviderPrivate *provider); GtkCssValue * _gtk_style_provider_private_get_color (GtkStyleProviderPrivate *provider, const char *name); GtkCssKeyframes * _gtk_style_provider_private_get_keyframes(GtkStyleProviderPrivate *provider, |