diff options
author | Xavier Claessens <xclaesse@src.gnome.org> | 2009-01-07 00:45:57 +0800 |
---|---|---|
committer | Xavier Claessens <xclaesse@src.gnome.org> | 2009-01-07 00:45:57 +0800 |
commit | 7e38c381cd6e647e20b703973c9ed2c14f6ab543 (patch) | |
tree | ba0469e57c490b450be95943b4ca11d6f358ed8a /libempathy-gtk | |
parent | ae5ee8e3c32c9fef5b981fc2cf98183d35544c7f (diff) | |
download | gsoc2013-empathy-7e38c381cd6e647e20b703973c9ed2c14f6ab543.tar gsoc2013-empathy-7e38c381cd6e647e20b703973c9ed2c14f6ab543.tar.gz gsoc2013-empathy-7e38c381cd6e647e20b703973c9ed2c14f6ab543.tar.bz2 gsoc2013-empathy-7e38c381cd6e647e20b703973c9ed2c14f6ab543.tar.lz gsoc2013-empathy-7e38c381cd6e647e20b703973c9ed2c14f6ab543.tar.xz gsoc2013-empathy-7e38c381cd6e647e20b703973c9ed2c14f6ab543.tar.zst gsoc2013-empathy-7e38c381cd6e647e20b703973c9ed2c14f6ab543.zip |
Add empathy_sound_pref_is_enabled ().
svn path=/trunk/; revision=2024
Diffstat (limited to 'libempathy-gtk')
-rw-r--r-- | libempathy-gtk/empathy-ui-utils.c | 35 | ||||
-rw-r--r-- | libempathy-gtk/empathy-ui-utils.h | 2 |
2 files changed, 37 insertions, 0 deletions
diff --git a/libempathy-gtk/empathy-ui-utils.c b/libempathy-gtk/empathy-ui-utils.c index 3b9dcbdc6..a7a468c3f 100644 --- a/libempathy-gtk/empathy-ui-utils.c +++ b/libempathy-gtk/empathy-ui-utils.c @@ -43,11 +43,13 @@ #include "empathy-ui-utils.h" #include "empathy-images.h" +#include "empathy-conf.h" #define DEBUG_FLAG EMPATHY_DEBUG_OTHER #include <libempathy/empathy-debug.h> #include <libempathy/empathy-utils.h> #include <libempathy/empathy-dispatcher.h> +#include <libempathy/empathy-idle.h> void empathy_gtk_init (void) @@ -1490,3 +1492,36 @@ empathy_send_file_with_file_chooser (EmpathyContact *contact) gtk_widget_show (widget); } +gboolean +empathy_sound_pref_is_enabled (const char *key) +{ + EmpathyConf *conf; + McPresence presence; + gboolean res; + EmpathyIdle *idle; + + conf = empathy_conf_get (); + res = FALSE; + + empathy_conf_get_bool (conf, EMPATHY_PREFS_SOUNDS_ENABLED, &res); + + if (!res) { + return FALSE; + } + + idle = empathy_idle_new (); + presence = empathy_idle_get_state (idle); + g_object_unref (idle); + + if (presence > MC_PRESENCE_AVAILABLE) { + empathy_conf_get_bool (conf, EMPATHY_PREFS_SOUNDS_DISABLED_AWAY, + &res); + if (res) { + return FALSE; + } + } + + empathy_conf_get_bool (conf, key, &res); + + return res; +} diff --git a/libempathy-gtk/empathy-ui-utils.h b/libempathy-gtk/empathy-ui-utils.h index d20d9a0c3..7c97f0943 100644 --- a/libempathy-gtk/empathy-ui-utils.h +++ b/libempathy-gtk/empathy-ui-utils.h @@ -114,6 +114,8 @@ GtkWidget * empathy_link_button_new (const gchar *url, void empathy_send_file_with_file_chooser (EmpathyContact *contact); +gboolean empathy_sound_pref_is_enabled (const char *key); + G_END_DECLS #endif /* __EMPATHY_UI_UTILS_H__ */ |