diff options
-rw-r--r-- | ChangeLog | 24 | ||||
-rwxr-xr-x | configure | 20 | ||||
-rw-r--r-- | configure.ac | 4 | ||||
-rw-r--r-- | libindicator/indicator-object.c | 80 | ||||
-rw-r--r-- | libindicator/indicator-object.h | 4 |
5 files changed, 120 insertions, 12 deletions
@@ -1,5 +1,29 @@ # Generated by Makefile. Do not edit. +2011-03-23 Ted Gould <ted@gould.cx> + + 0.3.22 + +2011-03-23 Ted Gould <ted@gould.cx> + + Adding API to know what the environment the indicator is in + +2011-03-22 Ted Gould <ted@gould.cx> + + Adding a nice little checking function + +2011-03-22 Ted Gould <ted@gould.cx> + + Adding an environments variable and make a lifecycle for it. + +2011-03-22 Ted Gould <ted@gould.cx> + + Getting some stub functions in + +2011-03-22 Ted Gould <ted@gould.cx> + + Making the environments a list of strings + 2011-03-16 Ted Gould <ted@gould.cx> 0.3.21 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.67 for libindicator 0.3.21. +# Generated by GNU Autoconf 2.67 for libindicator 0.3.22. # # Report bugs to <ted@canonical.com>. # @@ -701,8 +701,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='libindicator' PACKAGE_TARNAME='libindicator' -PACKAGE_VERSION='0.3.21' -PACKAGE_STRING='libindicator 0.3.21' +PACKAGE_VERSION='0.3.22' +PACKAGE_STRING='libindicator 0.3.22' PACKAGE_BUGREPORT='ted@canonical.com' PACKAGE_URL='' @@ -1443,7 +1443,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures libindicator 0.3.21 to adapt to many kinds of systems. +\`configure' configures libindicator 0.3.22 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1513,7 +1513,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of libindicator 0.3.21:";; + short | recursive ) echo "Configuration of libindicator 0.3.22:";; esac cat <<\_ACEOF @@ -1628,7 +1628,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -libindicator configure 0.3.21 +libindicator configure 0.3.22 generated by GNU Autoconf 2.67 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1906,7 +1906,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by libindicator $as_me 0.3.21, which was +It was created by libindicator $as_me 0.3.22, which was generated by GNU Autoconf 2.67. Invocation command line was $ $0 $@ @@ -2726,7 +2726,7 @@ fi # Define the identity of the package. PACKAGE=libindicator - VERSION=0.3.21 + VERSION=0.3.22 cat >>confdefs.h <<_ACEOF @@ -12361,7 +12361,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by libindicator $as_me 0.3.21, which was +This file was extended by libindicator $as_me 0.3.22, which was generated by GNU Autoconf 2.67. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -12427,7 +12427,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -libindicator config.status 0.3.21 +libindicator config.status 0.3.22 configured by $0, generated by GNU Autoconf 2.67, with options \\"\$ac_cs_config\\" 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]) diff --git a/libindicator/indicator-object.c b/libindicator/indicator-object.c index 73c1ca7..a061215 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 @@ -571,3 +580,74 @@ 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) +{ + 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; +} + +/** + 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) +{ + 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 67a3bda..aa15c79 100644 --- a/libindicator/indicator-object.h +++ b/libindicator/indicator-object.h @@ -179,6 +179,10 @@ 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); +gboolean indicator_object_check_environment (IndicatorObject * io, const gchar * env); + G_END_DECLS #endif |