[cairo-commit] cairo-gtk-engine/src caligula.c,1.1,1.2

Kristian Hogsberg commit at pdx.freedesktop.org
Tue Feb 8 18:48:52 PST 2005


Committed by: krh

Update of /cvs/cairo/cairo-gtk-engine/src
In directory gabe:/tmp/cvs-serv2388/src

Modified Files:
	caligula.c 
Log Message:
2005-02-08  Kristian Høgsberg  <krh at redhat.com>

        * src/caligula.c: Add CaligulaRcStyle class so this thing will
        actually work.



Index: caligula.c
===================================================================
RCS file: /cvs/cairo/cairo-gtk-engine/src/caligula.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- caligula.c	8 Feb 2005 22:36:16 -0000	1.1
+++ caligula.c	9 Feb 2005 02:48:50 -0000	1.2
@@ -79,8 +79,6 @@
 
     cr = caligula_begin_paint (window, &x_offset, &y_offset);
   
-    g_message ("caligula_draw_box");
-
     cairo_set_rgb_color (cr, 0.5, 0.5, 1.0);
     cairo_rectangle (cr, x, y, width, height);
     cairo_fill (cr);
@@ -88,6 +86,7 @@
     caligula_end_paint (cr);
 }
 
+GTypeModule *caligula_module;
 
 typedef struct _CaligulaStyle CaligulaStyle;
 struct _CaligulaStyle {
@@ -99,48 +98,104 @@
   GtkStyleClass parent_class;
 };
 
+#define CALIGULA_TYPE_STYLE		(caligula_style_get_type ())
+#define CALIGULA_STYLE(obj)		(G_TYPE_CHECK_INSTANCE_CAST ((obj), CALIGULA_TYPE_STYLE, CaligulaStyle))
+#define CALIGULA_IS_STYLE(obj)	(G_TYPE_CHECK_INSTANCE_TYPE ((obj), CALIGULA_TYPE_STYLE))
+
 static void
 caligula_style_class_init (CaligulaStyleClass *klass)
 {
     GtkStyleClass *style_class = GTK_STYLE_CLASS (klass);
-    static gpointer parent_class;
-
-    parent_class = g_type_class_peek_parent (klass);
 
     style_class->draw_box = caligula_draw_box;
 }
 
-static void
-caligula_style_init (CaligulaStyle *style)
-{
-}
-
-static void
-caligula_style_register_type (GTypeModule * module)
+static GType
+caligula_style_get_type (void)
 {
     static GType type;
 
     if (type == 0)
       {
 	static const GTypeInfo type_info = {
-	  sizeof (GtkStyleClass),
+	  sizeof (CaligulaStyleClass),
 	  (GBaseInitFunc) NULL,
 	  (GBaseFinalizeFunc) NULL,
 	  (GClassInitFunc) caligula_style_class_init,
-	  NULL,					/* class_finalize */
-	  NULL,					/* class_data */
+	  NULL,
+	  NULL,
 	  sizeof (CaligulaStyle),
-	  0,					/* n_preallocs */
-	  (GInstanceInitFunc) caligula_style_init,
+	  0,
+	  NULL,
 	};
   
-	type = g_type_module_register_type (module,
+	type = g_type_module_register_type (caligula_module,
 					    GTK_TYPE_STYLE,
 					    "CaligulaStyle",
 					    &type_info, 0);
       }
+
+    return type;
 }
 
+typedef struct _CaligulaRcStyle CaligulaRcStyle;
+struct _CaligulaRcStyle {
+  GtkRcStyle parent_instance;
+};
+
+typedef struct _CaligulaRcStyleClass CaligulaRcStyleClass;
+struct _CaligulaRcStyleClass {
+  GtkRcStyleClass parent_class;
+};
+
+#define CALIGULA_TYPE_RC_STYLE		(caligula_rc_style_get_type ())
+#define CALIGULA_RC_STYLE(obj)		(G_TYPE_CHECK_INSTANCE_CAST ((obj), CALIGULA_TYPE_RC_STYLE, CaligulaRcStyle))
+#define CALIGULA_IS_RC_STYLE(obj)	(G_TYPE_CHECK_INSTANCE_TYPE ((obj), CALIGULA_TYPE_RC_STYLE))
+
+static void      caligula_rc_style_class_init   (CaligulaRcStyleClass *klass);
+static GtkStyle *caligula_rc_style_create_style (GtkRcStyle           *style);
+
+static GType
+caligula_rc_style_get_type (void)
+{
+    static GType type;
+
+    if (type == 0)
+      {
+	  static const GTypeInfo type_info = {
+	    sizeof (CaligulaRcStyleClass),
+	    (GBaseInitFunc) NULL,
+	    (GBaseFinalizeFunc) NULL,
+	    (GClassInitFunc) caligula_rc_style_class_init,
+	    NULL,
+	    NULL,
+	    sizeof (CaligulaRcStyle),
+	    0,
+	    NULL
+	  };
+
+	  type = g_type_module_register_type (caligula_module,
+					      GTK_TYPE_RC_STYLE,
+					      "CaligulaRCStyle",
+					      &type_info, 0);
+      }
+
+    return type;
+}
+
+static void
+caligula_rc_style_class_init (CaligulaRcStyleClass *klass)
+{
+    GtkRcStyleClass *style_class = GTK_RC_STYLE_CLASS (klass);
+
+    style_class->create_style = caligula_rc_style_create_style;
+}
+
+static GtkStyle *
+caligula_rc_style_create_style (GtkRcStyle *style)
+{
+  return g_object_new (CALIGULA_TYPE_STYLE, NULL);
+}
 
 G_MODULE_EXPORT void
 theme_init (GTypeModule * module);
@@ -148,11 +203,11 @@
 G_MODULE_EXPORT void
 theme_init (GTypeModule * module)
 {
-  caligula_style_register_type (module);
+  caligula_module = module;
 }
 
-G_MODULE_EXPORT
-void theme_exit (GTypeModule * module);
+G_MODULE_EXPORT void
+theme_exit (GTypeModule * module);
 
 G_MODULE_EXPORT void
 theme_exit (GTypeModule * module)
@@ -160,10 +215,10 @@
 }
 
 G_MODULE_EXPORT GtkRcStyle *
-theme_create_rc_style (void); 
+theme_create_rc_style (void);
 
 G_MODULE_EXPORT GtkRcStyle *
 theme_create_rc_style (void)
 {
-  return g_object_new (GTK_TYPE_RC_STYLE, NULL);
+  return g_object_new (CALIGULA_TYPE_RC_STYLE, NULL);
 }




More information about the cairo-commit mailing list