marlin r1298 - trunk/marlin
- From: iain svn gnome org
- To: svn-commits-list gnome org
- Subject: marlin r1298 - trunk/marlin
- Date: Wed, 8 Oct 2008 18:51:37 +0000 (UTC)
Author: iain
Date: Wed Oct 8 18:51:37 2008
New Revision: 1298
URL: http://svn.gnome.org/viewvc/marlin?rev=1298&view=rev
Log:
Update the code to use new GObject standards
Modified:
trunk/marlin/ChangeLog
trunk/marlin/marlin-sample-selection.c
trunk/marlin/marlin-save-pipeline.c
trunk/marlin/marlin-undo-manager.c
Modified: trunk/marlin/marlin-sample-selection.c
==============================================================================
--- trunk/marlin/marlin-sample-selection.c (original)
+++ trunk/marlin/marlin-sample-selection.c Wed Oct 8 18:51:37 2008
@@ -41,7 +41,9 @@
guint64 finish;
};
-static GObjectClass *parent_class = NULL;
+#define GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), MARLIN_SAMPLE_SELECTION_TYPE, MarlinSampleSelectionPrivate))
+G_DEFINE_TYPE (MarlinSampleSelection, marlin_sample_selection, G_TYPE_OBJECT);
+
static guint signals[LAST_SIGNAL];
static void
@@ -53,13 +55,11 @@
marlin_read_write_lock_destroy (selection->priv->lock);
- g_free (selection->priv);
-
- parent_class->finalize (object);
+ G_OBJECT_CLASS (marlin_sample_selection_parent_class)->finalize (object);
}
static void
-class_init (MarlinSampleSelectionClass *klass)
+marlin_sample_selection_class_init (MarlinSampleSelectionClass *klass)
{
GObjectClass *object_class;
@@ -67,7 +67,7 @@
object_class->finalize = finalize;
- parent_class = g_type_class_peek_parent (klass);
+ g_type_class_add_private (object_class, sizeof (MarlinSampleSelectionPrivate));
signals[CHANGED] = g_signal_new ("changed",
G_TYPE_FROM_CLASS (klass),
@@ -80,36 +80,17 @@
}
static void
-init (MarlinSampleSelection *selection)
+marlin_sample_selection_init (MarlinSampleSelection *selection)
{
MarlinSampleSelectionPrivate *priv;
- priv = g_new0 (MarlinSampleSelectionPrivate, 1);
+ priv = GET_PRIVATE (selection);
selection->priv = priv;
priv->lock = marlin_read_write_lock_new ();
priv->coverage = MARLIN_COVERAGE_NONE;
}
-GType
-marlin_sample_selection_get_type (void)
-{
- static GType type = 0;
-
- if (type == 0) {
- GTypeInfo info = {
- sizeof (MarlinSampleSelectionClass), NULL, NULL,
- (GClassInitFunc) class_init, NULL, NULL,
- sizeof (MarlinSampleSelection), 0, (GInstanceInitFunc) init
- };
-
- type = g_type_register_static (G_TYPE_OBJECT,
- "MarlinSampleSelection", &info, 0);
- }
-
- return type;
-}
-
MarlinSampleSelection *
marlin_sample_selection_new (void)
{
@@ -138,7 +119,7 @@
c->start = old_s;
c->finish = old_f;
}
-
+
static void
selection_destroy (gpointer data)
{
@@ -163,7 +144,7 @@
marlin_sample_selection_get (selection, &c->coverage,
&c->start, &c->finish);
-
+
u = marlin_undoable_new (selection_undo_redo,
selection_undo_redo,
selection_destroy,
Modified: trunk/marlin/marlin-save-pipeline.c
==============================================================================
--- trunk/marlin/marlin-save-pipeline.c (original)
+++ trunk/marlin/marlin-save-pipeline.c Wed Oct 8 18:51:37 2008
@@ -35,7 +35,8 @@
#include <marlin/marlin-channel-src.h>
#include <marlin/marlin-channel-joiner.h>
-#define MARLIN_SAVE_PIPELINE_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), MARLIN_SAVE_PIPELINE_TYPE, MarlinSavePipelinePrivate))
+#define GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), MARLIN_SAVE_PIPELINE_TYPE, MarlinSavePipelinePrivate))
+G_DEFINE_TYPE (MarlinSavePipeline, marlin_save_pipeline, MARLIN_PIPELINE_TYPE);
enum {
PROP_0,
@@ -54,8 +55,6 @@
GPtrArray *srcs; /* Array of MarlinChannelSrc */
};
-static GObjectClass *parent_class = NULL;
-
static void
finalize (GObject *object)
{
@@ -69,7 +68,7 @@
g_ptr_array_free (priv->srcs, TRUE);
}
- parent_class->finalize (object);
+ G_OBJECT_CLASS (marlin_save_pipeline_parent_class)->finalize (object);
}
static void
@@ -86,7 +85,7 @@
priv->sample = NULL;
}
- parent_class->dispose (object);
+ G_OBJECT_CLASS (marlin_save_pipeline_parent_class)->dispose (object);
}
static gboolean
@@ -97,7 +96,7 @@
guint channels;
int i;
- priv = MARLIN_SAVE_PIPELINE_GET_PRIVATE (pipeline);
+ priv = GET_PRIVATE (pipeline);
g_object_get (priv->sample,
"channels", &channels,
@@ -116,7 +115,7 @@
g_free (name);
channel = marlin_sample_get_channel (priv->sample, i);
-
+
g_object_set (G_OBJECT (src),
"sample", priv->sample,
"channel", channel,
@@ -296,24 +295,24 @@
}
static void
-class_init (GObjectClass *klass)
+marlin_save_pipeline_class_init (MarlinSavePipelineClass *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 (MarlinSavePipelinePrivate));
+ g_type_class_add_private (o_class, sizeof (MarlinSavePipelinePrivate));
/* Properties */
- g_object_class_install_property (klass,
+ g_object_class_install_property (o_class,
PROP_SAMPLE,
g_param_spec_object ("sample",
"Sample",
@@ -323,7 +322,7 @@
G_PARAM_STATIC_NICK |
G_PARAM_STATIC_NAME |
G_PARAM_STATIC_BLURB));
- g_object_class_install_property (klass,
+ g_object_class_install_property (o_class,
PROP_ENCODER,
g_param_spec_object ("encoder",
"Encoder",
@@ -334,7 +333,7 @@
G_PARAM_STATIC_NAME |
G_PARAM_STATIC_BLURB));
- g_object_class_install_property (klass,
+ g_object_class_install_property (o_class,
PROP_FILENAME,
g_param_spec_string ("filename",
"Filename",
@@ -345,7 +344,7 @@
G_PARAM_STATIC_NAME |
G_PARAM_STATIC_BLURB));
- g_object_class_install_property (klass,
+ g_object_class_install_property (o_class,
PROP_MIMETYPE,
g_param_spec_string ("mimetype",
"Mimetype",
@@ -358,11 +357,11 @@
}
static void
-init (MarlinSavePipeline *pipeline)
+marlin_save_pipeline_init (MarlinSavePipeline *pipeline)
{
MarlinSavePipelinePrivate *priv;
- pipeline->priv = MARLIN_SAVE_PIPELINE_GET_PRIVATE (pipeline);
+ pipeline->priv = GET_PRIVATE (pipeline);
priv = pipeline->priv;
priv->joiner = gst_element_factory_make ("marlin-channel-joiner",
@@ -376,24 +375,3 @@
/* Connect when all the complete parts are present */
}
-
-GType
-marlin_save_pipeline_get_type (void)
-{
- static GType type = 0;
-
- if (type == 0) {
- static GTypeInfo info = {
- sizeof (MarlinSavePipelineClass), NULL, NULL,
- (GClassInitFunc) class_init, NULL, NULL,
- sizeof (MarlinSavePipeline), 0, (GInstanceInitFunc) init
- };
-
- type = g_type_register_static (MARLIN_PIPELINE_TYPE,
- "MarlinSavePipeline",
- &info, 0);
- }
-
- return type;
-}
-
Modified: trunk/marlin/marlin-undo-manager.c
==============================================================================
--- trunk/marlin/marlin-undo-manager.c (original)
+++ trunk/marlin/marlin-undo-manager.c Wed Oct 8 18:51:37 2008
@@ -2,7 +2,7 @@
/*
* Authors: Iain Holmes <iain gnome org>
*
- * Copyright 2002 - 2006 Iain Holmes
+ * Copyright 2002 - 2008 Iain Holmes
*
* This file is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU Library General Public
@@ -44,14 +44,16 @@
PROP_SAMPLE,
};
-static GObjectClass *parent_class = NULL;
+#define GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), MARLIN_UNDO_MANAGER_TYPE, MarlinUndoManagerPrivate))
+G_DEFINE_TYPE (MarlinUndoManager, marlin_undo_manager, G_TYPE_OBJECT);
+
static guint signals[LAST_SIGNAL];
struct _MarlinUndoManagerPrivate {
MarlinSample *sample;
GList *contexts, *undo, *redo;
-
+
MarlinUndoContext *working;
};
@@ -73,10 +75,10 @@
g_free (ctxt->name);
for (u = ctxt->undoables; u; u = u->next) {
MarlinUndoable *undoable = u->data;
-
+
marlin_undoable_free (undoable);
}
-
+
g_list_free (ctxt->undoables);
WRITE_UNLOCK (ctxt->lock);
@@ -151,10 +153,10 @@
g_list_free (priv->contexts);
manager->priv = NULL;
-
+
g_free (priv);
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ G_OBJECT_CLASS (marlin_undo_manager_parent_class)->finalize (object);
}
static void
@@ -188,7 +190,7 @@
}
static void
-class_init (MarlinUndoManagerClass *klass)
+marlin_undo_manager_class_init (MarlinUndoManagerClass *klass)
{
GObjectClass *object_class;
@@ -198,8 +200,8 @@
object_class->set_property = set_property;
object_class->get_property = get_property;
- parent_class = g_type_class_peek_parent (klass);
-
+ g_type_class_add_private (object_class,
+ sizeof (MarlinUndoManagerPrivate));
signals[CHANGED] = g_signal_new ("changed",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST |
@@ -217,30 +219,11 @@
}
static void
-init (MarlinUndoManager *manager)
+marlin_undo_manager_init (MarlinUndoManager *manager)
{
manager->priv = g_new0 (MarlinUndoManagerPrivate, 1);
}
-GType
-marlin_undo_manager_get_type (void)
-{
- static GType type = 0;
-
- if (type == 0) {
- GTypeInfo info = {
- sizeof (MarlinUndoManagerClass), NULL, NULL,
- (GClassInitFunc) class_init, NULL, NULL,
- sizeof (MarlinUndoManager), 0, (GInstanceInitFunc) init
- };
-
- type = g_type_register_static (G_TYPE_OBJECT,
- "MarlinUndoManager", &info, 0);
- }
-
- return type;
-}
-
MarlinUndoManager *
marlin_undo_manager_new (void)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]