[ohm] ohm: Branch 'master' - 2 commits

Rob Taylor robtaylor at kemper.freedesktop.org
Mon Aug 13 04:12:56 PDT 2007


 ohmd/ohm-module.c          |    2 -
 ohmd/ohm-plugin-internal.h |   73 +++++++++++++++++++++++++++++++++++++++++++++
 ohmd/ohm-plugin.c          |    4 +-
 ohmd/ohm-plugin.h          |   46 ----------------------------
 4 files changed, 76 insertions(+), 49 deletions(-)

New commits:
diff-tree 03baa165164cb87b05cb21601eca420f973dccc1 (from 1b4aa0af5e62e1d716f6350a5cf2a0ff4b5f5678)
Author: Rob Taylor <rob.taylor at codethink.co.uk>
Date:   Mon Aug 13 12:15:37 2007 +0100

    split ohm-plugin.h into ohm-plugin.h and ohm-plugin-internal.h
    
    For less abi visibility to plugins and for better docs, strip ohm-plugin.h down
    to the bare essentials and make OhmPlugin an opaque pointer. The actual Gobject
    definition and the methods used by ohmd are now in ohm-plugin-internal.h.

diff --git a/ohmd/ohm-module.c b/ohmd/ohm-module.c
index 926dad9..6ee2154 100644
--- a/ohmd/ohm-module.c
+++ b/ohmd/ohm-module.c
@@ -39,7 +39,7 @@
 
 #include "ohm-debug.h"
 #include "ohm-module.h"
-#include "ohm-plugin.h"
+#include "ohm-plugin-internal.h"
 #include "ohm-conf.h"
 
 #define OHM_MODULE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), OHM_TYPE_MODULE, OhmModulePrivate))
diff --git a/ohmd/ohm-plugin-internal.h b/ohmd/ohm-plugin-internal.h
new file mode 100644
index 0000000..fb5d8f9
--- /dev/null
+++ b/ohmd/ohm-plugin-internal.h
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2007 Richard Hughes <richard at hughsie.com>
+ *
+ * Licensed under the GNU Lesser General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ * 
+ * This program 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
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser 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
+ */
+
+#ifndef __OHM_PLUGIN_INTERNAL_H
+#define __OHM_PLUGIN_INTERNAL_H
+
+#include <glib-object.h>
+#include "ohm-plugin.h"
+
+G_BEGIN_DECLS
+
+#define OHM_TYPE_PLUGIN		(ohm_plugin_get_type ())
+#define OHM_PLUGIN(o)		(G_TYPE_CHECK_INSTANCE_CAST ((o), OHM_TYPE_PLUGIN, OhmPlugin))
+#define OHM_PLUGIN_CLASS(k)	(G_TYPE_CHECK_CLASS_CAST((k), OHM_TYPE_PLUGIN, OhmPluginClass))
+#define OHM_IS_PLUGIN(o)	(G_TYPE_CHECK_INSTANCE_TYPE ((o), OHM_TYPE_PLUGIN))
+#define OHM_IS_PLUGIN_CLASS(k)	(G_TYPE_CHECK_CLASS_TYPE ((k), OHM_TYPE_PLUGIN))
+#define OHM_PLUGIN_GET_CLASS(o)	(G_TYPE_INSTANCE_GET_CLASS ((o), OHM_TYPE_PLUGIN, OhmPluginClass))
+
+typedef struct OhmPluginPrivate OhmPluginPrivate;
+typedef struct OhmPluginClass OhmPluginClass;
+
+struct OhmPlugin
+{
+	GObject		 parent;
+	const OhmPluginDesc *desc;
+	const OhmPluginKeyIdMap *interested;
+	const char **provides;
+	const char **requires;
+	const char **suggests;
+	const char **prevents;
+	OhmPluginPrivate *priv;
+};
+
+struct OhmPluginClass
+{
+	GObjectClass	parent_class;
+};
+
+GType		 ohm_plugin_get_type			(void);
+OhmPlugin	*ohm_plugin_new				(void);
+
+gboolean	 ohm_plugin_load			(OhmPlugin      *plugin,
+							 const gchar	*name);
+
+const gchar	*ohm_plugin_get_name			(OhmPlugin	*plugin);
+const gchar	*ohm_plugin_get_version			(OhmPlugin	*plugin);
+const gchar	*ohm_plugin_get_author			(OhmPlugin	*plugin);
+gboolean	 ohm_plugin_notify			(OhmPlugin      *plugin,
+							 gint		 id,
+							 gint		 value);
+
+gboolean	 ohm_plugin_initialize			(OhmPlugin      *plugin);
+
+G_END_DECLS
+
+#endif /* __OHM_PLUGIN_INTERNAL_H */
diff --git a/ohmd/ohm-plugin.c b/ohmd/ohm-plugin.c
index 8c73ed6..345d63f 100644
--- a/ohmd/ohm-plugin.c
+++ b/ohmd/ohm-plugin.c
@@ -43,7 +43,7 @@
 #include <libhal.h>
 
 #include "ohm-debug.h"
