]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtkmodifierstyle.c
filechooserbutton: Test that the expected filename is shown
[~andy/gtk] / gtk / gtkmodifierstyle.c
index d81b9bcb06aa7d5bd80c567e60e394eed1a8b9eb..4d3cc35194a7afa6b0e0a49ddd6e6e94d7408704 100644 (file)
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
  */
 
 #include "config.h"
 #include "gtkmodifierstyle.h"
+#include "gtkstyleproviderprivate.h"
 #include "gtkintl.h"
 
 typedef struct StylePropertyValue StylePropertyValue;
@@ -36,12 +35,15 @@ enum {
 
 static guint signals [LAST_SIGNAL] = { 0 };
 
-static void gtk_modifier_style_provider_init (GtkStyleProviderIface *iface);
-static void gtk_modifier_style_finalize      (GObject      *object);
+static void gtk_modifier_style_provider_init         (GtkStyleProviderIface            *iface);
+static void gtk_modifier_style_provider_private_init (GtkStyleProviderPrivateInterface *iface);
+static void gtk_modifier_style_finalize              (GObject                          *object);
 
 G_DEFINE_TYPE_EXTENDED (GtkModifierStyle, _gtk_modifier_style, G_TYPE_OBJECT, 0,
                         G_IMPLEMENT_INTERFACE (GTK_TYPE_STYLE_PROVIDER,
-                                               gtk_modifier_style_provider_init));
+                                               gtk_modifier_style_provider_init)
+                        G_IMPLEMENT_INTERFACE (GTK_TYPE_STYLE_PROVIDER_PRIVATE,
+                                               gtk_modifier_style_provider_private_init));
 
 static void
 _gtk_modifier_style_class_init (GtkModifierStyleClass *klass)
@@ -79,16 +81,6 @@ _gtk_modifier_style_init (GtkModifierStyle *modifier_style)
   priv->style = gtk_style_properties_new ();
 }
 
-static GtkStyleProperties *
-gtk_modifier_style_get_style (GtkStyleProvider *provider,
-                              GtkWidgetPath    *path)
-{
-  GtkModifierStylePrivate *priv;
-
-  priv = GTK_MODIFIER_STYLE (provider)->priv;
-  return g_object_ref (priv->style);
-}
-
 static gboolean
 gtk_modifier_style_get_style_property (GtkStyleProvider *provider,
                                        GtkWidgetPath    *path,
@@ -127,10 +119,48 @@ gtk_modifier_style_get_style_property (GtkStyleProvider *provider,
 static void
 gtk_modifier_style_provider_init (GtkStyleProviderIface *iface)
 {
-  iface->get_style = gtk_modifier_style_get_style;
   iface->get_style_property = gtk_modifier_style_get_style_property;
 }
 
+static GtkCssValue *
+gtk_modifier_style_provider_get_color (GtkStyleProviderPrivate *provider,
+                                       const char              *name)
+{
+  GtkModifierStyle *style = GTK_MODIFIER_STYLE (provider);
+
+  return _gtk_style_provider_private_get_color (GTK_STYLE_PROVIDER_PRIVATE (style->priv->style), name);
+}
+
+static void
+gtk_modifier_style_provider_lookup (GtkStyleProviderPrivate *provider,
+                                    const GtkCssMatcher     *matcher,
+                                    GtkCssLookup            *lookup)
+{
+  GtkModifierStyle *style = GTK_MODIFIER_STYLE (provider);
+
+  _gtk_style_provider_private_lookup (GTK_STYLE_PROVIDER_PRIVATE (style->priv->style),
+                                      matcher,
+                                      lookup);
+}
+
+static GtkCssChange
+gtk_modifier_style_provider_get_change (GtkStyleProviderPrivate *provider,
+                                        const GtkCssMatcher     *matcher)
+{
+  GtkModifierStyle *style = GTK_MODIFIER_STYLE (provider);
+
+  return _gtk_style_provider_private_get_change (GTK_STYLE_PROVIDER_PRIVATE (style->priv->style),
+                                                 matcher);
+}
+
+static void
+gtk_modifier_style_provider_private_init (GtkStyleProviderPrivateInterface *iface)
+{
+  iface->get_color = gtk_modifier_style_provider_get_color;
+  iface->lookup = gtk_modifier_style_provider_lookup;
+  iface->get_change = gtk_modifier_style_provider_get_change;
+}
+
 static void
 gtk_modifier_style_finalize (GObject *object)
 {
@@ -169,6 +199,7 @@ modifier_style_set_color (GtkModifierStyle *style,
     gtk_style_properties_unset_property (priv->style, prop, state);
 
   g_signal_emit (style, signals[CHANGED], 0);
+  _gtk_style_provider_private_changed (GTK_STYLE_PROVIDER_PRIVATE (style));
 }
 
 void
@@ -209,6 +240,7 @@ _gtk_modifier_style_set_font (GtkModifierStyle           *style,
     gtk_style_properties_unset_property (priv->style, "font", 0);
 
   g_signal_emit (style, signals[CHANGED], 0);
+  _gtk_style_provider_private_changed (GTK_STYLE_PROVIDER_PRIVATE (style));
 }
 
 void
@@ -224,13 +256,18 @@ _gtk_modifier_style_map_color (GtkModifierStyle *style,
 
   priv = style->priv;
 
+  G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+
   if (color)
     symbolic_color = gtk_symbolic_color_new_literal (color);
 
   gtk_style_properties_map_color (priv->style,
                                   name, symbolic_color);
 
+  G_GNUC_END_IGNORE_DEPRECATIONS;
+
   g_signal_emit (style, signals[CHANGED], 0);
+  _gtk_style_provider_private_changed (GTK_STYLE_PROVIDER_PRIVATE (style));
 }
 
 void
@@ -271,4 +308,5 @@ _gtk_modifier_style_set_color_property (GtkModifierStyle *style,
     }
 
   g_signal_emit (style, signals[CHANGED], 0);
+  _gtk_style_provider_private_changed (GTK_STYLE_PROVIDER_PRIVATE (style));
 }