marlin r1294 - trunk/marlin



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

Log:
Update LoadPipeline


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

Modified: trunk/marlin/marlin-load-pipeline.c
==============================================================================
--- trunk/marlin/marlin-load-pipeline.c	(original)
+++ trunk/marlin/marlin-load-pipeline.c	Sat Oct  4 01:33:45 2008
@@ -33,8 +33,6 @@
 #include <marlin-load-pipeline.h>
 #include <marlin-sample.h>
 
-#define MARLIN_LOAD_PIPELINE_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), MARLIN_LOAD_PIPELINE_TYPE, MarlinLoadPipelinePrivate))
-
 enum {
 	PROP_0,
 	PROP_SAMPLE,
@@ -56,7 +54,8 @@
 	GstPad *audio_pad;
 };
 
-static GObjectClass *parent_class = NULL;
+#define GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), MARLIN_LOAD_PIPELINE_TYPE, MarlinLoadPipelinePrivate))
+G_DEFINE_TYPE (MarlinLoadPipeline, marlin_load_pipeline, MARLIN_PIPELINE_TYPE)
 
 GQuark
 marlin_load_pipeline_error_quark (void)
@@ -84,11 +83,11 @@
 
 	g_ptr_array_free (priv->sinks, TRUE);
 
-	parent_class->finalize (object);
+	G_OBJECT_CLASS (marlin_load_pipeline_parent_class)->finalize (object);
 }
 
 static void
-dispose (GObject *object) 
+dispose (GObject *object)
 {
 	MarlinLoadPipeline *pipeline;
 	MarlinLoadPipelinePrivate *priv;
@@ -101,7 +100,7 @@
 		priv->sample = NULL;
 	}
 
-	parent_class->dispose (object);
+	G_OBJECT_CLASS (marlin_load_pipeline_parent_class)->dispose (object);
 }
 
 static void
@@ -185,7 +184,7 @@
 	GstElement *element;
 	GstFormat fmt;
 	gint64 pos, duration;
-	
+
 	pipeline = (MarlinLoadPipeline *) marlin_pipeline;
 	priv = pipeline->priv;
 
@@ -197,7 +196,7 @@
 		MarlinOperation *operation;
 		float p;
 		int percentage;
-		
+
 		p = ((float) pos) / ((float) duration);
 		percentage = (int) (p * 100);
 
@@ -205,7 +204,7 @@
 		if (operation) {
 			marlin_operation_progress (operation, percentage);
 		}
-							   
+
 		return pos;
 	}
 
@@ -213,31 +212,31 @@
 }
 
 static void
-class_init (GObjectClass *klass)
+marlin_load_pipeline_class_init (MarlinLoadPipelineClass *klass)
 {
+	GObjectClass *o_class = (GObjectClass *) klass;
 	MarlinPipelineClass *p_class;
 
 	p_class = (MarlinPipelineClass *) klass;
 
-	klass->finalize = finalize;
-	klass->dispose = dispose;
-	klass->set_property = set_property;
-	klass->get_property = get_property;
+	o_class->finalize = finalize;
+	o_class->dispose = dispose;
+	o_class->set_property = set_property;
+	o_class->get_property = get_property;
 
 	p_class->report_position = report_position;
 
-	parent_class = g_type_class_peek_parent (klass);
-	g_type_class_add_private (klass, sizeof (MarlinLoadPipelinePrivate));
+	g_type_class_add_private (o_class, sizeof (MarlinLoadPipelinePrivate));
 
 	/* Properties */
-	g_object_class_install_property (klass,
+	g_object_class_install_property (o_class,
 					 PROP_SAMPLE,
 					 g_param_spec_object ("sample",
 							      "", "",
 							      MARLIN_SAMPLE_TYPE,
 							      G_PARAM_READWRITE));
 
-	g_object_class_install_property (klass,
+	g_object_class_install_property (o_class,
 					 PROP_FILENAME,
 					 g_param_spec_string ("filename",
 							      "", "",
@@ -470,7 +469,7 @@
 			} else {
 				g_print ("Pipeline has reached paused, but has not audio pad yet\n");
 			}
-		} 
+		}
 		break;
 	}
 
@@ -484,7 +483,7 @@
 		gst_tag_list_free (tags);
 		break;
 	}
-		
+
 	default:
 		break;
 	}
@@ -493,12 +492,12 @@
 }
 
 static void
-init (MarlinLoadPipeline *pipeline)
+marlin_load_pipeline_init (MarlinLoadPipeline *pipeline)
 {
 	MarlinLoadPipelinePrivate *priv;
 	GstBus *bus;
 
-	pipeline->priv = MARLIN_LOAD_PIPELINE_GET_PRIVATE (pipeline);
+	pipeline->priv = GET_PRIVATE (pipeline);
 	priv = pipeline->priv;
 
 	priv->sinks = g_ptr_array_new ();
@@ -524,26 +523,6 @@
 			  G_CALLBACK (bus_message_cb), pipeline);
 }
 
-GType
-marlin_load_pipeline_get_type (void)
-{
-	static GType type = 0;
-
-	if (type == 0) {
-		static GTypeInfo info = {
-			sizeof (MarlinLoadPipelineClass), NULL, NULL,
-			(GClassInitFunc) class_init, NULL, NULL,
-			sizeof (MarlinLoadPipeline), 0, (GInstanceInitFunc) init
-		};
-
-		type = g_type_register_static (MARLIN_PIPELINE_TYPE,
-					       "MarlinLoadPipeline",
-					       &info, 0);
-	}
-	
-	return type;
-}
-
 MarlinLoadPipeline *
 marlin_load_pipeline_new (MarlinOperation *operation)
 {



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