[gtk-theme-engine-clearlooks/gtk-style-context: 1/21] Turn clearlooks into a GtkThemingEngine



commit b16cfecb14be6e67dc4abe0ddea8015cebd138ad
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue Nov 16 00:35:44 2010 +0100

    Turn clearlooks into a GtkThemingEngine

 src/Makefile.am                                 |    6 +--
 src/clearlooks_draw.c                           |    1 -
 src/clearlooks_draw.h                           |    1 -
 src/clearlooks_draw_glossy.c                    |    1 -
 src/clearlooks_draw_gnome3.c                    |    1 -
 src/clearlooks_draw_gummy.c                     |    1 -
 src/clearlooks_draw_inverted.c                  |    1 -
 src/{clearlooks_style.c => clearlooks_engine.c} |   48 +++++++----------------
 src/{clearlooks_style.h => clearlooks_engine.h} |   37 ++++++++---------
 src/clearlooks_theme_main.c                     |   14 +++---
 src/engine.symbols                              |    2 +-
 11 files changed, 41 insertions(+), 72 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 2d48e4b..59ae353 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -11,10 +11,8 @@ libclearlooks_la_SOURCES =		\
 	ge-support.h			\
 	widget-information.c		\
 	widget-information.h		\
-	clearlooks_rc_style.c		\
-	clearlooks_rc_style.h		\
-	clearlooks_style.c		\
-	clearlooks_style.h		\
+	clearlooks_engine.c		\
+	clearlooks_engine.h		\
 	clearlooks_theme_main.c		\
 	support.c			\
 	animation.c			\
diff --git a/src/clearlooks_draw.c b/src/clearlooks_draw.c
index 295e791..80ec9eb 100644
--- a/src/clearlooks_draw.c
+++ b/src/clearlooks_draw.c
@@ -24,7 +24,6 @@
 
 
 #include "clearlooks_draw.h"
-#include "clearlooks_style.h"
 #include "clearlooks_types.h"
 
 #include "support.h"
diff --git a/src/clearlooks_draw.h b/src/clearlooks_draw.h
index cfa9966..51eed33 100644
--- a/src/clearlooks_draw.h
+++ b/src/clearlooks_draw.h
@@ -25,7 +25,6 @@
 #define CLEARLOOKS_DRAW_H
 
 #include "clearlooks_types.h"
-#include "clearlooks_style.h"
 
 #include <gtk/gtk.h>
 #include <gdk/gdk.h>
diff --git a/src/clearlooks_draw_glossy.c b/src/clearlooks_draw_glossy.c
index 937a022..acc42ae 100644
--- a/src/clearlooks_draw_glossy.c
+++ b/src/clearlooks_draw_glossy.c
@@ -30,7 +30,6 @@
  
 
 #include "clearlooks_draw.h"
-#include "clearlooks_style.h"
 #include "clearlooks_types.h"
 
 #include "support.h"
diff --git a/src/clearlooks_draw_gnome3.c b/src/clearlooks_draw_gnome3.c
index 4d818bb..b5dbf91 100644
--- a/src/clearlooks_draw_gnome3.c
+++ b/src/clearlooks_draw_gnome3.c
@@ -24,7 +24,6 @@
 
 
 #include "clearlooks_draw.h"
-#include "clearlooks_style.h"
 #include "clearlooks_types.h"
 
 #include "support.h"
diff --git a/src/clearlooks_draw_gummy.c b/src/clearlooks_draw_gummy.c
index 92f7c59..72a58b5 100644
--- a/src/clearlooks_draw_gummy.c
+++ b/src/clearlooks_draw_gummy.c
@@ -24,7 +24,6 @@
  
 
 #include "clearlooks_draw.h"
-#include "clearlooks_style.h"
 #include "clearlooks_types.h"
 
 #include "support.h"
diff --git a/src/clearlooks_draw_inverted.c b/src/clearlooks_draw_inverted.c
index bb1f97d..c9140be 100644
--- a/src/clearlooks_draw_inverted.c
+++ b/src/clearlooks_draw_inverted.c
@@ -23,7 +23,6 @@
  */
 
 #include "clearlooks_draw.h"
-#include "clearlooks_style.h"
 #include "clearlooks_types.h"
 
 #include "support.h"
