[tracker/writeback: 5/8] TrackerWriteback: add dummy module.
- From: Philip Van Hoof <pvanhoof src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [tracker/writeback: 5/8] TrackerWriteback: add dummy module.
- Date: Fri, 13 Nov 2009 11:26:19 +0000 (UTC)
commit a3fc7fb53d585fb8014555f34f6b82773b4d9ab3
Author: Carlos Garnacho <carlos lanedo com>
Date: Wed Nov 11 12:47:28 2009 +0100
TrackerWriteback: add dummy module.
Modules will derive from the TrackerWriteback object, its API has to be devised
yet.
src/tracker-writeback/Makefile.am | 10 ++--
src/tracker-writeback/tracker-writeback-dummy.c | 61 ++++++++++++++++++++++
src/tracker-writeback/tracker-writeback-module.c | 12 +----
src/tracker-writeback/tracker-writeback-module.h | 4 +-
src/tracker-writeback/tracker-writeback.c | 15 +++++
src/tracker-writeback/tracker-writeback.h | 5 ++
6 files changed, 90 insertions(+), 17 deletions(-)
---
diff --git a/src/tracker-writeback/Makefile.am b/src/tracker-writeback/Makefile.am
index 3d13b85..9e9d6aa 100644
--- a/src/tracker-writeback/Makefile.am
+++ b/src/tracker-writeback/Makefile.am
@@ -16,13 +16,13 @@ INCLUDES = \
$(GMODULE_CFLAGS) \
$(DBUS_CFLAGS)
-#modules_LTLIBRARIES = \
-# libwriteback-dummy.la
+modules_LTLIBRARIES = \
+ libwriteback-dummy.la
# dummy
-#libwriteback_dummy_la_SOURCES = tracker-writeback-dummy.c
-#libwriteback_dummy_la_LDFLAGS = $(module_flags)
-#libwriteback_dummy_la_LIBADD = $(GLIB2_LIBS) $(GCOV_LIBS)
+libwriteback_dummy_la_SOURCES = tracker-writeback-dummy.c
+libwriteback_dummy_la_LDFLAGS = $(module_flags)
+libwriteback_dummy_la_LIBADD = $(GLIB2_LIBS) $(GCOV_LIBS)
#
# Binaries
diff --git a/src/tracker-writeback/tracker-writeback-dummy.c b/src/tracker-writeback/tracker-writeback-dummy.c
new file mode 100644
index 0000000..641fef2
--- /dev/null
+++ b/src/tracker-writeback/tracker-writeback-dummy.c
@@ -0,0 +1,61 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2008, Nokia
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "tracker-writeback.h"
+
+#define TRACKER_TYPE_WRITEBACK_DUMMY (tracker_writeback_dummy_get_type ())
+
+typedef struct TrackerWritebackDummy TrackerWritebackDummy;
+typedef struct TrackerWritebackDummyClass TrackerWritebackDummyClass;
+
+struct TrackerWritebackDummy {
+ TrackerWriteback parent_instance;
+};
+
+struct TrackerWritebackDummyClass {
+ TrackerWritebackClass parent_class;
+};
+
+static GType tracker_writeback_dummy_get_type (void) G_GNUC_CONST;
+
+G_DEFINE_DYNAMIC_TYPE (TrackerWritebackDummy, tracker_writeback_dummy, TRACKER_TYPE_WRITEBACK);
+
+static void
+tracker_writeback_dummy_class_init (TrackerWritebackDummyClass *klass)
+{
+}
+
+static void
+tracker_writeback_dummy_class_finalize (TrackerWritebackDummyClass *klass)
+{
+}
+
+static void
+tracker_writeback_dummy_init (TrackerWritebackDummy *dummy)
+{
+}
+
+TrackerWriteback *
+writeback_module_get (GTypeModule *module)
+{
+ tracker_writeback_dummy_register_type (module);
+
+ return g_object_new (TRACKER_TYPE_WRITEBACK_DUMMY, NULL);
+}
diff --git a/src/tracker-writeback/tracker-writeback-module.c b/src/tracker-writeback/tracker-writeback-module.c
index ecd8bbc..d431808 100644
--- a/src/tracker-writeback/tracker-writeback-module.c
+++ b/src/tracker-writeback/tracker-writeback-module.c
@@ -65,10 +65,8 @@ tracker_writeback_module_load (GTypeModule *module)
g_module_make_resident (writeback_module->module);
- if (!g_module_symbol (writeback_module->module, "writeback_module_initialize",
- (gpointer *) &writeback_module->initialize) ||
- !g_module_symbol (writeback_module->module, "writeback_module_shutdown",
- (gpointer *) &writeback_module->shutdown)) {
+ if (!g_module_symbol (writeback_module->module, "writeback_module_get",
+ (gpointer *) &writeback_module->get)) {
g_warning ("Could not load module symbols for '%s': %s",
writeback_module->name,
g_module_error ());
@@ -76,8 +74,6 @@ tracker_writeback_module_load (GTypeModule *module)
return FALSE;
}
- writeback_module->initialize (module);
-
return TRUE;
}
@@ -87,13 +83,9 @@ tracker_writeback_module_unload (GTypeModule *module)
TrackerWritebackModule *writeback_module;
writeback_module = TRACKER_WRITEBACK_MODULE (module);
- writeback_module->shutdown ();
g_module_close (writeback_module->module);
writeback_module->module = NULL;
-
- writeback_module->initialize = NULL;
- writeback_module->shutdown = NULL;
}
TrackerWritebackModule *
diff --git a/src/tracker-writeback/tracker-writeback-module.h b/src/tracker-writeback/tracker-writeback-module.h
index 5e23349..a42236c 100644
--- a/src/tracker-writeback/tracker-writeback-module.h
+++ b/src/tracker-writeback/tracker-writeback-module.h
@@ -24,6 +24,7 @@
#include <glib.h>
#include <glib-object.h>
+#include "tracker-writeback.h"
G_BEGIN_DECLS
@@ -39,8 +40,7 @@ struct TrackerWritebackModule {
GModule *module;
gchar *name;
- void (* initialize) (GTypeModule *module);
- void (* shutdown) (void);
+ TrackerWriteback * (* get) (GTypeModule *module);
};
struct TrackerWritebackModuleClass {
diff --git a/src/tracker-writeback/tracker-writeback.c b/src/tracker-writeback/tracker-writeback.c
index a4b274b..a368d42 100644
--- a/src/tracker-writeback/tracker-writeback.c
+++ b/src/tracker-writeback/tracker-writeback.c
@@ -18,3 +18,18 @@
* Boston, MA 02110-1301, USA.
*/
+#include "tracker-writeback.h"
+
+G_DEFINE_ABSTRACT_TYPE (TrackerWriteback, tracker_writeback, G_TYPE_OBJECT)
+
+static void
+tracker_writeback_class_init (TrackerWritebackClass *klass)
+{
+
+}
+
+static void
+tracker_writeback_init (TrackerWriteback *writeback)
+{
+
+}
diff --git a/src/tracker-writeback/tracker-writeback.h b/src/tracker-writeback/tracker-writeback.h
index 9f27e41..efd03ef 100644
--- a/src/tracker-writeback/tracker-writeback.h
+++ b/src/tracker-writeback/tracker-writeback.h
@@ -18,6 +18,8 @@
* Boston, MA 02110-1301, USA.
*/
+#include <glib-object.h>
+
#ifndef __TRACKER_WRITEBACK_H__
#define __TRACKER_WRITEBACK_H__
@@ -43,6 +45,9 @@ struct TrackerWritebackClass {
GType tracker_writeback_get_type (void) G_GNUC_CONST;
+/* Entry function to be defined by modules */
+TrackerWriteback * writeback_module_get (GTypeModule *module);
+
G_END_DECLS
#endif /* __TRACKER_WRITEBACK_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]