[gtk-theme-engine-clearlooks/gtk-style-context: 4/21] Register needed types
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk-theme-engine-clearlooks/gtk-style-context: 4/21] Register needed types
- Date: Tue, 16 Nov 2010 12:26:13 +0000 (UTC)
commit 3aeda2075c6fe9c1ade193b1bdf87647c17517d9
Author: Carlos Garnacho <carlosg gnome org>
Date: Tue Nov 16 00:50:55 2010 +0100
Register needed types
configure.ac | 1 +
src/Makefile.am | 32 ++++++++-
src/clearlooks_engine.c | 116 ++++++++++++++++-----------------
src/clearlooks_engine.h | 17 +++++-
src/clearlooks_typebuiltin.c.template | 37 +++++++++++
src/clearlooks_typebuiltin.h.template | 27 ++++++++
6 files changed, 164 insertions(+), 66 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 506319e..409eb43 100644
--- a/configure.ac
+++ b/configure.ac
@@ -14,6 +14,7 @@ AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_MAKE_SET
AM_PROG_CC_C_O
+AM_PATH_GLIB_2_0
dnl Initialize libtool
AM_DISABLE_STATIC
diff --git a/src/Makefile.am b/src/Makefile.am
index 59ae353..b08bb7e 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -4,7 +4,12 @@ INCLUDES = $(GTK_CFLAGS) $(DEVELOPMENT_CFLAGS)
enginedir = $(libdir)/gtk-3.0/$(GTK_VERSION)/engines
engine_LTLIBRARIES = libclearlooks.la
+BUILT_SOURCES = \
+ clearlooks_typebuiltin.c \
+ clearlooks_typebuiltin.h
+
libclearlooks_la_SOURCES = \
+ $(BUILT_SOURCES) \
cairo-support.c \
cairo-support.h \
general-support.h \
@@ -19,16 +24,35 @@ libclearlooks_la_SOURCES = \
animation.h \
support.h \
clearlooks_draw.c \
- clearlooks_draw_glossy.c \
- clearlooks_draw_inverted.c \
- clearlooks_draw_gummy.c \
- clearlooks_draw_gnome3.c \
clearlooks_draw.h \
clearlooks_types.h
+# clearlooks_draw_glossy.c \
+# clearlooks_draw_inverted.c \
+# clearlooks_draw_gummy.c \
+# clearlooks_draw_gnome3.c
+
libclearlooks_la_LDFLAGS = -module -avoid-version -no-undefined -export-symbols $(top_srcdir)/src/engine.symbols
libclearlooks_la_LIBADD = $(GTK_LIBS)
+clearlooks_typebuiltin.h: clearlooks_engine.h Makefile clearlooks_typebuiltin.h.template
+ @( cd $(srcdir) && $(GLIB_MKENUMS) --template ./clearlooks_typebuiltin.h.template \
+ ./clearlooks_engine.h ) >> xgen-gtbh \
+ && (cmp -s xgen-gtbh $@ || (echo "Creating $ "; cp xgen-gtbh $@) ) \
+ && rm -f xgen-gtbh
+
+clearlooks_typebuiltin.c: clearlooks_engine.h Makefile clearlooks_typebuiltin.c.template
+ @( cd $(srcdir) && $(GLIB_MKENUMS) --template ./clearlooks_typebuiltin.c.template \
+ ./clearlooks_engine.h ) > xgen-gtbc \
+ && (cmp -s xgen-gtbc $@ || (echo "Creating $ "; cp xgen-gtbc $@) ) \
+ && rm -f xgen-gtbc
+
+CLEANFILES = $(BUILT_SOURCES)
+
+EXTRA_DIST = \
+ clearlooks_typebuiltin.c.template \
+ clearlooks_typebuiltin.h.template
+
EXTRA_DIST = engine.symbols
-include $(top_srcdir)/git.mk
diff --git a/src/clearlooks_engine.c b/src/clearlooks_engine.c
index 1b8a897..7fdc6de 100644
--- a/src/clearlooks_engine.c
+++ b/src/clearlooks_engine.c
@@ -28,12 +28,14 @@
#include <string.h>
#include <ge-support.h>
+#include "clearlooks_typebuiltin.h"
#include "clearlooks_engine.h"
#include "clearlooks_draw.h"
#include "support.h"
/* #define DEBUG 1 */
+#define CLEARLOOKS_NAMESPACE "clearlooks"
#define DETAIL(xx) ((detail) && (!strcmp(xx, detail)))
#define CHECK_HINT(xx) (ge_check_hint ((xx), CLEARLOOKS_RC_STYLE ((style)->rc_style)->hint, widget))
@@ -62,6 +64,7 @@ clearlooks_set_parameters (GtkThemingEngine *engine,
WidgetParameters *params)
{
params->style_functions = &(CLEARLOOKS_ENGINE_GET_CLASS (engine)->style_functions[CLEARLOOKS_ENGINE (engine)->style]);
+#if 0
params->style_constants = &(CLEARLOOKS_ENGINE_GET_CLASS (engine)->style_constants[CLEARLOOKS_ENGINE (engine)->style]);
params->active = (state & GTK_STATE_FLAG_ACTIVE) != 0;
@@ -75,7 +78,6 @@ clearlooks_set_parameters (GtkThemingEngine *engine,
params->enable_shadow = FALSE;
params->radius = CLEARLOOKS_ENGINE (engine)->radius;
-#if 0
params->xthickness = style->xthickness;
params->ythickness = style->ythickness;
@@ -1343,34 +1345,6 @@ clearlooks_style_draw_arrow (GtkStyle *style,
}
static void
-clearlooks_style_init_from_rc (GtkStyle * style,
- GtkRcStyle * rc_style)
-{
- ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style);
-
- GTK_STYLE_CLASS (clearlooks_style_parent_class)->init_from_rc (style, rc_style);
-
- g_assert ((CLEARLOOKS_RC_STYLE (rc_style)->style >= 0) && (CLEARLOOKS_RC_STYLE (rc_style)->style < CL_NUM_STYLES));
- clearlooks_style->style = CLEARLOOKS_RC_STYLE (rc_style)->style;
-
- clearlooks_style->reliefstyle = CLEARLOOKS_RC_STYLE (rc_style)->reliefstyle;
- 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_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;
- clearlooks_style->radius = CLAMP (CLEARLOOKS_RC_STYLE (rc_style)->radius, 0.0, 10.0);
- clearlooks_style->disable_focus = CLEARLOOKS_RC_STYLE (rc_style)->disable_focus;
- clearlooks_style->accel_label_shade = CLEARLOOKS_RC_STYLE (rc_style)->accel_label_shade;
-
- if (clearlooks_style->has_focus_color)
- clearlooks_style->focus_color = CLEARLOOKS_RC_STYLE (rc_style)->focus_color;
- if (clearlooks_style->has_scrollbar_color)
- clearlooks_style->scrollbar_color = CLEARLOOKS_RC_STYLE (rc_style)->scrollbar_color;
-}
-
-static void
clearlooks_style_realize (GtkStyle * style)
{
ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style);
@@ -1574,35 +1548,6 @@ clearlooks_style_draw_focus (GtkStyle *style, cairo_t *cr, GtkStateType state_ty
g_free (focus.dash_list);
}
-
-static void
-clearlooks_style_copy (GtkStyle * style, GtkStyle * src)
-{
- ClearlooksStyle * cl_style = CLEARLOOKS_STYLE (style);
- ClearlooksStyle * cl_src = CLEARLOOKS_STYLE (src);
-
- cl_style->colors = cl_src->colors;
- cl_style->reliefstyle = cl_src->reliefstyle;
- cl_style->menubarstyle = cl_src->menubarstyle;
- 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->scrollbar_color = cl_src->scrollbar_color;
- cl_style->has_scrollbar_color = cl_src->has_scrollbar_color;
- cl_style->colorize_scrollbar = cl_src->colorize_scrollbar;
- cl_style->animation = cl_src->animation;
- cl_style->radius = cl_src->radius;
- cl_style->style = cl_src->style;
- cl_style->disable_focus = cl_src->disable_focus;
-
- GTK_STYLE_CLASS (clearlooks_style_parent_class)->copy (style, src);
-}
-
-static void
-clearlooks_style_unrealize (GtkStyle * style)
-{
- GTK_STYLE_CLASS (clearlooks_style_parent_class)->unrealize (style);
-}
#endif
static GdkPixbuf *
@@ -1684,14 +1629,16 @@ clearlooks_engine_render_layout (GtkThemingEngine *engine,
gtk_theming_engine_has_class (engine, GTK_STYLE_CLASS_ACCELERATOR)) {
ClearlooksEngine *clearlooks_engine = CLEARLOOKS_ENGINE (engine);
CairoColor *bg_color, *color, mix;
+ gdouble accel_label_shade;
gtk_theming_engine_get (engine, state,
"background-color", &bg_color,
+ "-clearlooks-accel-label-shade", &accel_label_shade,
"color", &color,
NULL);
ge_mix_color (bg_color, color,
- clearlooks_engine->accel_label_shade,
+ accel_label_shade,
&mix);
ge_cairo_set_color (cr, &mix);
@@ -1798,8 +1745,10 @@ clearlooks_engine_register_types (GTypeModule *module)
}
static void
-clearlooks_engine_init (ClearlooksEngine *engine)
+clearlooks_engine_init (ClearlooksEngine *clearlooks_engine)
{
+ clearlooks_register_style_classic (&clearlooks_engine->style_functions[CL_STYLE_CLASSIC],
+ &clearlooks_engine->style_constants[CL_STYLE_CLASSIC]);
}
static void
@@ -1809,6 +1758,50 @@ clearlooks_engine_class_init (ClearlooksEngineClass * klass)
engine_class->render_layout = clearlooks_engine_render_layout;
engine_class->render_icon_pixbuf = clearlooks_engine_render_icon_pixbuf;
+
+ gtk_theming_engine_register_property (CLEARLOOKS_NAMESPACE, NULL,
+ g_param_spec_boolean ("disable-focus",
+ "Disable focus",
+ "Disable focus",
+ FALSE, 0));
+ gtk_theming_engine_register_property (CLEARLOOKS_NAMESPACE, NULL,
+ g_param_spec_boolean ("colorize-scrollbar",
+ "Colorize scrollbar",
+ "Colorize scrollbar",
+ FALSE, 0));
+ gtk_theming_engine_register_property (CLEARLOOKS_NAMESPACE, NULL,
+ g_param_spec_boxed ("focus-color",
+ "Focus color",
+ "Focus color",
+ GDK_TYPE_RGBA, 0));
+ gtk_theming_engine_register_property (CLEARLOOKS_NAMESPACE, NULL,
+ g_param_spec_boxed ("scrollbar-color",
+ "Scrollbar color",
+ "Scrollbar color",
+ GDK_TYPE_RGBA, 0));
+ gtk_theming_engine_register_property (CLEARLOOKS_NAMESPACE, NULL,
+ g_param_spec_double ("contrast",
+ "Contrast",
+ "Contrast",
+ 0, 10, 1, 0));
+ gtk_theming_engine_register_property (CLEARLOOKS_NAMESPACE, NULL,
+ g_param_spec_double ("shade",
+ "Shade",
+ "Shade",
+ 0, 10, 0, 0));
+ gtk_theming_engine_register_property (CLEARLOOKS_NAMESPACE, NULL,
+ g_param_spec_double ("accel-label-shade",
+ "Accelerator label shade",
+ "Accelerator label shade",
+ 0, 10, 0, 0));
+ gtk_theming_engine_register_property (CLEARLOOKS_NAMESPACE, NULL,
+ g_param_spec_enum ("style",
+ "Clearlooks Style",
+ "Clearlooks Style",
+ CLEARLOOKS_TYPE_STYLE,
+ CLEARLOOKS_STYLE_CLASSIC,
+ 0));
+
#if 0
GtkStyleClass *style_class = GTK_STYLE_CLASS (klass);
@@ -1834,7 +1827,6 @@ clearlooks_engine_class_init (ClearlooksEngineClass * 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]);
@@ -1858,6 +1850,8 @@ clearlooks_engine_class_init (ClearlooksEngineClass * klass)
klass->style_constants[CL_STYLE_GNOME3] = klass->style_constants[CL_STYLE_CLASSIC];
clearlooks_register_style_gnome3 (&klass->style_functions[CL_STYLE_GNOME3],
&klass->style_constants[CL_STYLE_GNOME3]);
+
+#endif
}
static void
diff --git a/src/clearlooks_engine.h b/src/clearlooks_engine.h
index f8aa5c4..acfddc5 100644
--- a/src/clearlooks_engine.h
+++ b/src/clearlooks_engine.h
@@ -44,14 +44,29 @@ typedef struct _ClearlooksEngineClass ClearlooksEngineClass;
#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))
+typedef enum
+{
+ CLEARLOOKS_STYLE_CLASSIC = 0,
+ CLEARLOOKS_STYLE_GLOSSY = 1,
+ CLEARLOOKS_STYLE_INVERTED = 2,
+ CLEARLOOKS_STYLE_GUMMY = 3,
+ CLEARLOOKS_STYLE_GNOME3 = 4,
+} ClearlooksStyle;
+
struct _ClearlooksEngine
{
GtkThemingEngine parent_instance;
+ ClearlooksStyleFunctions style_functions[CL_NUM_STYLES];
+ ClearlooksStyleConstants style_constants[CL_NUM_STYLES];
+
+
ClearlooksColors colors;
ClearlooksStyles style;
+
+#if 0
guint8 reliefstyle;
guint8 menubarstyle;
guint8 toolbarstyle;
@@ -64,6 +79,7 @@ struct _ClearlooksEngine
gfloat radius;
gboolean disable_focus;
gdouble accel_label_shade;
+#endif
};
struct _ClearlooksEngineClass
@@ -71,7 +87,6 @@ struct _ClearlooksEngineClass
GtkThemingEngineClass parent_class;
ClearlooksStyleFunctions style_functions[CL_NUM_STYLES];
- ClearlooksStyleConstants style_constants[CL_NUM_STYLES];
};
GE_INTERNAL void clearlooks_engine_register_types (GTypeModule *module);
diff --git a/src/clearlooks_typebuiltin.c.template b/src/clearlooks_typebuiltin.c.template
new file mode 100644
index 0000000..2dec9c5
--- /dev/null
+++ b/src/clearlooks_typebuiltin.c.template
@@ -0,0 +1,37 @@
+/*** BEGIN file-header ***/
+#include <gtk/gtk.h>
+#include "clearlooks_typebuiltin.h"
+
+/*** END file-header ***/
+
+/*** BEGIN file-production ***/
+/* enumerations from "@filename@" */
+/*** END file-production ***/
+
+/*** BEGIN value-header ***/
+GType
+ enum_name@_get_type (void)
+{
+ static GType etype = 0;
+ if (G_UNLIKELY(etype == 0)) {
+ static const G Type@Value values[] = {
+/*** END value-header ***/
+
+/*** BEGIN value-production ***/
+ { @VALUENAME@, "@VALUENAME@", "@valuenick@" },
+/*** END value-production ***/
+
+/*** BEGIN value-tail ***/
+ { 0, NULL, NULL }
+ };
+ etype = g_ type@_register_static (g_intern_static_string ("@EnumName@"), values);
+ }
+ return etype;
+}
+
+/*** END value-tail ***/
+
+/*** BEGIN file-tail ***/
+
+/*** END file-tail ***/
+
diff --git a/src/clearlooks_typebuiltin.h.template b/src/clearlooks_typebuiltin.h.template
new file mode 100644
index 0000000..b2913df
--- /dev/null
+++ b/src/clearlooks_typebuiltin.h.template
@@ -0,0 +1,27 @@
+/*** BEGIN file-header ***/
+
+#ifndef __CLEARLOOKS_BUILTINS_H__
+#define __CLEARLOOKS_BUILTINS_H__
+
+#include <glib-object.h>
+#include "clearlooks_engine.h"
+
+G_BEGIN_DECLS
+/*** END file-header ***/
+
+/*** BEGIN file-production ***/
+
+/* enumerations from "@filename@" */
+/*** END file-production ***/
+
+/*** BEGIN value-header ***/
+GType @enum_name _get_type (void) G_GNUC_CONST;
+#define @ENUMPREFIX _TYPE_@ENUMSHORT@ (@enum_name _get_type ())
+/*** END value-header ***/
+
+/*** BEGIN file-tail ***/
+G_END_DECLS
+
+#endif /* __CLEARLOOKS_BUILTINS_H__ */
+/*** END file-tail ***/
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]