[empathy] move empathy-misc to empathy-notify-manager
- From: Guillaume Desmottes <gdesmott src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [empathy] move empathy-misc to empathy-notify-manager
- Date: Fri, 13 Nov 2009 11:39:54 +0000 (UTC)
commit 31ffe0cd7670a9c31402443587dbe7d12f8561e0
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date: Thu Nov 12 12:46:42 2009 +0000
move empathy-misc to empathy-notify-manager
All its code was related to notifications.
libempathy-gtk/empathy-notify-manager.c | 44 +++++++++++++++++
libempathy-gtk/empathy-notify-manager.h | 14 ++++++
src/Makefile.am | 1 -
src/empathy-chat-window.c | 2 +-
src/empathy-misc.c | 77 -------------------------------
src/empathy-misc.h | 49 -------------------
src/empathy-status-icon.c | 1 -
7 files changed, 59 insertions(+), 129 deletions(-)
---
diff --git a/libempathy-gtk/empathy-notify-manager.c b/libempathy-gtk/empathy-notify-manager.c
index 0bb6b85..44f7793 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 951bd4d..d56e508 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__ */
diff --git a/src/Makefile.am b/src/Makefile.am
index cfd7513..b61f9d3 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -46,7 +46,6 @@ empathy_handwritten_source = \
empathy-import-utils.c empathy-import-utils.h \
empathy-import-widget.c empathy-import-widget.h \
empathy-main-window.c empathy-main-window.h \
- empathy-misc.c empathy-misc.h \
empathy-new-chatroom-dialog.c empathy-new-chatroom-dialog.h \
empathy-preferences.c empathy-preferences.h \
empathy-sidebar.c empathy-sidebar.h \
diff --git a/src/empathy-chat-window.c b/src/empathy-chat-window.c
index ccbfff6..6d69235 100644
--- a/src/empathy-chat-window.c
+++ b/src/empathy-chat-window.c
@@ -52,10 +52,10 @@
#include <libempathy-gtk/empathy-smiley-manager.h>
#include <libempathy-gtk/empathy-sound.h>
#include <libempathy-gtk/empathy-ui-utils.h>
+#include <libempathy-gtk/empathy-notify-manager.h>
#include "empathy-chat-window.h"
#include "empathy-about-dialog.h"
-#include "empathy-misc.h"
#define DEBUG_FLAG EMPATHY_DEBUG_CHAT
#include <libempathy/empathy-debug.h>
diff --git a/src/empathy-status-icon.c b/src/empathy-status-icon.c
index 000100f..aaf827d 100644
--- a/src/empathy-status-icon.c
+++ b/src/empathy-status-icon.c
@@ -49,7 +49,6 @@
#include "empathy-status-icon.h"
#include "empathy-preferences.h"
#include "empathy-event-manager.h"
-#include "empathy-misc.h"
#define DEBUG_FLAG EMPATHY_DEBUG_DISPATCHER
#include <libempathy/empathy-debug.h>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]