]> git.0d.be Git - empathy.git/commitdiff
move empathy-misc to empathy-notify-manager
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Thu, 12 Nov 2009 12:46:42 +0000 (12:46 +0000)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Fri, 13 Nov 2009 11:37:18 +0000 (11:37 +0000)
All its code was related to notifications.

libempathy-gtk/empathy-notify-manager.c
libempathy-gtk/empathy-notify-manager.h
src/Makefile.am
src/empathy-chat-window.c
src/empathy-misc.c [deleted file]
src/empathy-misc.h [deleted file]
src/empathy-status-icon.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;
+}
index 951bd4d98df9340db19d51d6babe0635725c365d..d56e508529c8a6a4918175237087576ed9b33aa7 100644 (file)
@@ -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__ */
index cfd751379617620f36b008d3ed846fa0a7a3e810..b61f9d34aa878ba0994c4689eb0cfea91aa2078b 100644 (file)
@@ -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                             \
index ccbfff67aa70db66d1f3dc03d2c7fb1361e37400..6d69235a36d4f7d1c5eba07e2f341681fceddcac 100644 (file)
 #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 (file)
index a1a0847..0000000
+++ /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 (file)
index b3fe8fd..0000000
+++ /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__ */
index 000100f76ed59305d80740397f94c810d023917a..aaf827dc38ba3dde78ef5da7ac8d41cd4e30af55 100644 (file)
@@ -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>