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); |