aboutsummaryrefslogtreecommitdiff
path: root/src/status-items.c
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2011-07-02 07:15:22 -0500
committerTed Gould <ted@gould.cx>2011-07-02 07:15:22 -0500
commit782c36c2ccf01dd0db6cbac8cc712cc316f23c90 (patch)
tree668a107a7dbd60a10546134d287a1993a19c81af /src/status-items.c
parentd936a27b56706eb521f525970dedb63fe24c81bd (diff)
downloadayatana-indicator-messages-782c36c2ccf01dd0db6cbac8cc712cc316f23c90.tar.gz
ayatana-indicator-messages-782c36c2ccf01dd0db6cbac8cc712cc316f23c90.tar.bz2
ayatana-indicator-messages-782c36c2ccf01dd0db6cbac8cc712cc316f23c90.zip
Loading the modules and getting an object
Diffstat (limited to 'src/status-items.c')
-rw-r--r--src/status-items.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/status-items.c b/src/status-items.c
index 5e8a07c..eef240f 100644
--- a/src/status-items.c
+++ b/src/status-items.c
@@ -107,7 +107,7 @@ provider_directory_parse (gpointer directory)
const gchar * name;
while ((name = g_dir_read_name(dir)) != NULL) {
- if (!g_str_has_suffix(name, ".so")) {
+ if (!g_str_has_suffix(name, G_MODULE_SUFFIX)) {
continue;
}
@@ -137,10 +137,32 @@ load_status_provider (gpointer dir)
module = g_module_open(provider, G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL);
if (module == NULL) {
g_warning("Unable to module for: %s", provider);
- goto exit_final;
+ goto exit_module_fail;
}
/* Got it */
+ GType (*type_func) (void);
+ if (!g_module_symbol(module, STATUS_PROVIDER_EXPORT_S, (gpointer *)&type_func)) {
+ g_warning("Unable to find type symbol in: %s", provider);
+ goto exit_module_fail;
+ }
+
+ GType provider_type = type_func();
+ if (provider_type == 0) {
+ g_warning("Unable to create type from: %s", provider);
+ goto exit_module_fail;
+ }
+
+ StatusProvider * sprovider = STATUS_PROVIDER(g_object_new(provider_type, NULL));
+ if (sprovider == NULL) {
+ g_warning("Unable to build provider from: %s", provider);
+ goto exit_module_fail;
+ }
+
+
+ goto exit_final;
+
+exit_module_fail:
g_module_close(module);
exit_final: