[gnome-builder] gstyle: add GstyleColorFilter enum



commit cf878460d86c5fcb1f6b2d38aac9a47a6bd690d8
Author: Sebastien Lafargue <slafargue gnome org>
Date:   Wed Jul 20 18:14:27 2016 +0200

    gstyle: add GstyleColorFilter enum
    
    In the process, we rename the filter function
    pointer to GstyleColorFilterFunc

 contrib/gstyle/gstyle-color-filter.c        |   21 +++++++++++++
 contrib/gstyle/gstyle-color-filter.h        |   12 +++++++-
 contrib/gstyle/gstyle-color-panel-private.h |    1 +
 contrib/gstyle/gstyle-color-panel.h         |    1 +
 contrib/gstyle/gstyle-color-plane.c         |   20 ++++++------
 contrib/gstyle/gstyle-color-plane.h         |   44 +++++++++++++-------------
 contrib/gstyle/gstyle-color-scale.c         |   44 +++++++++++++-------------
 contrib/gstyle/gstyle-color-scale.h         |   44 +++++++++++++-------------
 8 files changed, 110 insertions(+), 77 deletions(-)
---
diff --git a/contrib/gstyle/gstyle-color-filter.c b/contrib/gstyle/gstyle-color-filter.c
index a264ee0..547a3b5 100644
--- a/contrib/gstyle/gstyle-color-filter.c
+++ b/contrib/gstyle/gstyle-color-filter.c
@@ -40,3 +40,24 @@ gstyle_color_filter_websafe (GdkRGBA  *rgba,
   filter_rgba->blue  = TO_WEB_COLOR (rgba->blue);
   filter_rgba->alpha = rgba->alpha;
 }
+
+GType
+gstyle_color_filter_get_type (void)
+{
+  static GType filter_type_id;
+  static const GEnumValue values[] = {
+    { GSTYLE_COLOR_FILTER_NONE,    "GSTYLE_COLOR_FILTER_NONE",    "none" },
+    { GSTYLE_COLOR_FILTER_WEBSAFE, "GSTYLE_COLOR_FILTER_WEBSAFE", "websafe" },
+    { 0 }
+  };
+
+  if (g_once_init_enter (&filter_type_id))
+    {
+      GType _type_id;
+
+      _type_id = g_enum_register_static ("GstyleColorFilter", values);
+      g_once_init_leave (&filter_type_id, _type_id);
+    }
+
+  return filter_type_id;
+}
diff --git a/contrib/gstyle/gstyle-color-filter.h b/contrib/gstyle/gstyle-color-filter.h
index 085bd5a..d72ed40 100644
--- a/contrib/gstyle/gstyle-color-filter.h
+++ b/contrib/gstyle/gstyle-color-filter.h
@@ -24,7 +24,17 @@
 
 G_BEGIN_DECLS
 
