aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2009-11-12 20:46:42 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2009-11-13 19:37:18 +0800
commit31ffe0cd7670a9c31402443587dbe7d12f8561e0 (patch)
tree97846359386d99ff493c71569be8243d6cc541fe
parentb5b5db79ae1c2fef783c415fbf577e8dc34e6b5d (diff)
downloadgsoc2013-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.
-rw-r--r--libempathy-gtk/empathy-notify-manager.c44
-rw-r--r--libempathy-gtk/empathy-notify-manager.h14
-rw-r--r--src/Makefile.am1
-rw-r--r--src/empathy-chat-window.c2
-rw-r--r--src/empathy-misc.c77
-rw-r--r--src/empathy-misc.h49
-rw-r--r--src/empathy-status-icon.c1
7 files changed, 59 insertions, 129 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__ */
diff --git a/src/Makefile.am b/src/Makefile.am
index cfd751379..b61f9d34a 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 ccbfff67a..6d69235a3 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-misc.c b/src/empathy-misc.c
deleted file mode 100644
index a1a084740..000000000
--- a/src/empathy-misc.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Copyright (C) 2009 Collabora Ltd.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301 USA
- *
- * Author: Cosimo Cecchi <cosimo.cecchi@collabora.co.uk>
- *
- */
-
-#include "empathy-misc.h"
-
-#include <libempathy/empathy-utils.h>
-#include <libempathy-gtk/empathy-ui-utils.h>
-#include <libempathy-gtk/empathy-conf.h>
-
-/* public methods */
-
-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) {
- 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/src/empathy-misc.h b/src/empathy-misc.h
deleted file mode 100644
index b3fe8fdbf..000000000
--- a/src/empathy-misc.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Copyright (C) 2009 Collabora Ltd.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301 USA
- *
- * Author: Cosimo Cecchi <cosimo.cecchi@collabora.co.uk>
- *
- */
-
-#ifndef __EMPATHY_MISC_H__
-#define __EMPATHY_MISC_H__
-
-#include <glib.h>
-#include <gdk-pixbuf/gdk-pixbuf.h>
-
-#include <libempathy/empathy-contact.h>
-
-G_BEGIN_DECLS
-
-/* 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;
-
-gboolean empathy_notification_is_enabled (void);
-GdkPixbuf * empathy_misc_get_pixbuf_for_notification (EmpathyContact *contact,
- const char *icon_name);
-
-G_END_DECLS
-
-#endif /* __EMPATHY_MISC_H__ */
diff --git a/src/empathy-status-icon.c b/src/empathy-status-icon.c
index 000100f76..aaf827dc3 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>