aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@src.gnome.org>2009-01-31 01:08:04 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2009-01-31 01:08:04 +0800
commitf1de7218621b82fe0622aa04f380445150af39fc (patch)
tree8f113ca2346c0838fd62dad8201971327263807c /src
parentc23031cdb33273d6396657f93d5daa064b7d7cac (diff)
downloadgsoc2013-empathy-f1de7218621b82fe0622aa04f380445150af39fc.tar
gsoc2013-empathy-f1de7218621b82fe0622aa04f380445150af39fc.tar.gz
gsoc2013-empathy-f1de7218621b82fe0622aa04f380445150af39fc.tar.bz2
gsoc2013-empathy-f1de7218621b82fe0622aa04f380445150af39fc.tar.lz
gsoc2013-empathy-f1de7218621b82fe0622aa04f380445150af39fc.tar.xz
gsoc2013-empathy-f1de7218621b82fe0622aa04f380445150af39fc.tar.zst
gsoc2013-empathy-f1de7218621b82fe0622aa04f380445150af39fc.zip
Move empathy_notification_is_enabled () to src/
svn path=/trunk/; revision=2294
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am1
-rw-r--r--src/empathy-chat-window.c10
-rw-r--r--src/empathy-misc.c56
-rw-r--r--src/empathy-misc.h35
-rw-r--r--src/empathy-status-icon.c7
5 files changed, 105 insertions, 4 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 5294eac09..db6479ea9 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -32,6 +32,7 @@ empathy_SOURCES = \
empathy-import-dialog.c empathy-import-dialog.h \
empathy-import-pidgin.c empathy-import-pidgin.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-status-icon.c empathy-status-icon.h \
diff --git a/src/empathy-chat-window.c b/src/empathy-chat-window.c
index 31a2866a6..cbb6c085c 100644
--- a/src/empathy-chat-window.c
+++ b/src/empathy-chat-window.c
@@ -55,6 +55,7 @@
#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>
@@ -868,9 +869,16 @@ chat_window_show_or_update_notification (EmpathyMessage *message,
const char *body;
GdkPixbuf *pixbuf;
EmpathyChatWindowPriv *priv = GET_PRIV (window);
+ gboolean res;
- if (!empathy_notification_should_show (TRUE)) {
+ if (!empathy_notification_is_enabled ()) {
return;
+ } else {
+ empathy_conf_get_bool (empathy_conf_get (),
+ EMPATHY_PREFS_NOTIFICATIONS_FOCUS, &res);
+ if (!res) {
+ return;
+ }
}
sender = empathy_message_get_sender (message);
diff --git a/src/empathy-misc.c b/src/empathy-misc.c
new file mode 100644
index 000000000..eb4baf3d4
--- /dev/null
+++ b/src/empathy-misc.c
@@ -0,0 +1,56 @@
+/* -*- 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Author: Cosimo Cecchi <cosimo.cecchi@collabora.co.uk>
+ *
+ */
+
+#include "empathy-misc.h"
+
+#include <libempathy/empathy-utils.h>
+#include <libempathy-gtk/empathy-conf.h>
+
+/* public methods */
+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
new file mode 100644
index 000000000..6bc3e2b27
--- /dev/null
+++ b/src/empathy-misc.h
@@ -0,0 +1,35 @@
+/* -*- 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Author: Cosimo Cecchi <cosimo.cecchi@collabora.co.uk>
+ *
+ */
+
+#ifndef __EMPATHY_MISC_H__
+#define __EMPATHY_MISC_H__
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+gboolean empathy_notification_is_enabled (void);
+
+G_END_DECLS
+
+#endif /* __EMPATHY_MISC_H__ */
diff --git a/src/empathy-status-icon.c b/src/empathy-status-icon.c
index 08293de55..07f8abf85 100644
--- a/src/empathy-status-icon.c
+++ b/src/empathy-status-icon.c
@@ -43,6 +43,7 @@
#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>
@@ -225,7 +226,7 @@ status_icon_event_added_cb (EmpathyEventManager *manager,
status_icon_update_icon (icon);
status_icon_update_tooltip (icon);
- if (empathy_notification_should_show (FALSE)) {
+ if (empathy_notification_is_enabled ()) {
status_icon_update_notification (icon);
}
@@ -274,7 +275,7 @@ status_icon_event_updated_cb (EmpathyEventManager *manager,
return;
}
- if (empathy_notification_should_show (FALSE)) {
+ if (empathy_notification_is_enabled ()) {
status_icon_update_notification (icon);
}
@@ -342,7 +343,7 @@ status_icon_idle_notify_cb (EmpathyStatusIcon *icon)
status_icon_update_icon (icon);
status_icon_update_tooltip (icon);
- if (!empathy_notification_should_show (FALSE)) {
+ if (!empathy_notification_is_enabled ()) {
/* dismiss the outstanding notification if present */
if (priv->notification) {