]> git.0d.be Git - empathy.git/commitdiff
Add empathy_sound_pref_is_enabled ().
authorXavier Claessens <xclaesse@src.gnome.org>
Tue, 6 Jan 2009 16:45:57 +0000 (16:45 +0000)
committerXavier Claessens <xclaesse@src.gnome.org>
Tue, 6 Jan 2009 16:45:57 +0000 (16:45 +0000)
svn path=/trunk/; revision=2024

libempathy-gtk/empathy-ui-utils.c
libempathy-gtk/empathy-ui-utils.h

index 3b9dcbdc6f5a06c05375db83e1e03a819fc23406..a7a468c3fbe497013efc156108c56f00c3cfb598 100644 (file)
 
 #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;
+}
index d20d9a0c3ab9881243547c56c19e2818fb14d21f..7c97f0943ab9e802b70b31be3579b4c253461a92 100644 (file)
@@ -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__ */