Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 269570 | Differences between
and this patch

Collapse All | Expand All

(-)a/configure.ac (-1 / +7 lines)
Lines 115-121 PKG_CHECK_MODULES(EMPATHY, Link Here
115
   telepathy-farsight
115
   telepathy-farsight
116
])
116
])
117
117
118
PKG_CHECK_MODULES(LIBNOTIFY, libnotify >= $LIBNOTIFY_REQUIRED)
118
AC_ARG_ENABLE([notify],
119
	AC_HELP_STRING([--disable-notify], [Disable libnotify support @<:@default=yes@:>@]),
120
	[enable_notify="$enableval"], [enable_notify="yes"])
121
if test "x$enable_notify" = "xyes"; then
122
   PKG_CHECK_MODULES(LIBNOTIFY, libnotify >= $LIBNOTIFY_REQUIRED)
123
   AC_DEFINE(HAVE_NOTIFY, 1, [Define to 1 if libnotify support is required])
124
fi
119
125
120
# -----------------------------------------------------------
126
# -----------------------------------------------------------
121
# Enable debug
127
# Enable debug
(-)a/src/empathy-chat-window.c (-7 / +11 lines)
Lines 33-40 Link Here
33
#include <gdk/gdkkeysyms.h>
33
#include <gdk/gdkkeysyms.h>
34
#include <glade/glade.h>
34
#include <glade/glade.h>
35
#include <glib/gi18n.h>
35
#include <glib/gi18n.h>
36
#ifdef HAVE_NOTIFY
36
#include <libnotify/notification.h>
37
#include <libnotify/notification.h>
37
38
#endif
38
#include <telepathy-glib/util.h>
39
#include <telepathy-glib/util.h>
39
#include <libmissioncontrol/mission-control.h>
40
#include <libmissioncontrol/mission-control.h>
40
41
Lines 72-79 typedef struct { Link Here
72
	EmpathyChatroomManager *chatroom_manager;
73
	EmpathyChatroomManager *chatroom_manager;
73
	GtkWidget   *dialog;
74
	GtkWidget   *dialog;
74
	GtkWidget   *notebook;
75
	GtkWidget   *notebook;
76
#ifdef HAVE_NOTIFY
75
	NotifyNotification *notification;
77
	NotifyNotification *notification;
76
78
#endif
77
	/* Menu items. */
79
	/* Menu items. */
78
	GtkWidget   *menu_conv_clear;
80
	GtkWidget   *menu_conv_clear;
79
	GtkWidget   *menu_conv_insert_smiley;
81
	GtkWidget   *menu_conv_insert_smiley;
Lines 841-846 typedef struct { Link Here
841
	EmpathyChat *chat;
843
	EmpathyChat *chat;
842
} NotificationData;
844
} NotificationData;
843
845
846
#ifdef HAVE_NOTIFY
844
static void
847
static void
845
chat_window_notification_closed_cb (NotifyNotification *notify,
848
chat_window_notification_closed_cb (NotifyNotification *notify,
846
				    NotificationData *cb_data)
849
				    NotificationData *cb_data)
Lines 850-856 chat_window_notification_closed_cb (NotifyNotification *notify, Link Here
850
853
851
#ifdef notify_notification_get_closed_reason
854
#ifdef notify_notification_get_closed_reason
852
	reason = notify_notification_get_closed_reason (notify);
855
	reason = notify_notification_get_closed_reason (notify);
853
#endif
856
#endif /* notify_notification_get_closed_reason */
854
	if (reason == EMPATHY_NOTIFICATION_CLOSED_DISMISSED) {
857
	if (reason == EMPATHY_NOTIFICATION_CLOSED_DISMISSED) {
855
		empathy_chat_window_present_chat (cb_data->chat);
858
		empathy_chat_window_present_chat (cb_data->chat);
856
	}
859
	}
Lines 915-920 chat_window_show_or_update_notification (EmpathyChatWindow *window, Link Here
915
	g_free (header);
918
	g_free (header);
916
	g_free (escaped);
919
	g_free (escaped);
917
}
920
}
921
#endif /* HAVE_NOTIFY */
918
922
919
static void
923
static void
920
chat_window_new_message_cb (EmpathyChat       *chat,
924
chat_window_new_message_cb (EmpathyChat       *chat,
Lines 948-958 chat_window_new_message_cb (EmpathyChat *chat, Link Here
948
					    EMPATHY_SOUND_MESSAGE_INCOMING);
952
					    EMPATHY_SOUND_MESSAGE_INCOMING);
949
		}