diff --git a/src/clearlooks_style.c b/src/clearlooks_engine.c
similarity index 97%
rename from src/clearlooks_style.c
rename to src/clearlooks_engine.c
index e55d3f1..f333af7 100644
--- a/src/clearlooks_style.c
+++ b/src/clearlooks_engine.c
@@ -28,8 +28,7 @@
 #include <string.h>
 
 #include <ge-support.h>
-#include "clearlooks_style.h"
-#include "clearlooks_rc_style.h"
+#include "clearlooks_engine.h"
 #include "clearlooks_draw.h"
 #include "support.h"
 
@@ -53,9 +52,11 @@
 #include "animation.h"
 #endif
 
-#define STYLE_FUNCTION(function) (CLEARLOOKS_STYLE_GET_CLASS (style)->style_functions[CLEARLOOKS_STYLE (style)->style].function)
+#define STYLE_FUNCTION(function) (CLEARLOOKS_ENGINE_GET_CLASS (style)->style_functions[CLEARLOOKS_STYLE (style)->style].function)
 
-G_DEFINE_DYNAMIC_TYPE (ClearlooksStyle, clearlooks_style, GTK_TYPE_STYLE)
+G_DEFINE_DYNAMIC_TYPE (ClearlooksEngine, clearlooks_engine, GTK_TYPE_THEMING_ENGINE)
+
+#if 0
 
 static void
 clearlooks_set_widget_parameters (const GtkWidget      *widget,
@@ -1355,7 +1356,6 @@ clearlooks_style_init_from_rc (GtkStyle * style,
 	clearlooks_style->menubarstyle        = CLEARLOOKS_RC_STYLE (rc_style)->menubarstyle;
 	clearlooks_style->toolbarstyle        = CLEARLOOKS_RC_STYLE (rc_style)->toolbarstyle;
 	clearlooks_style->has_focus_color     = CLEARLOOKS_RC_STYLE (rc_style)->flags & CL_FLAG_FOCUS_COLOR;
-	clearlooks_style->has_focus_fill_color     = CLEARLOOKS_RC_STYLE (rc_style)->flags & CL_FLAG_FOCUS_FILL_COLOR;
 	clearlooks_style->has_scrollbar_color = CLEARLOOKS_RC_STYLE (rc_style)->flags & CL_FLAG_SCROLLBAR_COLOR;
 	clearlooks_style->colorize_scrollbar  = CLEARLOOKS_RC_STYLE (rc_style)->colorize_scrollbar;
 	clearlooks_style->animation           = CLEARLOOKS_RC_STYLE (rc_style)->animation;
@@ -1365,11 +1365,6 @@ clearlooks_style_init_from_rc (GtkStyle * style,
 
 	if (clearlooks_style->has_focus_color)
 		clearlooks_style->focus_color     = CLEARLOOKS_RC_STYLE (rc_style)->focus_color;
-	if (clearlooks_style->has_focus_fill_color) {
-		clearlooks_style->focus_fill_color = CLEARLOOKS_RC_STYLE (rc_style)->focus_fill_color;
-		clearlooks_style->focus_fill_alpha = CLEARLOOKS_RC_STYLE (rc_style)->focus_fill_alpha;
-        }
-
 	if (clearlooks_style->has_scrollbar_color)
 		clearlooks_style->scrollbar_color = CLEARLOOKS_RC_STYLE (rc_style)->scrollbar_color;
 }
@@ -1421,12 +1416,6 @@ clearlooks_style_realize (GtkStyle * style)
 		ge_gdk_color_to_cairo (&style->base[i], &clearlooks_style->colors.base[i]);
 		ge_gdk_color_to_cairo (&style->text[i], &clearlooks_style->colors.text[i]);
 	}
-
-        if (CLEARLOOKS_RC_STYLE (style->rc_style)->flags & CL_FLAG_GRADIENT)
-                clearlooks_style->colors.gradient =
-                        & (CLEARLOOKS_RC_STYLE (style->rc_style)->gradient);
-        else
-                clearlooks_style->colors.gradient = NULL;
 }
 
 static void
@@ -1579,17 +1568,6 @@ clearlooks_style_draw_focus (GtkStyle *style, cairo_t *cr, GtkStateType state_ty
 	}
 	else
 		focus.color = colors->bg[GTK_STATE_SELECTED];
