aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2011-07-02 08:50:59 -0500
committerTed Gould <ted@gould.cx>2011-07-02 08:50:59 -0500
commit22abed03db8cb4d3e8b860075cc832bd964ca543 (patch)
tree735de79857f2e234343f9e874d73712bcb0dd4e1
parent0b32b5d893fbd6685bb1b900d744a5d320796def (diff)
downloadayatana-indicator-messages-22abed03db8cb4d3e8b860075cc832bd964ca543.tar.gz
ayatana-indicator-messages-22abed03db8cb4d3e8b860075cc832bd964ca543.tar.bz2
ayatana-indicator-messages-22abed03db8cb4d3e8b860075cc832bd964ca543.zip
Attach the module to the object and put them in the list. Now we're real.
-rw-r--r--src/status-items.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/status-items.c b/src/status-items.c
index eef240f..e210c01 100644
--- a/src/status-items.c
+++ b/src/status-items.c
@@ -120,6 +120,27 @@ provider_directory_parse (gpointer directory)
return FALSE;
}
+/* Close the module as an idle function so that we know
+ it's all cleaned up */
+static gboolean
+module_destroy_in_idle_helper (gpointer data)
+{
+ GModule * module = (GModule *)data;
+ if (module != NULL) {
+ g_debug("Unloading module: %s", g_module_name(module));
+ g_module_close(module);
+ }
+ return FALSE;
+}
+
+/* Set up an idle function to close the module */
+static void
+module_destroy_in_idle (gpointer data)
+{
+ g_idle_add_full(G_PRIORITY_LOW, module_destroy_in_idle_helper, data, NULL);
+ return;
+}
+
/* Load a particular status provider */
static gboolean
load_status_provider (gpointer dir)
@@ -159,6 +180,12 @@ load_status_provider (gpointer dir)
goto exit_module_fail;
}
+ /* Attach the module object to the status provider so
+ that when the status provider is free'd the module
+ is close automatically. */
+ g_object_set_data_full(G_OBJECT(sprovider), "status-provider-module", module, module_destroy_in_idle);
+
+ status_providers = g_list_prepend(status_providers, sprovider);
goto exit_final;