953
		}
950
	}
954
	}
951
955
#ifdef HAVE_NOTIFY
952
	if (!has_focus) {
956
	if (!has_focus) {
953
		chat_window_show_or_update_notification (window, message, chat);
957
		chat_window_show_or_update_notification (window, message, chat);
954
	}
958
	}
955
959
#endif
956
	if (has_focus && priv->current_chat == chat) {
960
	if (has_focus && priv->current_chat == chat) {
957
		return;
961
		return;
958
	}
962
	}
Lines 1249-1261 chat_window_finalize (GObject *object) Link Here
1249
	if (priv->save_geometry_id != 0) {
1253
	if (priv->save_geometry_id != 0) {
1250
		g_source_remove (priv->save_geometry_id);
1254
		g_source_remove (priv->save_geometry_id);
1251
	}
1255
	}
1252
1256
#ifdef HAVE_NOTIFY
1253
	if (priv->notification != NULL) {
1257
	if (priv->notification != NULL) {
1254
		notify_notification_close (priv->notification, NULL);
1258
		notify_notification_close (priv->notification, NULL);
1255
		g_object_unref (priv->notification);
1259
		g_object_unref (priv->notification);
1256
		priv->notification = NULL;
1260
		priv->notification = NULL;
1257
	}
1261
	}
1258
1262
#endif
1259
	chat_windows = g_list_remove (chat_windows, window);
1263
	chat_windows = g_list_remove (chat_windows, window);
1260
	gtk_widget_destroy (priv->dialog);
1264
	gtk_widget_destroy (priv->dialog);
