diff options
author | Ted Gould <ted@gould.cx> | 2011-03-22 10:51:19 -0500 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2011-03-22 10:51:19 -0500 |
commit | 5712d441abe82bb1c328102040ff5cb6212c911c (patch) | |
tree | 012b74bdf4a6ad30b8045e766807c36a52881743 /libindicator/indicator-object.c | |
parent | 8673e8f7e9f681902155fa0306a1f2a0dc26fc7a (diff) | |
download | libayatana-indicator-5712d441abe82bb1c328102040ff5cb6212c911c.tar.gz libayatana-indicator-5712d441abe82bb1c328102040ff5cb6212c911c.tar.bz2 libayatana-indicator-5712d441abe82bb1c328102040ff5cb6212c911c.zip |
Adding an environments variable and make a lifecycle for it.
Diffstat (limited to 'libindicator/indicator-object.c')
-rw-r--r-- | libindicator/indicator-object.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/libindicator/indicator-object.c b/libindicator/indicator-object.c index 71d0c94..bac4826 100644 --- a/libindicator/indicator-object.c +++ b/libindicator/indicator-object.c @@ -48,6 +48,8 @@ struct _IndicatorObjectPrivate { /* For get_entries_default */ IndicatorObjectEntry entry; gboolean gotten_entries; + + GStrv environments; }; #define INDICATOR_OBJECT_GET_PRIVATE(o) (INDICATOR_OBJECT(o)->priv) @@ -260,6 +262,8 @@ indicator_object_init (IndicatorObject *self) self->priv->gotten_entries = FALSE; + self->priv->environments = NULL; + return; } @@ -290,6 +294,11 @@ indicator_object_finalize (GObject *object) { IndicatorObjectPrivate * priv = INDICATOR_OBJECT_GET_PRIVATE(object); + if (priv->environments != NULL) { + g_strfreev(priv->environments); + priv->environments = NULL; + } + if (priv->module != NULL) { /* Wow, this is convoluted. So basically we want to unref the module which will cause the code it included to be @@ -584,6 +593,14 @@ indicator_object_entry_close (IndicatorObject * io, IndicatorObjectEntry * entry void indicator_object_set_environment (IndicatorObject * io, const GStrv env) { + g_return_if_fail(INDICATOR_IS_OBJECT(io)); + + if (io->priv->environments != NULL) { + g_strfreev(io->priv->environments); + io->priv->environments = NULL; + } + + io->priv->environments = g_strdupv(env); return; } @@ -601,7 +618,6 @@ indicator_object_set_environment (IndicatorObject * io, const GStrv env) const GStrv indicator_object_get_environment (IndicatorObject * io) { - - - return; + g_return_val_if_fail(INDICATOR_IS_OBJECT(io), NULL); + return io->priv->environments; } |