-	if (clearlooks_style->has_focus_fill_color)
-	{
-		ge_gdk_color_to_cairo (&clearlooks_style->focus_fill_color, &focus.fill_color);
-                focus.fill_color.a = clearlooks_style->focus_fill_alpha;
-                focus.has_fill_color = TRUE;
-	}
-	else {
-		focus.fill_color = colors->bg[GTK_STATE_SELECTED];
-                focus.fill_color.a = 1.0;
-        }
-
 
 	STYLE_FUNCTION(draw_focus) (cr, colors, &params, &focus, x, y, width, height);
 
@@ -1608,8 +1586,6 @@ clearlooks_style_copy (GtkStyle * style, GtkStyle * src)
 	cl_style->toolbarstyle        = cl_src->toolbarstyle;
 	cl_style->focus_color         = cl_src->focus_color;
 	cl_style->has_focus_color     = cl_src->has_focus_color;
-	cl_style->focus_fill_color    = cl_src->focus_fill_color;
-	cl_style->has_focus_fill_color = cl_src->has_focus_fill_color;
 	cl_style->scrollbar_color     = cl_src->scrollbar_color;
 	cl_style->has_scrollbar_color = cl_src->has_scrollbar_color;
 	cl_style->colorize_scrollbar  = cl_src->colorize_scrollbar;
@@ -1822,20 +1798,23 @@ clearlooks_style_draw_render_icon (GtkStyle            *style,
 	return stated;
 }
 
+#endif /* if 0 */
+
 void
-clearlooks_style_register_types (GTypeModule *module)
+clearlooks_engine_register_types (GTypeModule *module)
 {
-  clearlooks_style_register_type (module);
+  clearlooks_engine_register_type (module);
 }
 
 static void
-clearlooks_style_init (ClearlooksStyle * style)
+clearlooks_engine_init (ClearlooksEngine *engine)
 {
 }
 
 static void
-clearlooks_style_class_init (ClearlooksStyleClass * klass)
+clearlooks_engine_class_init (ClearlooksEngineClass * klass)
 {
+#if 0
 	GtkStyleClass *style_class = GTK_STYLE_CLASS (klass);
 
 	style_class->copy             = clearlooks_style_copy;
@@ -1860,6 +1839,7 @@ clearlooks_style_class_init (ClearlooksStyleClass * klass)
 	style_class->draw_arrow       = clearlooks_style_draw_arrow;
 	style_class->draw_layout      = clearlooks_style_draw_layout;
 	style_class->render_icon      = clearlooks_style_draw_render_icon;
+#endif
 
 	clearlooks_register_style_classic (&klass->style_functions[CL_STYLE_CLASSIC],
 	                                   &klass->style_constants[CL_STYLE_CLASSIC]);
@@ -1886,6 +1866,6 @@ clearlooks_style_class_init (ClearlooksStyleClass * klass)
 }
 
 static void
-clearlooks_style_class_finalize (ClearlooksStyleClass *klass)
+clearlooks_engine_class_finalize (ClearlooksEngineClass *klass)
 {
 }
diff --git a/src/clearlooks_style.h b/src/clearlooks_engine.h
similarity index 60%
rename from src/clearlooks_style.h
rename to src/clearlooks_engine.h
index 3dcdc9b..f8aa5c4 100644
--- a/src/clearlooks_style.h
+++ b/src/clearlooks_engine.h
@@ -28,25 +28,25 @@
  
 #include <gtk/gtk.h>
 
-#ifndef CLEARLOOKS_STYLE_H
-#define CLEARLOOKS_STYLE_H
+#ifndef CLEARLOOKS_ENGINE_H
+#define CLEARLOOKS_ENGINE_H
 
 #include "animation.h"
 #include "clearlooks_types.h"
 
-typedef struct _ClearlooksStyle ClearlooksStyle;
-typedef struct _ClearlooksStyleClass ClearlooksStyleClass;
+typedef struct _ClearlooksEngine ClearlooksEngine;
+typedef struct _ClearlooksEngineClass ClearlooksEngineClass;
 
