[gnome-bluetooth] Implement bluetooth_plugin_manager_get_widgets()



commit d09d310ede8d0003977726f4221054f4f05623f4
Author: Bastien Nocera <hadess hadess net>
Date:   Thu May 28 17:19:42 2009 +0100

    Implement bluetooth_plugin_manager_get_widgets()
    
    And fix the loading of plugins, we weren't setting the ->info
    struct member after loading the plugins...
---
 common/bluetooth-plugin-manager.c |   26 ++++++++++++++++++++++++++
 common/bluetooth-plugin-manager.h |    3 +++
 2 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/common/bluetooth-plugin-manager.c b/common/bluetooth-plugin-manager.c
index 765e420..9b07933 100644
--- a/common/bluetooth-plugin-manager.c
+++ b/common/bluetooth-plugin-manager.c
@@ -40,6 +40,7 @@ bluetooth_plugin_dir_process (const char *plugindir)
 	const char *item;
 	GbtPlugin *p = NULL;
 	GError *err = NULL;
+	gboolean (*gbt_init_plugin)(GbtPlugin *p);
 
 	dir = g_dir_open (plugindir, 0, &err);
 
@@ -62,6 +63,14 @@ bluetooth_plugin_dir_process (const char *plugindir)
 				}
 				g_free (module_path);
 
+				if (!g_module_symbol (p->module, "gbt_init_plugin", (gpointer *) &gbt_init_plugin)) {
+					g_warning ("error: %s", g_module_error ());
+					g_module_close (p->module);
+					continue;
+				}
+
+				gbt_init_plugin (p);
+
 				plugin_list = g_list_append (plugin_list, p); 
 			}
 		}
@@ -98,3 +107,20 @@ bluetooth_plugin_manager_cleanup (void)
 	plugin_list = NULL;
 }
 
+GList *
+bluetooth_plugin_manager_get_widgets (const char *bdaddr,
+				      const char **uuids)
+{
+	GList *ret = NULL;
+	GList *l;
+
+	for (l = plugin_list; l != NULL; l = l->next) {
+		GbtPlugin *p = l->data;
+
+		if (p->info->has_config_widget (bdaddr, uuids))
+			ret = g_list_prepend (ret, p->info->get_config_widgets (bdaddr, uuids));
+	}
+
+	return ret;
+}
+
diff --git a/common/bluetooth-plugin-manager.h b/common/bluetooth-plugin-manager.h
index 2c02c66..c44cfa7 100644
--- a/common/bluetooth-plugin-manager.h
+++ b/common/bluetooth-plugin-manager.h
@@ -29,6 +29,9 @@ G_BEGIN_DECLS
 gboolean bluetooth_plugin_manager_init (void);
 void bluetooth_plugin_manager_cleanup (void);
 
+GList *bluetooth_plugin_manager_get_widgets (const char *bdaddr,
+					     const char **uuids);
+
 G_END_DECLS
 
 #endif /* __BLUETOOTH_PLUGIN_MANAGER_H */



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