empathy r2302 - trunk/src
- From: xclaesse svn gnome org
- To: svn-commits-list gnome org
- Subject: empathy r2302 - trunk/src
- Date: Fri, 30 Jan 2009 17:08:29 +0000 (UTC)
Author: xclaesse
Date: Fri Jan 30 17:08:29 2009
New Revision: 2302
URL: http://svn.gnome.org/viewvc/empathy?rev=2302&view=rev
Log:
Factor out some common code.
Modified:
trunk/src/empathy-chat-window.c
trunk/src/empathy-misc.c
trunk/src/empathy-misc.h
trunk/src/empathy-status-icon.c
Modified: trunk/src/empathy-chat-window.c
==============================================================================
--- trunk/src/empathy-chat-window.c (original)
+++ trunk/src/empathy-chat-window.c Fri Jan 30 17:08:29 2009
@@ -893,11 +893,8 @@
empathy_contact_get_name (sender));
body = empathy_message_get_body (message);
escaped = g_markup_escape_text (body, -1);
- pixbuf = empathy_pixbuf_avatar_from_contact_scaled (sender, 48, 48);
- if (pixbuf == NULL) {
- pixbuf = empathy_pixbuf_from_icon_name_sized
- (EMPATHY_IMAGE_NEW_MESSAGE, 48);
- }
+
+ pixbuf = empathy_misc_get_pixbuf_for_notification (sender, EMPATHY_IMAGE_NEW_MESSAGE);
if (priv->notification != NULL) {
notify_notification_update (priv->notification,
Modified: trunk/src/empathy-misc.c
==============================================================================
--- trunk/src/empathy-misc.c (original)
+++ trunk/src/empathy-misc.c Fri Jan 30 17:08:29 2009
@@ -24,9 +24,30 @@
#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)
{
Modified: trunk/src/empathy-misc.h
==============================================================================
--- trunk/src/empathy-misc.h (original)
+++ trunk/src/empathy-misc.h Fri Jan 30 17:08:29 2009
@@ -25,6 +25,9 @@
#define __EMPATHY_MISC_H__
#include <glib.h>
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#include <libempathy/empathy-contact.h>
G_BEGIN_DECLS
@@ -38,6 +41,8 @@
} NotificationClosedReason;
gboolean empathy_notification_is_enabled (void);
+GdkPixbuf * empathy_misc_get_pixbuf_for_notification (EmpathyContact *contact,
+ const char *icon_name);
G_END_DECLS
Modified: trunk/src/empathy-status-icon.c
==============================================================================
--- trunk/src/empathy-status-icon.c (original)
+++ trunk/src/empathy-status-icon.c Fri Jan 30 17:08:29 2009
@@ -101,7 +101,7 @@
/* the notification has been closed by the user, see the
* DesktopNotification spec.
*/
- if (reason == 2) {
+ if (reason == NOTIFICATION_CLOSED_DISMISSED) {
g_idle_add ((GSourceFunc) activate_event, priv->event);
} else {
/* inhibit other updates for this event */
@@ -109,24 +109,6 @@
}
}
-static GdkPixbuf *
-get_pixbuf_for_event (EmpathyEvent *event)
-{
- GdkPixbuf *pixbuf = NULL;
-
- if (event->contact != NULL) {
- pixbuf = empathy_pixbuf_avatar_from_contact_scaled (event->contact,
- 48, 48);
- }
-
- if (!pixbuf) {
- pixbuf = empathy_pixbuf_from_icon_name_sized
- (event->icon_name, 48);
- }
-
- return pixbuf;
-}
-
static void
notification_close_helper (EmpathyStatusIconPriv *priv)
{
@@ -150,7 +132,8 @@
}
if (priv->event) {
- pixbuf = get_pixbuf_for_event (priv->event);
+ pixbuf = empathy_misc_get_pixbuf_for_notification (priv->event->contact,
+ priv->event->icon_name);
if (priv->notification) {
notify_notification_update (priv->notification,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]