diff options
author | Aleksander Morgado <aleksander@gnu.org> | 2011-09-05 21:16:23 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2012-03-15 14:14:19 +0100 |
commit | 51a8dc6ff3d2d92dfe1e8fc99c73ec84e4948354 (patch) | |
tree | 140ac6a4a62efad50fff19b74cfe450bfd6d0315 | |
parent | 03655fcf9fd34d1153d8c0f8ae9f306baf974da3 (diff) |
plugin-manager: let it be initable
Looking for plugins and loading them will be done during the object creation,
so the operation may fail and we need to report it.
-rw-r--r-- | src/mm-plugin-manager.c | 29 | ||||
-rw-r--r-- | src/mm-plugin-manager.h | 2 |
2 files changed, 27 insertions, 4 deletions
diff --git a/src/mm-plugin-manager.c b/src/mm-plugin-manager.c index 6a32af84..e007887b 100644 --- a/src/mm-plugin-manager.c +++ b/src/mm-plugin-manager.c @@ -16,18 +16,27 @@ #include <string.h> #include <ctype.h> +#include <gio/gio.h> + #include "mm-plugin-manager.h" -G_DEFINE_TYPE (MMPluginManager, mm_plugin_manager, G_TYPE_OBJECT); +static void initable_iface_init (GInitableIface *iface); + +G_DEFINE_TYPE_EXTENDED (MMPluginManager, mm_plugin_manager, G_TYPE_OBJECT, 0, + G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE, + initable_iface_init)); struct _MMPluginManagerPrivate { gpointer dummy; }; MMPluginManager * -mm_plugin_manager_new (void) +mm_plugin_manager_new (GError **error) { - return g_object_new (MM_TYPE_PLUGIN_MANAGER, NULL); + return g_initable_new (MM_TYPE_PLUGIN_MANAGER, + NULL, + error, + NULL); } static void @@ -39,6 +48,14 @@ mm_plugin_manager_init (MMPluginManager *manager) MMPluginManagerPrivate); } +static gboolean +initable_init (GInitable *initable, + GCancellable *cancellable, + GError **error) +{ + return TRUE; +} + static void finalize (GObject *object) { @@ -46,6 +63,12 @@ finalize (GObject *object) } static void +initable_iface_init (GInitableIface *iface) +{ + iface->init = initable_init; +} + +static void mm_plugin_manager_class_init (MMPluginManagerClass *manager_class) { GObjectClass *object_class = G_OBJECT_CLASS (manager_class); diff --git a/src/mm-plugin-manager.h b/src/mm-plugin-manager.h index c70592da..906c7ef3 100644 --- a/src/mm-plugin-manager.h +++ b/src/mm-plugin-manager.h @@ -38,6 +38,6 @@ typedef struct { GType mm_plugin_manager_get_type (void); -MMPluginManager *mm_plugin_manager_new (void); +MMPluginManager *mm_plugin_manager_new (GError **error); #endif /* MM_PLUGIN_MANAGER_H */ |