2011-12-28 21:59:55 +00:00
|
|
|
/* GTK - The GIMP Toolkit
|
|
|
|
* Copyright (C) 2011 Benjamin Otte <otte@gnome.org>
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2012-02-27 13:01:10 +00:00
|
|
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
2011-12-28 21:59:55 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include "gtkstyleproviderprivate.h"
|
2012-04-08 15:33:22 +00:00
|
|
|
|
|
|
|
#include "gtkintl.h"
|
2011-12-28 21:59:55 +00:00
|
|
|
#include "gtkstyleprovider.h"
|
|
|
|
|
2012-04-08 15:33:22 +00:00
|
|
|
enum {
|
|
|
|
CHANGED,
|
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
2011-12-28 21:59:55 +00:00
|
|
|
G_DEFINE_INTERFACE (GtkStyleProviderPrivate, _gtk_style_provider_private, GTK_TYPE_STYLE_PROVIDER)
|
|
|
|
|
2012-04-22 17:25:16 +00:00
|
|
|
static guint signals[LAST_SIGNAL];
|
2012-04-08 15:33:22 +00:00
|
|
|
|
2011-12-28 21:59:55 +00:00
|
|
|
static void
|
|
|
|
_gtk_style_provider_private_default_init (GtkStyleProviderPrivateInterface *iface)
|
|
|
|
{
|
2012-04-08 15:33:22 +00:00
|
|
|
signals[CHANGED] = g_signal_new (I_("-gtk-private-changed"),
|
|
|
|
G_TYPE_FROM_INTERFACE (iface),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
G_STRUCT_OFFSET (GtkStyleProviderPrivateInterface, changed),
|
|
|
|
NULL, NULL,
|
|
|
|
g_cclosure_marshal_VOID__VOID,
|
|
|
|
G_TYPE_NONE, 0);
|
|
|
|
|
2011-12-28 21:59:55 +00:00
|
|
|
}
|
|
|
|
|
2012-11-25 01:28:59 +00:00
|
|
|
GtkCssValue *
|
2011-12-28 21:59:55 +00:00
|
|
|
_gtk_style_provider_private_get_color (GtkStyleProviderPrivate *provider,
|
|
|
|
const char *name)
|
|
|
|
{
|
|
|
|
GtkStyleProviderPrivateInterface *iface;
|
|
|
|
|
2012-09-28 11:42:21 +00:00
|
|
|
/* for compat with gtk_symbolic_color_resolve() */
|
|
|
|
if (provider == NULL)
|
|
|
|
return NULL;
|
|
|
|
|
2011-12-28 21:59:55 +00:00
|
|
|
g_return_val_if_fail (GTK_IS_STYLE_PROVIDER_PRIVATE (provider), NULL);
|
|
|
|
|
|
|
|
iface = GTK_STYLE_PROVIDER_PRIVATE_GET_INTERFACE (provider);
|
|
|
|
|
|
|
|
if (!iface->get_color)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
return iface->get_color (provider, name);
|
|
|
|
}
|
|
|
|
|
2012-04-19 01:58:28 +00:00
|
|
|
GtkCssKeyframes *
|
|
|
|
_gtk_style_provider_private_get_keyframes (GtkStyleProviderPrivate *provider,
|
|
|
|
const char *name)
|
|
|
|
{
|
|
|
|
GtkStyleProviderPrivateInterface *iface;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GTK_IS_STYLE_PROVIDER_PRIVATE (provider), NULL);
|
|
|
|
g_return_val_if_fail (name != NULL, NULL);
|
|
|
|
|
|
|
|
iface = GTK_STYLE_PROVIDER_PRIVATE_GET_INTERFACE (provider);
|
|
|
|
|
|
|
|
if (!iface->get_keyframes)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
return iface->get_keyframes (provider, name);
|
|
|
|
}
|
|
|
|
|
2011-12-28 21:59:55 +00:00
|
|
|
void
|
|
|
|
_gtk_style_provider_private_lookup (GtkStyleProviderPrivate *provider,
|
2012-03-17 01:36:11 +00:00
|
|
|
const GtkCssMatcher *matcher,
|
2014-12-09 18:31:17 +00:00
|
|
|
GtkCssLookup *lookup,
|
|
|
|
GtkCssChange *out_change)
|
2011-12-28 21:59:55 +00:00
|
|
|
{
|
|
|
|
GtkStyleProviderPrivateInterface *iface;
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_STYLE_PROVIDER_PRIVATE (provider));
|
2012-03-17 01:36:11 +00:00
|
|
|
g_return_if_fail (matcher != NULL);
|
2011-12-28 21:59:55 +00:00
|
|
|
g_return_if_fail (lookup != NULL);
|
|
|
|
|
2014-12-09 18:31:17 +00:00
|
|
|
if (out_change)
|
|
|
|
*out_change = 0;
|
|
|
|
|
2011-12-28 21:59:55 +00:00
|
|
|
iface = GTK_STYLE_PROVIDER_PRIVATE_GET_INTERFACE (provider);
|
|
|
|
|
|
|
|
if (!iface->lookup)
|
|
|
|
return;
|
|
|
|
|
2014-12-09 18:31:17 +00:00
|
|
|
iface->lookup (provider, matcher, lookup, out_change);
|
2012-03-17 20:09:51 +00:00
|
|
|
}
|
2012-04-08 15:33:22 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
_gtk_style_provider_private_changed (GtkStyleProviderPrivate *provider)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GTK_IS_STYLE_PROVIDER_PRIVATE (provider));
|
|
|
|
|
|
|
|
g_signal_emit (provider, signals[CHANGED], 0);
|
|
|
|
}
|
|
|
|
|
2012-12-01 00:24:12 +00:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|