1261
1265
(-)a/src/empathy-status-icon.c (-15 / +20 lines)
Lines 26-34 Link Here
26
#include <gtk/gtk.h>
26
#include <gtk/gtk.h>
27
#include <glade/glade.h>
27
#include <glade/glade.h>
28
#include <gdk/gdkkeysyms.h>
28
#include <gdk/gdkkeysyms.h>
29
29
#ifdef HAVE_NOTIFY
30
#include <libnotify/notification.h>
30
#include <libnotify/notification.h>
31
31
#endif /* HAVE_NOTIFY */
32
#include <libempathy/empathy-utils.h>
32
#include <libempathy/empathy-utils.h>
33
#include <libempathy/empathy-idle.h>
33
#include <libempathy/empathy-idle.h>
34
#include <libempathy/empathy-account-manager.h>
34
#include <libempathy/empathy-account-manager.h>
Lines 60-67 typedef struct { Link Here
60
	guint                blink_timeout;
60
	guint                blink_timeout;
61
	EmpathyEventManager *event_manager;
61
	EmpathyEventManager *event_manager;
62
	EmpathyEvent        *event;
62
	EmpathyEvent        *event;
63
#ifdef HAVE_NOTIFY
63
	NotifyNotification  *notification;
64
	NotifyNotification  *notification;
64
65
#endif
65
	GtkWindow           *window;
66
	GtkWindow           *window;
66
	GtkWidget           *popup_menu;
67
	GtkWidget           *popup_menu;
67
	GtkWidget           *show_window_item;
68
	GtkWidget           *show_window_item;
Lines 71-76 typedef struct { Link Here
71
72
72
G_DEFINE_TYPE (EmpathyStatusIcon, empathy_status_icon, G_TYPE_OBJECT);
73
G_DEFINE_TYPE (EmpathyStatusIcon, empathy_status_icon, G_TYPE_OBJECT);
73
74
75
#ifdef HAVE_NOTIFY
74
static gboolean
76
static gboolean
75
activate_event (EmpathyEvent *event)
77
activate_event (EmpathyEvent *event)
76
{
78
{
Lines 88-94 status_icon_notification_closed_cb (NotifyNotification *notification, Link Here
88
90
89
#ifdef notify_notification_get_closed_reason
91
#ifdef notify_notification_get_closed_reason
90
	reason = notify_notification_get_closed_reason (notification);
92
	reason = notify_notification_get_closed_reason (notification);
91
#endif
93
#endif /* notify_notification_get_closed_reason */
92
	if (priv->notification) {
94
	if (priv->notification) {
93
		g_object_unref (priv->notification);
95
		g_object_unref (priv->notification);
94
		priv->notification = NULL;
96
		priv->notification = NULL;
Lines 162-168 status_icon_update_notification (EmpathyStatusIcon *icon) Link Here
162
		notification_close_helper (priv);
164
		notification_close_helper (priv);
163
	}
165
	}
164
}
166
}
165
167
#endif /* HAVE_NOTIFY */
166
static void
168
static void
167
status_icon_update_tooltip (EmpathyStatusIcon *icon)
169
status_icon_update_tooltip (EmpathyStatusIcon *icon)
168
{
170
{
Lines 236-243 status_icon_event_added_cb (EmpathyEventManager *manager, Link Here
236
238
237
	status_icon_update_icon (icon);
239
	status_icon_update_icon (icon);
238
	status_icon_update_tooltip (icon);
240
	status_icon_update_tooltip (icon);
241
#ifdef HAVE_NOTIFY
239
	status_icon_update_notification (icon);
242
	status_icon_update_notification (icon);
240
243
#endif
241
	if (!priv->blink_timeout) {
244
	if (!priv->blink_timeout) {
242
		priv->blink_timeout = g_timeout_add (BLINK_TIMEOUT,
245
		priv->blink_timeout = g_timeout_add (BLINK_TIMEOUT,
243
						     (GSourceFunc) status_icon_blink_timeout_cb,
246
						     (GSourceFunc) status_icon_blink_timeout_cb,
Lines 263-271 status_icon_event_removed_cb (EmpathyEventManager *manager, Link Here
263
266
264
	/* update notification anyway, as it's safe and we might have been
267
	/* update notification anyway, as it's safe and we might have been
265
	 * changed presence in the meanwhile
268
	 * changed presence in the meanwhile
266
	 */	
269
	 */
270
#ifdef HAVE_NOTIFY	
267
	status_icon_update_notification (icon);
271
	status_icon_update_notification (icon);
268
272
#endif
269
	if (!priv->event && priv->blink_timeout) {
273
	if (!priv->event && priv->blink_timeout) {
270
		g_source_remove (priv->blink_timeout);
274
		g_source_remove (priv->blink_timeout);
271
		priv->blink_timeout = 0;
275
		priv->blink_timeout = 0;
Lines 282-292 status_icon_event_updated_cb (EmpathyEventManager *manager, Link Here
282
	if (event != priv->event) {
286
	if (event != priv->event) {
283
		return;
287
		return;
284
	}
288
	}
285
289
#ifdef HAVE_NOTIFY
286
	if (empathy_notification_is_enabled ()) {
290
	if (empathy_notification_is_enabled ()) {
287
		status_icon_update_notification (icon);
291
		status_icon_update_notification (icon);
288
	}
292
	}
289
293
#endif
290
	status_icon_update_tooltip (icon);
294
	status_icon_update_tooltip (icon);
291
}
295
}
292
296
Lines 346-357 status_icon_toggle_visibility (EmpathyStatusIcon *icon) Link Here
346
static void
350
static void
347
status_icon_idle_notify_cb (EmpathyStatusIcon *icon)
351
status_icon_idle_notify_cb (EmpathyStatusIcon *icon)
348
{
352
{
349
	EmpathyStatusIconPriv *priv = GET_PRIV (icon);
350
351
	status_icon_update_icon (icon);
353
	status_icon_update_icon (icon);
352
	status_icon_update_tooltip (icon);
354
	status_icon_update_tooltip (icon);
353
355
#ifdef HAVE_NOTIFY
354
	if (!empathy_notification_is_enabled ()) {
356
	if (!empathy_notification_is_enabled ()) {
357
		/* Fix avoidable QA warning */
358
		EmpathyStatusIconPriv *priv = GET_PRIV (icon);
355
		/* dismiss the outstanding notification if present */
359
		/* dismiss the outstanding notification if present */
356
360
357
		if (priv->notification) {
361
		if (priv->notification) {
Lines 360-365 status_icon_idle_notify_cb (EmpathyStatusIcon *icon) Link Here
360
			priv->notification = NULL;
364
			priv->notification = NULL;
361
		}
365
		}
362
	}
366
	}
367
#endif
363
}
368
}
364
369
365
static gboolean
370
static gboolean
Lines 511-523 status_icon_finalize (GObject *object) Link Here
511
	g_signal_handlers_disconnect_by_func (priv->account_manager,
516
	g_signal_handlers_disconnect_by_func (priv->account_manager,
512
					      status_icon_connection_changed_cb,
517
					      status_icon_connection_changed_cb,
513
					      object);
518
					      object);
514
519
#ifdef HAVE_NOTIFY
515
	if (priv->notification) {
520
	if (priv->notification) {
516
		notify_notification_close (priv->notification, NULL);
521
		notify_notification_close (priv->notification, NULL);
517
		g_object_unref (priv->notification);
522
		g_object_unref (priv->notification);
518
		priv->notification = NULL;
523
		priv->notification = NULL;
519
	}
524
	}
520
525
#endif
521
	g_object_unref (priv->icon);
526
	g_object_unref (priv->icon);
522
	g_object_unref (priv->idle);
527
	g_object_unref (priv->idle);
523
	g_object_unref (priv->account_manager);
528
	g_object_unref (priv->account_manager);
(-)a/src/empathy.c (-4 / +6 lines)
Lines 32-39 Link Here
32
#include <gdk/gdkx.h>
32
#include <gdk/gdkx.h>
33
33
34
#include <libebook/e-book.h>
34
#include <libebook/e-book.h>
35
#ifdef HAVE_NOTIFY
35
#include <libnotify/notify.h>
36
#include <libnotify/notify.h>
36
37
#endif /* HAVE_NOTIFY */
37
#include <telepathy-glib/util.h>
38
#include <telepathy-glib/util.h>
38
#include <libmissioncontrol/mc-account.h>
39
#include <libmissioncontrol/mc-account.h>
39
#include <libmissioncontrol/mission-control.h>
40
#include <libmissioncontrol/mission-control.h>
Lines 559-566 main (int argc, char *argv[]) Link Here
559
	empathy_chatroom_manager_observe (chatroom_manager, dispatcher);
560
	empathy_chatroom_manager_observe (chatroom_manager, dispatcher);
560
561
561
	ft_manager = empathy_ft_manager_dup_singleton ();
562
	ft_manager = empathy_ft_manager_dup_singleton ();
562
563
#ifdef HAVE_NOTIFY
563
	notify_init (_(PACKAGE_NAME));
564
	notify_init (_(PACKAGE_NAME));
565
#endif
564
	/* Create the call factory */
566
	/* Create the call factory */
565
	call_factory = empathy_call_factory_initialise ();
567
	call_factory = empathy_call_factory_initialise ();
566
	g_signal_connect (G_OBJECT (call_factory), "new-call-handler",
568
	g_signal_connect (G_OBJECT (call_factory), "new-call-handler",
Lines 577-585 main (int argc, char *argv[]) Link Here
577
	g_object_unref (dispatcher);
579
	g_object_unref (dispatcher);
578
	g_object_unref (chatroom_manager);
580
	g_object_unref (chatroom_manager);
579
	g_object_unref (ft_manager);
581
	g_object_unref (ft_manager);
580
582
#ifdef HAVE_NOTIFY
581
	notify_uninit ();
583
	notify_uninit ();
582
584
#endif
583
	return EXIT_SUCCESS;
585
	return EXIT_SUCCESS;
584
}
586
}
585
587

Return to bug 269570