marlin r1295 - trunk/marlin



Author: iain
Date: Sat Oct  4 01:36:53 2008
New Revision: 1295
URL: http://svn.gnome.org/viewvc/marlin?rev=1295&view=rev

Log:
Update MarlinPipeline to modern GObject boilerplate


Modified:
   trunk/marlin/ChangeLog
   trunk/marlin/marlin-pipeline.c

Modified: trunk/marlin/marlin-pipeline.c
==============================================================================
--- trunk/marlin/marlin-pipeline.c	(original)
+++ trunk/marlin/marlin-pipeline.c	Sat Oct  4 01:36:53 2008
@@ -33,8 +33,6 @@
 #include <marlin/marlin-operation.h>
 #include <marlin/marlin-mt.h>
 
-#define MARLIN_PIPELINE_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), MARLIN_PIPELINE_TYPE, MarlinPipelinePrivate))
-
 enum {
 	LAST_SIGNAL
 };
@@ -50,7 +48,8 @@
 	guint32 position_tracker;
 };
 
-static GObjectClass *parent_class = NULL;
+#define GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), MARLIN_PIPELINE_TYPE, MarlinPipelinePrivate))
+G_DEFINE_TYPE (MarlinPipeline, marlin_pipeline, GST_TYPE_PIPELINE);
 
 static void
 finalize (GObject *object)
@@ -61,7 +60,7 @@
 	pipeline = MARLIN_PIPELINE (object);
 	priv = pipeline->priv;
 
-	parent_class->finalize (object);
+	G_OBJECT_CLASS (marlin_pipeline_parent_class)->finalize (object);
 }
 
 static void
@@ -83,7 +82,7 @@
 		priv->operation = NULL;
 	}
 
-	parent_class->dispose (object);
+	G_OBJECT_CLASS (marlin_pipeline_parent_class)->dispose (object);
 }
 
 static void
@@ -131,19 +130,18 @@
 }
 
 static void
-class_init (MarlinPipelineClass *klass)
+marlin_pipeline_class_init (MarlinPipelineClass *klass)
 {
 	GObjectClass *o_class;
 
 	o_class = (GObjectClass *) klass;
-	
+
 	o_class->finalize = finalize;
 	o_class->dispose = dispose;
 	o_class->set_property = set_property;
 	o_class->get_property = get_property;
 
 	g_type_class_add_private (klass, sizeof (MarlinPipelinePrivate));
-	parent_class = g_type_class_peek_parent (o_class);
 
 	g_object_class_install_property (o_class,
 					 PROP_OPERATION,
@@ -170,7 +168,7 @@
 	return TRUE;
 }
 
-static void 
+static void
 bus_message_cb (GstBus     *bus,
 		GstMessage *message,
 		gpointer    data)
@@ -199,7 +197,7 @@
 	case GST_MESSAGE_ERROR: {
 		GError *error;
 		char *debug;
-		
+
 		if (GST_MESSAGE_TYPE (message) == GST_MESSAGE_ERROR) {
 			gst_message_parse_error (message, &error, &debug);
 		} else {
@@ -207,7 +205,7 @@
 		}
 
 		if (priv->operation) {
-			marlin_operation_set_error (priv->operation, error, 
+			marlin_operation_set_error (priv->operation, error,
 						    debug);
 		}
 		g_error_free (error);
@@ -231,7 +229,7 @@
 		} else if (old == GST_STATE_READY &&
 			   new == GST_STATE_PAUSED) {
 			/* Start the position tracker */
-			priv->position_tracker = g_timeout_add 
+			priv->position_tracker = g_timeout_add
 				(200, position_tracker, pipeline);
 		} else if (old == GST_STATE_PAUSED &&
 			   new == GST_STATE_READY) {
@@ -252,10 +250,10 @@
 }
 
 static void
-init (MarlinPipeline *pipeline)
+marlin_pipeline_init (MarlinPipeline *pipeline)
 {
 	GstBus *bus;
-	pipeline->priv = MARLIN_PIPELINE_GET_PRIVATE (pipeline);
+	pipeline->priv = GET_PRIVATE (pipeline);
 
 	pipeline->priv->operation = NULL;
 
@@ -265,26 +263,6 @@
 			  G_CALLBACK (bus_message_cb), pipeline);
 }
 
-GType
-marlin_pipeline_get_type (void)
-{
-	static GType type = 0;
-
-	if (type == 0) {
-		static GTypeInfo info = {
-			sizeof (MarlinPipelineClass), NULL, NULL,
-			(GClassInitFunc) class_init, NULL, NULL,
-			sizeof (MarlinPipeline), 0, (GInstanceInitFunc) init
-		};
-
-		type = g_type_register_static (GST_TYPE_PIPELINE,
-					       "MarlinPipeline",
-					       &info, 0);
-	}
-
-	return type;
-}
-
 /**
  * marlin_pipeline_get_operation:
  * @pipeline: A #MarlinPipeline.



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