-#include "ohm-plugin.h"
+#include "ohm-plugin-internal.h"
 #include "ohm-conf.h"
 #include "ohm-marshal.h"
 
diff --git a/ohmd/ohm-plugin.h b/ohmd/ohm-plugin.h
index e9871f4..606acaa 100644
--- a/ohmd/ohm-plugin.h
+++ b/ohmd/ohm-plugin.h
@@ -21,40 +21,10 @@
 #ifndef __OHM_PLUGIN_H
 #define __OHM_PLUGIN_H
 
-#include <glib-object.h>
-
-G_BEGIN_DECLS
-
-#define OHM_TYPE_PLUGIN		(ohm_plugin_get_type ())
-#define OHM_PLUGIN(o)		(G_TYPE_CHECK_INSTANCE_CAST ((o), OHM_TYPE_PLUGIN, OhmPlugin))
-#define OHM_PLUGIN_CLASS(k)	(G_TYPE_CHECK_CLASS_CAST((k), OHM_TYPE_PLUGIN, OhmPluginClass))
-#define OHM_IS_PLUGIN(o)	(G_TYPE_CHECK_INSTANCE_TYPE ((o), OHM_TYPE_PLUGIN))
-#define OHM_IS_PLUGIN_CLASS(k)	(G_TYPE_CHECK_CLASS_TYPE ((k), OHM_TYPE_PLUGIN))
-#define OHM_PLUGIN_GET_CLASS(o)	(G_TYPE_INSTANCE_GET_CLASS ((o), OHM_TYPE_PLUGIN, OhmPluginClass))
-
-typedef struct OhmPluginPrivate OhmPluginPrivate;
 typedef struct OhmPlugin OhmPlugin;
 typedef struct OhmPluginDesc OhmPluginDesc;
-typedef struct OhmPluginClass OhmPluginClass;
 typedef struct OhmPluginKeyIdMap OhmPluginKeyIdMap;
 
-struct OhmPlugin
-{
-	GObject		 parent;
-	const OhmPluginDesc *desc;
-	const OhmPluginKeyIdMap *interested;
-	const char **provides;
-	const char **requires;
-	const char **suggests;
-	const char **prevents;
-	OhmPluginPrivate *priv;
-};
-
-struct OhmPluginClass
-{
-	GObjectClass	parent_class;
-};
-
 struct OhmPluginKeyIdMap {
 	const char	*key_name;
 	gint		local_key_id;
@@ -127,16 +97,6 @@ typedef void (*OhmPluginHalCondition)			
 							 const gchar	*name,
 							 const gchar	*detail);
 
-GType		 ohm_plugin_get_type			(void);
-OhmPlugin	*ohm_plugin_new				(void);
-
-gboolean	 ohm_plugin_load			(OhmPlugin      *plugin,
-							 const gchar	*name);
-
-const gchar	*ohm_plugin_get_name			(OhmPlugin	*plugin);
-const gchar	*ohm_plugin_get_version			(OhmPlugin	*plugin);
-const gchar	*ohm_plugin_get_author			(OhmPlugin	*plugin);
-
 /* used by plugin to do crazy stuff */
 gboolean	 ohm_plugin_spawn_async			(OhmPlugin      *plugin,
 							 const gchar	*commandline);
@@ -167,12 +127,6 @@ gchar		*ohm_plugin_hal_get_udi			(OhmPlu
 guint		 ohm_plugin_hal_add_device_capability	(OhmPlugin	*plugin,
 							 const gchar	*capability);
 
-/* used by manager to plugin */
-gboolean	 ohm_plugin_notify			(OhmPlugin      *plugin,
-							 gint		 id,
-							 gint		 value);
-gboolean	 ohm_plugin_initialize			(OhmPlugin      *plugin);
-
 G_END_DECLS
 
 #endif /* __OHM_PLUGIN_H */
diff-tree 1b4aa0af5e62e1d716f6350a5cf2a0ff4b5f5678 (from 1c81985f3f5198649d07573d7501a8ef6bb90ab6)
Author: Rob Taylor <rob.taylor at codethink.co.uk>
Date:   Fri Aug 10 09:31:19 2007 +0100

    initialise plugin's conf in init
    
    Was bring done in _new, which was a little odd.

diff --git a/ohmd/ohm-plugin.c b/ohmd/ohm-plugin.c
index 37db8e1..8c73ed6 100644
--- a/ohmd/ohm-plugin.c
+++ b/ohmd/ohm-plugin.c
@@ -466,6 +466,7 @@ ohm_plugin_init (OhmPlugin *plugin)
 	plugin->priv = OHM_PLUGIN_GET_PRIVATE (plugin);
 
 	plugin->priv->hal_udis = g_ptr_array_new ();
+	plugin->priv->conf = ohm_conf_new ();
 }
 
 /**
@@ -476,6 +477,5 @@ ohm_plugin_new (void)
 {
 	OhmPlugin *plugin;
 	plugin = g_object_new (OHM_TYPE_PLUGIN, NULL);
-	plugin->priv->conf = ohm_conf_new ();
 	return OHM_PLUGIN (plugin);
 }


More information about the Ohm-devel mailing list