-typedef void (*GstyleColorFilter)(GdkRGBA *rgba, GdkRGBA *filter_rgba, gpointer user_data);
+typedef void (*GstyleColorFilterFunc)(GdkRGBA *rgba, GdkRGBA *filter_rgba, gpointer user_data);
+
+#define GSTYLE_TYPE_COLOR_FILTER (gstyle_color_filter_get_type())
+
+typedef enum
+{
+  GSTYLE_COLOR_FILTER_NONE,
+  GSTYLE_COLOR_FILTER_WEBSAFE
+} GstyleColorFilter;
+
+GType          gstyle_color_filter_get_type       (void);
 
 void           gstyle_color_filter_websafe        (GdkRGBA          *rgba,
                                                    GdkRGBA          *filter_rgba,
diff --git a/contrib/gstyle/gstyle-color-panel-private.h b/contrib/gstyle/gstyle-color-panel-private.h
index 1b70997..d19b28b 100644
--- a/contrib/gstyle/gstyle-color-panel-private.h
+++ b/contrib/gstyle/gstyle-color-panel-private.h
@@ -32,6 +32,7 @@
 #include "gstyle-color-widget.h"
 #include "gstyle-css-provider.h"
 #include "gstyle-eyedropper.h"
+#include "gstyle-color-filter.h"
 #include "gstyle-palette-widget.h"
 #include "gstyle-revealer.h"
 #include "gstyle-slidein.h"
diff --git a/contrib/gstyle/gstyle-color-panel.h b/contrib/gstyle/gstyle-color-panel.h
index ebf643e..e5de777 100644
--- a/contrib/gstyle/gstyle-color-panel.h
+++ b/contrib/gstyle/gstyle-color-panel.h
@@ -22,6 +22,7 @@
 #include <glib-object.h>
 #include <gtk/gtk.h>
 
+#include "gstyle-color-filter.h"
 #include "gstyle-palette.h"
 #include "gstyle-palette-widget.h"
 #include "gstyle-xyz.h"
diff --git a/contrib/gstyle/gstyle-color-plane.c b/contrib/gstyle/gstyle-color-plane.c
index aa59b16..7128ccf 100644
--- a/contrib/gstyle/gstyle-color-plane.c
+++ b/contrib/gstyle/gstyle-color-plane.c
@@ -84,7 +84,7 @@ typedef struct
   gdouble                 cursor_y;
 
   ComputeData             data;
-  GstyleColorFilter       filter;
+  GstyleColorFilterFunc   filter;
   gpointer                filter_user_data;
 
   Component               comp [N_GSTYLE_COLOR_COMPONENT];
@@ -382,17 +382,17 @@ gstyle_color_plane_set_preferred_unit (GstyleColorPlane *self,
 }
 
 /**
- * gstyle_color_plane_get_filter: (skip):
+ * gstyle_color_plane_get_filter_func: (skip):
  * @self: A #GstyleColorPlane
  *
  * Get a pointer to the current filter function or %NULL
  * if no filter is actually set.
  *
- * Returns: (nullable): A GstyleColorFilter function pointer.
+ * Returns: (nullable): A GstyleColorFilterFunc function pointer.
  *
  */
-GstyleColorFilter
-gstyle_color_plane_get_filter (GstyleColorPlane *self)
+GstyleColorFilterFunc
+gstyle_color_plane_get_filter_func (GstyleColorPlane *self)
 {
   GstyleColorPlanePrivate *priv = gstyle_color_plane_get_instance_private (self);
 
@@ -402,9 +402,9 @@ gstyle_color_plane_get_filter (GstyleColorPlane *self)
 }
 
 /**
- * gstyle_color_plane_set_filter:
+ * gstyle_color_plane_set_filter_func:
  * @self: A #GstyleColorPlane
- * @filter_cb: (scope notified) (nullable): A GstyleColorFilter filter function or
+ * @filter_cb: (scope notified) (nullable): A GstyleColorFilterFunc filter function or
  *   %NULL to unset the current filter. In this case, user_data is ignored
  * @user_data: (closure) (nullable): user data to pass when calling the filter function
  *
@@ -412,9 +412,9 @@ gstyle_color_plane_get_filter (GstyleColorPlane *self)
  *
  */
 void
-gstyle_color_plane_set_filter (GstyleColorPlane  *self,
-                               GstyleColorFilter  filter_cb,
-                               gpointer           user_data)
+gstyle_color_plane_set_filter_func (GstyleColorPlane      *self,
+                                    GstyleColorFilterFunc  filter_cb,
+                                    gpointer               user_data)
 {
   GstyleColorPlanePrivate *priv = gstyle_color_plane_get_instance_private (self);
 
diff --git a/contrib/gstyle/gstyle-color-plane.h b/contrib/gstyle/gstyle-color-plane.h
index 01d2559..abf9467 100644
--- a/contrib/gstyle/gstyle-color-plane.h
+++ b/contrib/gstyle/gstyle-color-plane.h
@@ -59,29 +59,29 @@ struct _GstyleColorPlaneClass
   GtkDrawingAreaClass parent;
 };
 
-GType                gstyle_color_plane_mode_get_type                 (void);
+GType                  gstyle_color_plane_mode_get_type                 (void);
 
-GstyleColorPlane    *gstyle_color_plane_new                           (void);
-GtkAdjustment       *gstyle_color_plane_get_component_adjustment      (GstyleColorPlane       *self,
-                                                                       GstyleColorComponent    comp);
-GstyleColorFilter    gstyle_color_plane_get_filter                    (GstyleColorPlane       *self);
-void                 gstyle_color_plane_get_filtered_rgba             (GstyleColorPlane       *self,
-                                                                       GdkRGBA                *rgba);
-void                 gstyle_color_plane_get_rgba                      (GstyleColorPlane       *self,
-                                                                       GdkRGBA                *rgba);
-void                 gstyle_color_plane_get_xyz                       (GstyleColorPlane       *self,
-                                                                       GstyleXYZ              *xyz);
-void                 gstyle_color_plane_set_filter                    (GstyleColorPlane       *self,
-                                                                       GstyleColorFilter       filter_cb,
-                                                                       gpointer                user_data);
-void                 gstyle_color_plane_set_mode                      (GstyleColorPlane       *self,
-                                                                       GstyleColorPlaneMode    mode);
-void                 gstyle_color_plane_set_preferred_unit            (GstyleColorPlane       *self,
-                                                                       GstyleColorUnit         
preferred_unit);
-void                 gstyle_color_plane_set_rgba                      (GstyleColorPlane       *self,
-                                                                       const GdkRGBA          *rgba);
-void                 gstyle_color_plane_set_xyz                       (GstyleColorPlane       *self,
-                                                                       const GstyleXYZ        *xyz);
+GstyleColorPlane      *gstyle_color_plane_new                           (void);
+GtkAdjustment         *gstyle_color_plane_get_component_adjustment      (GstyleColorPlane       *self,
+                                                                         GstyleColorComponent    comp);
+GstyleColorFilterFunc  gstyle_color_plane_get_filter_func               (GstyleColorPlane       *self);
+void                   gstyle_color_plane_get_filtered_rgba             (GstyleColorPlane       *self,
+                                                                         GdkRGBA                *rgba);
+void                   gstyle_color_plane_get_rgba                      (GstyleColorPlane       *self,
+                                                                         GdkRGBA                *rgba);
+void                   gstyle_color_plane_get_xyz                       (GstyleColorPlane       *self,
+                                                                         GstyleXYZ              *xyz);
+void                   gstyle_color_plane_set_filter_func               (GstyleColorPlane       *self,
+                                                                         GstyleColorFilterFunc   filter_cb,
+                                                                         gpointer                user_data);
+void                   gstyle_color_plane_set_mode                      (GstyleColorPlane       *self,
+                                                                         GstyleColorPlaneMode    mode);
+void                   gstyle_color_plane_set_preferred_unit            (GstyleColorPlane       *self,
+                                                                         GstyleColorUnit         
preferred_unit);
+void                   gstyle_color_plane_set_rgba                      (GstyleColorPlane       *self,
+                                                                         const GdkRGBA          *rgba);
+void                   gstyle_color_plane_set_xyz                       (GstyleColorPlane       *self,
+                                                                         const GstyleXYZ        *xyz);
 
 G_END_DECLS
 
diff --git a/contrib/gstyle/gstyle-color-scale.c b/contrib/gstyle/gstyle-color-scale.c
index 7197b34..f6f2f32 100644
--- a/contrib/gstyle/gstyle-color-scale.c
+++ b/contrib/gstyle/gstyle-color-scale.c
@@ -38,23 +38,23 @@ typedef struct _ColorStop
 
 struct _GstyleColorScale
 {
-  GtkScale              parent_instance;
+  GtkScale               parent_instance;
 
-  GstyleCssProvider    *default_provider;
+  GstyleCssProvider     *default_provider;
 
-  GstyleColorFilter     filter;
-  gpointer              filter_user_data;
+  GstyleColorFilterFunc  filter;
+  gpointer               filter_user_data;
 
-  GtkGesture           *long_press_gesture;
-  GstyleColorScaleKind  kind;
-  GSequence            *custom_color_stops;
-  cairo_pattern_t      *pattern;
-  cairo_pattern_t      *checkered_pattern;
+  GtkGesture            *long_press_gesture;
+  GstyleColorScaleKind   kind;
+  GSequence             *custom_color_stops;
+  cairo_pattern_t       *pattern;
+  cairo_pattern_t       *checkered_pattern;
 
-  cairo_surface_t      *data_surface;
-  guint32              *data_raw;
-  guint32              *data_raw_filtered;
-  gint                  data_stride;
+  cairo_surface_t       *data_surface;
+  guint32               *data_raw;
+  guint32               *data_raw_filtered;
+  gint                   data_stride;
 };
 
 G_DEFINE_TYPE (GstyleColorScale, gstyle_color_scale, GTK_TYPE_SCALE)
@@ -100,17 +100,17 @@ filter_data (GstyleColorScale *self)
 }
 
 /**
- * gstyle_color_scale_get_filter: (skip):
+ * gstyle_color_scale_get_filter_func: (skip):
  * @self: A #GstyleColorScale
  *
  * Get a pointer to the current filter function or %NULL
  * if no filter is actually set.
  *
- * Returns: (nullable): A GstyleColorFilter function pointer.
+ * Returns: (nullable): A GstyleColorFilterFunc function pointer.
  *
  */
