aboutsummaryrefslogtreecommitdiff
path: root/libindicator
diff options
context:
space:
mode:
Diffstat (limited to 'libindicator')
-rw-r--r--libindicator/indicator-object.c30
-rw-r--r--libindicator/indicator-object.h1
2 files changed, 31 insertions, 0 deletions
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;
+}
diff --git a/libindicator/indicator-object.h b/libindicator/indicator-object.h
index 221f399..aa15c79 100644
--- a/libindicator/indicator-object.h
+++ b/libindicator/indicator-object.h
@@ -181,6 +181,7 @@ void indicator_object_entry_close (IndicatorObject * io, IndicatorObjectEntry
void indicator_object_set_environment (IndicatorObject * io, const GStrv env);
const GStrv indicator_object_get_environment (IndicatorObject * io);
+gboolean indicator_object_check_environment (IndicatorObject * io, const gchar * env);
G_END_DECLS