From baf04be1ea2755aba0b576ae54ecda08d3ec4e0b Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 22 Mar 2011 10:42:30 -0500 Subject: Making the environments a list of strings --- libindicator/indicator-object.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libindicator/indicator-object.h b/libindicator/indicator-object.h index 67a3bda..3320b95 100644 --- a/libindicator/indicator-object.h +++ b/libindicator/indicator-object.h @@ -179,6 +179,9 @@ guint indicator_object_get_show_now (IndicatorObject * io, IndicatorObjectEntr void indicator_object_entry_activate (IndicatorObject * io, IndicatorObjectEntry * entry, guint timestamp); void indicator_object_entry_close (IndicatorObject * io, IndicatorObjectEntry * entry, guint timestamp); +void indicator_object_set_environment (IndicatorObject * io, const GStrv * env); +const GStrv * indicator_object_get_environment (IndicatorObject * io); + G_END_DECLS #endif -- cgit v1.2.3 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 ++++++++++++++++++++++++++++++++++ libindicator/indicator-object.h | 4 ++-- 2 files changed, 36 insertions(+), 2 deletions(-) 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; +} diff --git a/libindicator/indicator-object.h b/libindicator/indicator-object.h index 3320b95..221f399 100644 --- a/libindicator/indicator-object.h +++ b/libindicator/indicator-object.h @@ -179,8 +179,8 @@ guint indicator_object_get_show_now (IndicatorObject * io, IndicatorObjectEntr void indicator_object_entry_activate (IndicatorObject * io, IndicatorObjectEntry * entry, guint timestamp); void indicator_object_entry_close (IndicatorObject * io, IndicatorObjectEntry * entry, guint timestamp); -void indicator_object_set_environment (IndicatorObject * io, const GStrv * env); -const GStrv * indicator_object_get_environment (IndicatorObject * io); +void indicator_object_set_environment (IndicatorObject * io, const GStrv env); +const GStrv indicator_object_get_environment (IndicatorObject * io); G_END_DECLS -- 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(-) 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 ++++++++++++++++++++++++++++++ libindicator/indicator-object.h | 1 + 2 files changed, 31 insertions(+) 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 -- cgit v1.2.3 From a774a4119776cae6ff8bfe81b137ace75182273a Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 22 Mar 2011 15:03:30 -0500 Subject: releasing version 0.3.21-0ubuntu2~ppa1 --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 399e111..e365fcb 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,10 +1,10 @@ -libindicator (0.3.21-0ubuntu2~ppa1) UNRELEASED; urgency=low +libindicator (0.3.21-0ubuntu2~ppa1) natty; urgency=low * Upstream Merge * Adding the ability to know the environment the indicator object is in. - -- Ted Gould Tue, 22 Mar 2011 14:59:11 -0500 + -- Ted Gould Tue, 22 Mar 2011 15:03:28 -0500 libindicator (0.3.21-0ubuntu1) natty; urgency=low -- cgit v1.2.3 From f9f5cee34bada7ed1fb0c3bbada7a5a545dbadd4 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 23 Mar 2011 13:13:28 -0500 Subject: 0.3.22 --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 4f60db7..b3c570f 100644 --- a/configure.ac +++ b/configure.ac @@ -1,10 +1,10 @@ -AC_INIT(libindicator, 0.3.21, ted@canonical.com) +AC_INIT(libindicator, 0.3.22, ted@canonical.com) AC_PREREQ(2.53) AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(libindicator, 0.3.21) +AM_INIT_AUTOMAKE(libindicator, 0.3.22) AM_MAINTAINER_MODE m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES]) -- cgit v1.2.3 From 97e2fede61bdc63816f0ff2ccf1d5b1d58a13916 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 23 Mar 2011 13:21:52 -0500 Subject: releasing version 0.3.22-0ubuntu1~ppa1 --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 11e4dd1..2d8cb98 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,10 +1,10 @@ -libindicator (0.3.22-0ubuntu1~ppa1) UNRELEASED; urgency=low +libindicator (0.3.22-0ubuntu1~ppa1) natty; urgency=low * New upstream release. * Adding the ability to know the environment the indicator object is in. (LP: #703555) - -- Ted Gould Wed, 23 Mar 2011 13:17:35 -0500 + -- Ted Gould Wed, 23 Mar 2011 13:21:49 -0500 libindicator (0.3.21-0ubuntu1) natty; urgency=low -- cgit v1.2.3