-GstyleColorFilter
-gstyle_color_scale_get_filter (GstyleColorScale *self)
+GstyleColorFilterFunc
+gstyle_color_scale_get_filter_func (GstyleColorScale *self)
 {
   g_return_val_if_fail (GSTYLE_IS_COLOR_SCALE (self), NULL);
 
@@ -120,9 +120,9 @@ gstyle_color_scale_get_filter (GstyleColorScale *self)
 /* TODO: do a copy of orignal data so that we can remove or change the filter
  * keeping the original datas */
 /**
- * gstyle_color_scale_set_filter:
+ * gstyle_color_scale_set_filter_func:
  * @self: A #GstyleColorScale
- * @filter_cb: (scope notified) (nullable): A GstyleColorFilter filter function or
+ * @filter_cb: (scope notified) (nullable): A GstyleColorFilterFunc filter function or
  *   %NULL to unset the current filter. In this case, user_data is ignored.
  * @user_data: (closure) (nullable): user data to pass when calling the filter function
  *
@@ -133,9 +133,9 @@ gstyle_color_scale_get_filter (GstyleColorScale *self)
  *
  */
 void
-gstyle_color_scale_set_filter (GstyleColorScale  *self,
-                               GstyleColorFilter  filter_cb,
-                               gpointer           user_data)
+gstyle_color_scale_set_filter_func (GstyleColorScale      *self,
+                                    GstyleColorFilterFunc  filter_cb,
+                                    gpointer               user_data)
 {
   g_return_if_fail (GSTYLE_IS_COLOR_SCALE (self));
 
diff --git a/contrib/gstyle/gstyle-color-scale.h b/contrib/gstyle/gstyle-color-scale.h
index 67825c3..d7b8539 100644
--- a/contrib/gstyle/gstyle-color-scale.h
+++ b/contrib/gstyle/gstyle-color-scale.h
@@ -49,29 +49,29 @@ G_DECLARE_FINAL_TYPE (GstyleColorScale, gstyle_color_scale, GSTYLE, COLOR_SCALE,
 
 GType                   gstyle_color_scale_kind_get_type               (void);
 
-GstyleColorScale       *gstyle_color_scale_new                         (GtkAdjustment        *adjustment);
-gint                    gstyle_color_scale_add_rgba_color_stop         (GstyleColorScale     *self,
-                                                                        gdouble               offset,
-                                                                        GdkRGBA              *rgba);
-gint                    gstyle_color_scale_add_color_stop              (GstyleColorScale     *self,
-                                                                        gdouble               offset,
-                                                                        gdouble               red,
-                                                                        gdouble               green,
-                                                                        gdouble               blue,
-                                                                        gdouble               alpha);
-void                    gstyle_color_scale_clear_color_stops           (GstyleColorScale     *self);
-GstyleColorFilter       gstyle_color_scale_get_filter                  (GstyleColorScale     *self);
-GstyleColorScaleKind    gstyle_color_scale_get_kind                    (GstyleColorScale     *self);
+GstyleColorScale       *gstyle_color_scale_new                         (GtkAdjustment         *adjustment);
+gint                    gstyle_color_scale_add_rgba_color_stop         (GstyleColorScale      *self,
+                                                                        gdouble                offset,
+                                                                        GdkRGBA               *rgba);
+gint                    gstyle_color_scale_add_color_stop              (GstyleColorScale      *self,
+                                                                        gdouble                offset,
+                                                                        gdouble                red,
+                                                                        gdouble                green,
+                                                                        gdouble                blue,
+                                                                        gdouble                alpha);
+void                    gstyle_color_scale_clear_color_stops           (GstyleColorScale      *self);
+GstyleColorFilterFunc   gstyle_color_scale_get_filter_func             (GstyleColorScale      *self);
+GstyleColorScaleKind    gstyle_color_scale_get_kind                    (GstyleColorScale      *self);
 
-gboolean                gstyle_color_scale_remove_color_stop           (GstyleColorScale     *self,
-                                                                        gint                  id);
-void                    gstyle_color_scale_set_custom_data             (GstyleColorScale     *self,
-                                                                        guint32              *data);
-void                    gstyle_color_scale_set_filter                  (GstyleColorScale     *self,
-                                                                        GstyleColorFilter     filter_cb,
-                                                                        gpointer              user_data);
-void                    gstyle_color_scale_set_kind                    (GstyleColorScale     *self,
-                                                                        GstyleColorScaleKind  kind);
+gboolean                gstyle_color_scale_remove_color_stop           (GstyleColorScale      *self,
+                                                                        gint                   id);
+void                    gstyle_color_scale_set_custom_data             (GstyleColorScale      *self,
+                                                                        guint32               *data);
+void                    gstyle_color_scale_set_filter_func             (GstyleColorScale      *self,
+                                                                        GstyleColorFilterFunc  filter_cb,
+                                                                        gpointer               user_data);
+void                    gstyle_color_scale_set_kind                    (GstyleColorScale      *self,
+                                                                        GstyleColorScaleKind   kind);
 
 G_END_DECLS
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]