diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2009-11-12 20:46:42 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2009-11-13 19:37:18 +0800 |
commit | 31ffe0cd7670a9c31402443587dbe7d12f8561e0 (patch) | |
tree | 97846359386d99ff493c71569be8243d6cc541fe /libempathy-gtk | |
parent | b5b5db79ae1c2fef783c415fbf577e8dc34e6b5d (diff) | |
download | gsoc2013-empathy-31ffe0cd7670a9c31402443587dbe7d12f8561e0.tar gsoc2013-empathy-31ffe0cd7670a9c31402443587dbe7d12f8561e0.tar.gz gsoc2013-empathy-31ffe0cd7670a9c31402443587dbe7d12f8561e0.tar.bz2 gsoc2013-empathy-31ffe0cd7670a9c31402443587dbe7d12f8561e0.tar.lz gsoc2013-empathy-31ffe0cd7670a9c31402443587dbe7d12f8561e0.tar.xz gsoc2013-empathy-31ffe0cd7670a9c31402443587dbe7d12f8561e0.tar.zst gsoc2013-empathy-31ffe0cd7670a9c31402443587dbe7d12f8561e0.zip |
move empathy-misc to empathy-notify-manager
All its code was related to notifications.
Diffstat (limited to 'libempathy-gtk')
-rw-r--r-- | libempathy-gtk/empathy-notify-manager.c | 44 | ||||
-rw-r--r-- | libempathy-gtk/empathy-notify-manager.h | 14 |
2 files changed, 58 insertions, 0 deletions
diff --git a/libempathy-gtk/empathy-notify-manager.c b/libempathy-gtk/empathy-notify-manager.c index 0bb6b8561..44f77937f 100644 --- a/libempathy-gtk/empathy-notify-manager.c +++ b/libempathy-gtk/empathy-notify-manager.c @@ -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; +} diff --git a/libempathy-gtk/empathy-notify-manager.h b/libempathy-gtk/empathy-notify-manager.h index 951bd4d98..d56e50852 100644 --- a/libempathy-gtk/empathy-notify-manager.h +++ b/libempathy-gtk/empathy-notify-manager.h @@ -51,6 +51,15 @@ G_BEGIN_DECLS #define EMPATHY_IS_NOTIFY_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EMPATHY_TYPE_NOTIFY_MANAGER)) #define EMPATHY_NOTIFY_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EMPATHY_TYPE_NOTIFY_MANAGER, EmpathyNotifyManagerClass)) +/* FIXME: this should *really* belong to libnotify. */ +typedef enum { + EMPATHY_NOTIFICATION_CLOSED_INVALID = 0, + EMPATHY_NOTIFICATION_CLOSED_EXPIRED = 1, + EMPATHY_NOTIFICATION_CLOSED_DISMISSED = 2, + EMPATHY_NOTIFICATION_CLOSED_PROGRAMMATICALY = 3, + EMPATHY_NOTIFICATION_CLOSED_RESERVED = 4 +} EmpathyNotificationClosedReason; + typedef struct _EmpathyNotifyManager EmpathyNotifyManager; typedef struct _EmpathyNotifyManagerClass EmpathyNotifyManagerClass; @@ -73,6 +82,11 @@ EmpathyNotifyManager * empathy_notify_manager_dup_singleton (void); gboolean empathy_notify_manager_has_capability (EmpathyNotifyManager *self, const gchar *capa); +gboolean empathy_notification_is_enabled (void); +GdkPixbuf * empathy_misc_get_pixbuf_for_notification (EmpathyContact *contact, + const char *icon_name); + + G_END_DECLS #endif /* __EMPATHY_NOTIFY_MANAGER_H__ */ |