]> git.0d.be Git - empathy.git/blobdiff - libempathy-gtk/empathy-notify-manager.c
move empathy-misc to empathy-notify-manager
[empathy.git] / libempathy-gtk / empathy-notify-manager.c
index 0bb6b8561d81b1f507ac7725575026595ffb27f9..44f77937ffe7f8b73bfa523d3afebc6a8cc27c1d 100644 (file)
@@ -25,6 +25,9 @@
 
 #include <libempathy/empathy-utils.h>
 
+#include <libempathy-gtk/empathy-ui-utils.h>
+#include <libempathy-gtk/empathy-conf.h>
+
 #define DEBUG_FLAG EMPATHY_DEBUG_OTHER
 #include <libempathy/empathy-debug.h>
 
@@ -141,3 +144,44 @@ empathy_notify_manager_has_capability (EmpathyNotifyManager *self,
 
   return g_hash_table_lookup (priv->capabilities, capa) != NULL;
 }
+
+GdkPixbuf *
+empathy_misc_get_pixbuf_for_notification (EmpathyContact *contact,
+    const char *icon_name)
+{
+  GdkPixbuf *pixbuf = NULL;
+
+  if (contact != NULL)
+    pixbuf = empathy_pixbuf_avatar_from_contact_scaled (contact, 48, 48);
+
+  if (pixbuf == NULL)
+    pixbuf = empathy_pixbuf_from_icon_name_sized (icon_name, 48);
+
+  return pixbuf;
+}
+
+gboolean
+empathy_notification_is_enabled (void)
+{
+  EmpathyConf *conf;
+  gboolean res;
+
+  conf = empathy_conf_get ();
+  res = FALSE;
+
+  empathy_conf_get_bool (conf, EMPATHY_PREFS_NOTIFICATIONS_ENABLED, &res);
+
+  if (!res)
+    return FALSE;
+
+  if (!empathy_check_available_state ())
+    {
+      empathy_conf_get_bool (conf, EMPATHY_PREFS_NOTIFICATIONS_DISABLED_AWAY,
+          &res);
+
+      if (res)
+        return FALSE;
+    }
+
+  return TRUE;
+}