-#define CLEARLOOKS_TYPE_STYLE              (clearlooks_style_get_type ())
-#define CLEARLOOKS_STYLE(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), CLEARLOOKS_TYPE_STYLE, ClearlooksStyle))
-#define CLEARLOOKS_STYLE_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), CLEARLOOKS_TYPE_STYLE, ClearlooksStyleClass))
-#define CLEARLOOKS_IS_STYLE(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), CLEARLOOKS_TYPE_STYLE))
-#define CLEARLOOKS_IS_STYLE_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), CLEARLOOKS_TYPE_STYLE))
-#define CLEARLOOKS_STYLE_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), CLEARLOOKS_TYPE_STYLE, ClearlooksStyleClass))
+#define CLEARLOOKS_TYPE_ENGINE              (clearlooks_engine_get_type ())
+#define CLEARLOOKS_ENGINE(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), CLEARLOOKS_TYPE_ENGINE, ClearlooksEngine))
+#define CLEARLOOKS_ENGINE_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), CLEARLOOKS_TYPE_ENGINE, ClearlooksEngineClass))
+#define CLEARLOOKS_IS_ENGINE(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), CLEARLOOKS_TYPE_ENGINE))
+#define CLEARLOOKS_IS_ENGINE_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), CLEARLOOKS_TYPE_ENGINE))
+#define CLEARLOOKS_ENGINE_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), CLEARLOOKS_TYPE_ENGINE, ClearlooksEngineClass))
 
-struct _ClearlooksStyle
+struct _ClearlooksEngine
 {
-	GtkStyle parent_instance;
+	GtkThemingEngine parent_instance;
 
 	ClearlooksColors colors;
 
@@ -57,9 +57,6 @@ struct _ClearlooksStyle
 	guint8   toolbarstyle;
 	GdkColor focus_color;
 	gboolean has_focus_color;
-	GdkColor focus_fill_color;
-        gdouble  focus_fill_alpha;
-	gboolean has_focus_fill_color;
 	GdkColor scrollbar_color;
 	gboolean colorize_scrollbar;
 	gboolean has_scrollbar_color;
@@ -69,15 +66,15 @@ struct _ClearlooksStyle
 	gdouble  accel_label_shade;
 };
 
-struct _ClearlooksStyleClass
+struct _ClearlooksEngineClass
 {
-	GtkStyleClass parent_class;
+	GtkThemingEngineClass parent_class;
 
 	ClearlooksStyleFunctions style_functions[CL_NUM_STYLES];
 	ClearlooksStyleConstants style_constants[CL_NUM_STYLES];
 };
 
-GE_INTERNAL void  clearlooks_style_register_types (GTypeModule *module);
-GE_INTERNAL GType clearlooks_style_get_type       (void);
+GE_INTERNAL void  clearlooks_engine_register_types (GTypeModule *module);
+GE_INTERNAL GType clearlooks_engine_get_type       (void);
 
-#endif /* CLEARLOOKS_STYLE_H */
+#endif /* CLEARLOOKS_ENGINE_H */
diff --git a/src/clearlooks_theme_main.c b/src/clearlooks_theme_main.c
index d7b7965..89d91cc 100644
--- a/src/clearlooks_theme_main.c
+++ b/src/clearlooks_theme_main.c
@@ -24,14 +24,12 @@
 #include <gmodule.h>
 #include <gtk/gtk.h>
 
-#include "clearlooks_style.h"
-#include "clearlooks_rc_style.h"
+#include "clearlooks_engine.h"
 
 GE_EXPORT void
 theme_init (GTypeModule *module)
 {
-  clearlooks_rc_style_register_types (module);
-  clearlooks_style_register_types (module);
+  clearlooks_engine_register_types (module);
 }
 
 GE_EXPORT void
@@ -39,8 +37,10 @@ theme_exit (void)
 {
 }
 
-GE_EXPORT GtkRcStyle *
-theme_create_rc_style (void)
+GE_EXPORT GtkThemingEngine *
+create_engine (void)
 {
-  return GTK_RC_STYLE (g_object_new (CLEARLOOKS_TYPE_RC_STYLE, NULL));  
+  return GTK_THEMING_ENGINE (g_object_new (CLEARLOOKS_TYPE_ENGINE,
+					   "name", "clearlooks",
+					   NULL));
 }
diff --git a/src/engine.symbols b/src/engine.symbols
index ab1b7c4..6ad8c2e 100644
--- a/src/engine.symbols
+++ b/src/engine.symbols
@@ -1,4 +1,4 @@
 g_module_check_init
 theme_init
 theme_exit
-theme_create_rc_style
+create_engine



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