From 8673e8f7e9f681902155fa0306a1f2a0dc26fc7a Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 22 Mar 2011 10:46:53 -0500 Subject: Getting some stub functions in --- libindicator/indicator-object.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'libindicator/indicator-object.c') diff --git a/libindicator/indicator-object.c b/libindicator/indicator-object.c index 73c1ca7..71d0c94 100644 --- a/libindicator/indicator-object.c +++ b/libindicator/indicator-object.c @@ -571,3 +571,37 @@ indicator_object_entry_close (IndicatorObject * io, IndicatorObjectEntry * entry return; } + +/** + indicator_object_set_environment: + @io: #IndicatorObject to set on + @env: List of enviroment names to use + + Sets the names of the environment that the indicator is being + loaded into. This allows for indicators to behave differently + in different hosts if need be. +*/ +void +indicator_object_set_environment (IndicatorObject * io, const GStrv env) +{ + + return; +} + +/** + indicator_object_get_environment: + @io: #IndicatorObject to get the environment from + + Gets the list of environment strings that this object is + placed into. + + Return value: (transfer none): Gets the list of strings that + represent the environment or NULL if none were given. +*/ +const GStrv +indicator_object_get_environment (IndicatorObject * io) +{ + + + return; +} -- cgit v1.2.3 From 5712d441abe82bb1c328102040ff5cb6212c911c Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 22 Mar 2011 10:51:19 -0500 Subject: Adding an environments variable and make a lifecycle for it. --- libindicator/indicator-object.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'libindicator/indicator-object.c') 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; } -- cgit v1.2.3 From a995a11447ed9bf880d129c3e03fbce5395fbb74 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 22 Mar 2011 10:57:30 -0500 Subject: Adding a nice little checking function --- libindicator/indicator-object.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'libindicator/indicator-object.c') diff --git a/libindicator/indicator-object.c b/libindicator/indicator-object.c index bac4826..a061215 100644 --- a/libindicator/indicator-object.c +++ b/libindicator/indicator-object.c @@ -621,3 +621,33 @@ indicator_object_get_environment (IndicatorObject * io) g_return_val_if_fail(INDICATOR_IS_OBJECT(io), NULL); return io->priv->environments; } + +/** + indicator_object_check_environment: + @io: #IndicatorObject to check on + @env: Environment that we're looking for + + Convience function to check to see if the specified environment + @env is in our list of environments. + + Return Value: Whether we're in environment @env +*/ +gboolean +indicator_object_check_environment (IndicatorObject * io, const gchar * env) +{ + g_return_val_if_fail(INDICATOR_IS_OBJECT(io), FALSE); + g_return_val_if_fail(env != NULL, FALSE); + + if (io->priv->environments == NULL) { + return FALSE; + } + + int i; + for (i = 0; io->priv->environments[i] != NULL; i++) { + if (g_strcmp0(env, io->priv->environments[i]) == 0) { + return TRUE; + } + } + + return FALSE; +} -- cgit v1.2.3