1
=== modified file 'configure.ac'
2
Index: empathy-2.34.0/configure.ac
3
===================================================================
4
--- empathy-2.34.0.orig/configure.ac 2011-03-24 12:46:07.198547066 -0400
5
+++ empathy-2.34.0/configure.ac 2011-03-24 12:46:24.808547063 -0400
7
NETWORK_MANAGER_REQUIRED=0.7.0
9
GNOME_CONTROL_CENTER_GTK3_REQUIRED=2.31.4
10
+INDICATE_REQUIRED=0.4.91
11
+INDICATE_GTK_REQUIRED=0.4.91
14
prev_top_build_prefix=$ac_top_build_prefix
18
# -----------------------------------------------------------
20
+# -----------------------------------------------------------
21
+AC_ARG_ENABLE(libindicate,
22
+ AS_HELP_STRING([--enable-libindicate=@<:@no/yes/auto@:>@],
23
+ [build libindicate support]), ,
24
+ enable_libindicate=auto)
26
+if test "x$enable_libindicate" != "xno"; then
27
+ PKG_CHECK_MODULES(INDICATE,
29
+ indicate-0.5 >= $INDICATE_REQUIRED,
30
+ indicate-gtk-0.5 >= $INDICATE_GTK_REQUIRED
31
+ ], have_libindicate="yes", have_libindicate="no")
33
+ if test "x$have_libindicate" = "xyes"; then
34
+ AC_DEFINE(HAVE_LIBINDICATE, 1, [Define if you have libindicate])
40
+if test "x$enable_libindicate" = "xyes" -a "x$have_libindicate" != "xyes"; then
41
+ AC_MSG_ERROR([Couldn't find libindicate.])
44
+AM_CONDITIONAL(HAVE_LIBINDICATE, test "x$have_libindicate" = "xyes")
46
+# -----------------------------------------------------------
48
# -----------------------------------------------------------
49
AC_ARG_ENABLE(nautilus-sendto,
51
CA Cert Path................: ${GTLS_SYSTEM_CA_FILE}
54
+ Message indicator support (libindicate): ${have_libindicate}
55
Spell checking (enchant)....: ${have_enchant}
56
Display maps (libchamplain).: ${have_libchamplain}
57
Location awareness (Geoclue): ${have_geoclue}
58
Index: empathy-2.34.0/data/org.gnome.Empathy.gschema.xml.in
59
===================================================================
60
--- empathy-2.34.0.orig/data/org.gnome.Empathy.gschema.xml.in 2011-03-24 12:46:14.568547064 -0400
61
+++ empathy-2.34.0/data/org.gnome.Empathy.gschema.xml.in 2011-03-24 12:46:24.808547063 -0400
63
<_summary>The position for the chat window side pane</_summary>
64
<_description>The stored position (in pixels) of the chat window side pane.</_description>
66
+ <key name="use-libindicate" type="b">
67
+ <default>true</default>
68
+ <summary>Use the messaging indicator</summary>
69
+ <description>Whether or not to use the messaging indicator, if false the icon in the notification area will be displayed.</description>
72
<schema id="org.gnome.Empathy.contacts" path="/apps/empathy/contacts/">
73
<key name="sort-criterium" type="s">
74
Index: empathy-2.34.0/libempathy-gtk/empathy-ui-utils.c
75
===================================================================
76
--- empathy-2.34.0.orig/libempathy-gtk/empathy-ui-utils.c 2011-03-24 11:15:16.000000000 -0400
77
+++ empathy-2.34.0/libempathy-gtk/empathy-ui-utils.c 2011-03-24 12:46:24.808547063 -0400
78
@@ -1567,25 +1567,36 @@
80
GdkWindow *gdk_window;
82
- gtk_status_icon_get_geometry (status_icon, NULL, &icon_location, NULL);
83
- gdk_window = gtk_widget_get_window (GTK_WIDGET (window));
84
- dpy = gdk_x11_drawable_get_xdisplay (gdk_window);
85
+ // If the status icon isn't visible (because indicators are used) then
86
+ // attempting to change the properties of the status icon doesn't work.
87
+ if (gtk_status_icon_get_visible (status_icon)) {
88
+ gtk_status_icon_get_geometry (status_icon, NULL, &icon_location, NULL);
89
+ gdk_window = gtk_widget_get_window (GTK_WIDGET (window));
90
+ dpy = gdk_x11_drawable_get_xdisplay (gdk_window);
92
- data[0] = icon_location.x;
93
- data[1] = icon_location.y;
94
- data[2] = icon_location.width;
95
- data[3] = icon_location.height;
96
+ data[0] = icon_location.x;
97
+ data[1] = icon_location.y;
98
+ data[2] = icon_location.width;
99
+ data[3] = icon_location.height;
101
- XChangeProperty (dpy,
102
- GDK_WINDOW_XID (gdk_window),
103
- gdk_x11_get_xatom_by_name_for_display (
104
- gdk_drawable_get_display (gdk_window),
105
- "_NET_WM_ICON_GEOMETRY"),
106
- XA_CARDINAL, 32, PropModeReplace,
107
- (guchar *)&data, 4);
108
+ XChangeProperty (dpy,
109
+ GDK_WINDOW_XID (gdk_window),
110
+ gdk_x11_get_xatom_by_name_for_display (
111
+ gdk_drawable_get_display (gdk_window),
112
+ "_NET_WM_ICON_GEOMETRY"),
113
+ XA_CARDINAL, 32, PropModeReplace,
114
+ (guchar *)&data, 4);
117
gtk_window_set_skip_taskbar_hint (window, TRUE);
118
- gtk_window_iconify (window);
119
+ // If the status icon isn't present then the WM will probably choose to
120
+ // iconfy to the taskbar, which doesn't look as good as the taskbar
121
+ // entry has just been removed. Just hide instead.
122
+ if (gtk_status_icon_get_visible (status_icon)) {
123
+ gtk_window_iconify (window);
125
+ gtk_widget_hide (GTK_WIDGET(window));
129
/* Takes care of moving the window to the current workspace. */
130
Index: empathy-2.34.0/libempathy/empathy-gsettings.h
131
===================================================================
132
--- empathy-2.34.0.orig/libempathy/empathy-gsettings.h 2011-03-24 11:15:16.000000000 -0400
133
+++ empathy-2.34.0/libempathy/empathy-gsettings.h 2011-03-24 12:46:24.808547063 -0400
135
#define EMPATHY_PREFS_UI_SHOW_AVATARS "show-avatars"
136
#define EMPATHY_PREFS_UI_SHOW_PROTOCOLS "show-protocols"
137
#define EMPATHY_PREFS_UI_COMPACT_CONTACT_LIST "compact-contact-list"
138
+#define EMPATHY_PREFS_UI_USE_LIBINDICATE "use-libindicate"
139
#define EMPATHY_PREFS_UI_CHAT_WINDOW_PANED_POS "chat-window-paned-pos"
140
#define EMPATHY_PREFS_UI_SHOW_OFFLINE "show-offline"
142
Index: empathy-2.34.0/po/POTFILES.in
143
===================================================================
144
--- empathy-2.34.0.orig/po/POTFILES.in 2011-03-24 11:38:49.000000000 -0400
145
+++ empathy-2.34.0/po/POTFILES.in 2011-03-24 12:46:24.808547063 -0400
147
[type: gettext/glade]src/empathy-ft-manager.ui
148
src/empathy-import-dialog.c
149
src/empathy-import-widget.c
150
+src/empathy-indicator.c
151
+src/empathy-indicator-manager.c
152
[type: gettext/glade]src/empathy-import-dialog.ui
153
src/empathy-import-widget.c
154
src/empathy-main-window.c
155
Index: empathy-2.34.0/src/Makefile.am
156
===================================================================
157
--- empathy-2.34.0.orig/src/Makefile.am 2011-03-24 11:15:16.000000000 -0400
158
+++ empathy-2.34.0/src/Makefile.am 2011-03-24 12:46:24.808547063 -0400
162
-DG_LOG_DOMAIN=\"empathy\" \
163
+ -DDESKTOPDIR=\"$(datadir)/applications\" \
164
-DBIN_DIR=\"$(bindir)\" \
165
$(DISABLE_DEPRECATED) \
170
$(LIBNOTIFY_CFLAGS) \
171
+ $(INDICATE_CFLAGS) \
173
$(LIBCHAMPLAIN_CFLAGS) \
176
$(top_builddir)/libempathy/libempathy.la \
177
$(top_builddir)/extensions/libemp-extensions.la \
188
$(LIBCHAMPLAIN_LIBS) \
196
+empathy_handwritten_source += \
197
+ empathy-indicator-manager.c \
198
+ empathy-indicator-manager.h \
199
+ empathy-indicator.c empathy-indicator.h
202
+ empathy-indicator-manager.c \
203
+ empathy-indicator-manager.h \
204
+ empathy-indicator.c empathy-indicator.h
208
empathy_handwritten_source += \
210
Index: empathy-2.34.0/src/empathy-chat-window.c
211
===================================================================
212
--- empathy-2.34.0.orig/src/empathy-chat-window.c 2011-03-24 12:46:07.198547066 -0400
213
+++ empathy-2.34.0/src/empathy-chat-window.c 2011-03-24 12:46:24.808547063 -0400
215
#include "empathy-about-dialog.h"
216
#include "empathy-invite-participant-dialog.h"
218
+#ifdef HAVE_LIBINDICATE
219
+#include "empathy-indicator.h"
220
+#include "empathy-indicator-manager.h"
223
#define DEBUG_FLAG EMPATHY_DEBUG_CHAT
224
#include <libempathy/empathy-debug.h>
229
NotifyNotification *notification;
231
+#ifdef HAVE_LIBINDICATE
232
+ EmpathyIndicatorManager *indicator_manager;
233
+ /* EmpathyChat -> EmpathyIndicator for that chat, if any */
234
+ GHashTable *indicators;
236
GtkTargetList *contact_targets;
237
GtkTargetList *file_targets;
239
@@ -1278,6 +1287,72 @@
243
+#ifdef HAVE_LIBINDICATE
245
+chat_window_indicator_activate_cb (EmpathyIndicator *indicator, guint timestamp,
248
+ empathy_chat_window_present_chat (chat, timestamp);
249
+ empathy_indicator_hide (indicator);
253
+chat_window_add_indicator (EmpathyChatWindow *window,
254
+ EmpathyMessage *message,
257
+ EmpathyChatWindowPriv *priv = GET_PRIV (window);
258
+ EmpathyContact *sender;
260
+ gboolean use_libindicate;
261
+ EmpathyIndicator *indicator = NULL;
262
+ GSettings *gsettings;
264
+ gsettings = g_settings_new (EMPATHY_PREFS_UI_SCHEMA);
265
+ use_libindicate = g_settings_get_boolean (gsettings, EMPATHY_PREFS_UI_USE_LIBINDICATE);
266
+ g_object_unref (gsettings);
268
+ if (!use_libindicate) {
272
+ sender = empathy_message_get_sender (message);
273
+ body = empathy_message_get_body (message);
275
+ indicator = g_hash_table_lookup (priv->indicators, chat);
276
+ if (indicator != NULL) {
277
+ DEBUG ("indicator exists");
278
+ empathy_indicator_update (indicator, body);
280
+ DEBUG ("indicator doesn't exist yet, creating a new indicator");
281
+ indicator = empathy_indicator_manager_create_indicator (priv->indicator_manager,
283
+ g_signal_connect (indicator, "activate",
284
+ G_CALLBACK (chat_window_indicator_activate_cb), chat);
286
+ g_hash_table_insert (priv->indicators, chat, indicator);
288
+ empathy_indicator_show (indicator);
292
+chat_window_remove_indicator (EmpathyChatWindow *window, EmpathyChat *chat)
294
+ EmpathyIndicator *indicator = NULL;
295
+ EmpathyChatWindowPriv *priv = GET_PRIV (window);
297
+ indicator = g_hash_table_lookup (priv->indicators, chat);
299
+ if ((indicator) && (indicator != NULL)) {
300
+ DEBUG ("indicator is %p", indicator);
301
+ empathy_indicator_hide (indicator);
302
+ g_hash_table_remove (priv->indicators, chat);
304
+ DEBUG ("indicator is NULL, nothing to remove");
310
chat_window_show_or_update_notification (EmpathyChatWindow *window,
311
EmpathyMessage *message,
312
@@ -1454,6 +1529,9 @@
314
empathy_sound_play (GTK_WIDGET (priv->dialog),
315
EMPATHY_SOUND_MESSAGE_INCOMING);
316
+#ifdef HAVE_LIBINDICATE
317
+ chat_window_add_indicator (window, message, chat);
320
/* Pending messages have already been displayed in the approver, so we don't
321
* display a notification for those. */
322
@@ -1526,6 +1604,10 @@
323
empathy_chat_messages_read (chat);
325
chat_window_update_chat_tab (chat);
327
+#ifdef HAVE_LIBINDICATE
328
+ chat_window_remove_indicator (window, chat);
333
@@ -1642,6 +1724,11 @@
334
/* Update the title, since we now mark all unread messages as read. */
335
chat_window_update_chat_tab_full (priv->current_chat, FALSE);
337
+#ifdef HAVE_LIBINDICATE
338
+ /* Remove the indicator for the active chat */
339
+ chat_window_remove_indicator (window, priv->current_chat);
345
@@ -1986,6 +2073,11 @@
346
g_object_unref (gui);
348
priv->chatroom_manager = empathy_chatroom_manager_dup_singleton (NULL);
349
+#ifdef HAVE_LIBINDICATE
350
+ priv->indicator_manager = empathy_indicator_manager_dup_singleton ();
351
+ priv->indicators = g_hash_table_new_full (g_direct_hash, g_direct_equal,
352
+ NULL, g_object_unref);
355
priv->notebook = gtk_notebook_new ();
356
gtk_notebook_set_group (GTK_NOTEBOOK (priv->notebook), "EmpathyChatWindow");
357
Index: empathy-2.34.0/src/empathy-indicator-manager.c
358
===================================================================
359
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
360
+++ empathy-2.34.0/src/empathy-indicator-manager.c 2011-03-24 12:46:24.808547063 -0400
362
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
364
+ * Copyright (C) 2009 Canonical Ltd.
366
+ * This program is free software; you can redistribute it and/or
367
+ * modify it under the terms of the GNU General Public License as
368
+ * published by the Free Software Foundation; either version 2 of the
369
+ * License, or (at your option) any later version.
371
+ * This program is distributed in the hope that it will be useful,
372
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
373
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
374
+ * General Public License for more details.
376
+ * You should have received a copy of the GNU General Public
377
+ * License along with this program; if not, write to the
378
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
379
+ * Boston, MA 02110-1301 USA
381
+ * Authors: James Westby <james.westby@ubuntu.com>
387
+#include <gtk/gtk.h>
389
+#include <libempathy/empathy-contact.h>
390
+#include <libempathy/empathy-dispatcher.h>
391
+#include <libempathy/empathy-utils.h>
393
+#include <libempathy-gtk/empathy-ui-utils.h>
394
+#include <libempathy-gtk/empathy-notify-manager.h>
396
+#include <telepathy-glib/util.h>
398
+#include "empathy-event-manager.h"
399
+#include "empathy-indicator.h"
400
+#include "empathy-indicator-manager.h"
402
+#include <libindicate/server.h>
403
+#include <libindicate/indicator.h>
405
+#define DEBUG_FLAG EMPATHY_DEBUG_OTHER
406
+#include <libempathy/empathy-debug.h>
408
+#define INDICATOR_LOGIN_TIMEOUT 15
409
+#define EMPATHY_DESKTOP_PATH DESKTOPDIR "/empathy.desktop"
411
+#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyIndicatorManager)
418
+static guint signals[LAST_SIGNAL];
421
+ EmpathyEventManager *event_manager;
422
+ IndicateServer *indicate_server;
423
+ GSList *indicator_events;
424
+ GHashTable *login_timeouts;
425
+} EmpathyIndicatorManagerPriv;
428
+ EmpathyIndicator *indicator;
429
+ EmpathyEvent *event;
433
+ EmpathyIndicatorManager *manager;
434
+ EmpathyIndicator *indicator;
437
+G_DEFINE_TYPE (EmpathyIndicatorManager, empathy_indicator_manager, G_TYPE_OBJECT);
439
+static EmpathyIndicatorManager *manager_singleton = NULL;
441
+static EmpathyEvent *
442
+event_copy (EmpathyEvent *event)
444
+ EmpathyEvent *ret = g_new0 (EmpathyEvent, 1);
446
+ ret->contact = g_object_ref (event->contact);
447
+ ret->icon_name = g_strdup (event->icon_name);
448
+ ret->header = g_strdup (event->header);
449
+ ret->message = g_strdup (event->message);
450
+ ret->must_ack = event->must_ack;
456
+compare_events (EmpathyEvent *ev1, EmpathyEvent *ev2)
458
+ return ((g_strcmp0 (ev1->icon_name, ev2->icon_name) == 0) &&
459
+ (g_strcmp0 (ev1->header, ev2->header) == 0) &&
460
+ (ev1->must_ack == ev2->must_ack) &&
461
+ (ev1->contact == ev2->contact));
464
+static IndicatorEvent *
465
+indicator_event_new (EmpathyIndicator *indicator,
466
+ EmpathyEvent *event)
468
+ IndicatorEvent *indicator_event;
470
+ indicator_event = g_slice_new0 (IndicatorEvent);
471
+ indicator_event->indicator = g_object_ref (indicator);
472
+ indicator_event->event = event_copy (event);
474
+ return indicator_event;
479
+indicator_event_free (IndicatorEvent *indicator_event)
481
+ g_object_unref (indicator_event->indicator);
482
+ g_free (indicator_event);
487
+indicate_server_activate (IndicateServer *server, guint timestamp,
488
+ EmpathyIndicatorManager *manager)
490
+ g_signal_emit (manager, signals[SERVER_ACTIVATE], 0, timestamp);
495
+indicate_show_cb (EmpathyIndicator *indicator, guint timestamp,
496
+ EmpathyEvent *event)
498
+ empathy_event_activate (event);
503
+indicator_manager_event_added_cb (EmpathyEventManager *event_manager,
504
+ EmpathyEvent *event,
505
+ EmpathyIndicatorManager *manager)
507
+ EmpathyIndicator *indicator = NULL;
508
+ EmpathyIndicatorManagerPriv *priv;
509
+ IndicatorEvent *indicator_event;
511
+ priv = GET_PRIV (manager);
513
+ DEBUG ("Event added");
515
+ if (event->contact == NULL)
518
+ indicator = empathy_indicator_new (event->contact, event->message, "im");
519
+ if (indicator == NULL) {
523
+ empathy_indicator_show (indicator);
524
+ g_signal_connect (G_OBJECT(indicator), "activate",
525
+ G_CALLBACK (indicate_show_cb),
527
+ indicator_event = indicator_event_new (indicator, event);
528
+ g_object_unref (indicator);
529
+ priv->indicator_events = g_slist_prepend (priv->indicator_events,
534
+indicator_manager_event_removed_cb (EmpathyEventManager *event_manager,
535
+ EmpathyEvent *event,
536
+ EmpathyIndicatorManager *manager)
538
+ EmpathyIndicatorManagerPriv *priv;
541
+ priv = GET_PRIV (manager);
543
+ DEBUG ("Event removed");
545
+ for (l = priv->indicator_events; l; l = l->next)
547
+ IndicatorEvent *indicator_event;
548
+ indicator_event = l->data;
550
+ if (compare_events (indicator_event->event, event)) {
551
+ priv->indicator_events = g_slist_remove (priv->indicator_events,
553
+ empathy_indicator_hide (indicator_event->indicator);
561
+indicator_manager_event_updated_cb (EmpathyEventManager *event_manager,
562
+ EmpathyEvent *event,
563
+ EmpathyIndicatorManager *manager)
565
+ EmpathyIndicatorManagerPriv *priv;
568
+ priv = GET_PRIV (manager);
570
+ for (l = priv->indicator_events; l; l = l->next)
572
+ IndicatorEvent *indicator_event;
573
+ indicator_event = l->data;
574
+ if (compare_events (indicator_event->event, event)) {
575
+ empathy_indicator_update (indicator_event->indicator,
583
+/* Remove the login indicator when it times out */
585
+indicate_login_timeout (gpointer data)
587
+ LoginData *login_data;
588
+ EmpathyIndicator *e_indicator;
589
+ EmpathyIndicatorManager *manager;
590
+ EmpathyIndicatorManagerPriv *priv;
592
+ login_data = (LoginData *) data;
593
+ e_indicator = login_data->indicator;
594
+ manager = login_data->manager;
595
+ priv = GET_PRIV (manager);
597
+ empathy_indicator_hide (e_indicator);
598
+ g_hash_table_remove (priv->login_timeouts, e_indicator);
605
+indicate_login_cb (EmpathyIndicator *e_indicator, guint timestamp,
606
+ EmpathyIndicatorManager *manager)
608
+ EmpathyIndicatorManagerPriv *priv;
609
+ GSList *events, *l;
610
+ EmpathyContact *contact;
612
+ priv = GET_PRIV (manager);
614
+ empathy_indicator_hide (e_indicator);
615
+ g_hash_table_remove (priv->login_timeouts, e_indicator);
617
+ contact = empathy_indicator_get_contact (e_indicator);
618
+ /* If the contact has an event activate it, otherwise the
619
+ * default handler of row-activated will be called. */
620
+ events = empathy_event_manager_get_events (priv->event_manager);
621
+ for (l = events; l; l = l->next) {
622
+ EmpathyEvent *event;
625
+ if (event->contact == contact) {
626
+ empathy_event_activate (event);
631
+ /* Else start a new conversation */
632
+ empathy_dispatcher_chat_with_contact (contact, timestamp);
636
+EmpathyIndicatorManager *
637
+empathy_indicator_manager_dup_singleton (void)
639
+ return g_object_new (EMPATHY_TYPE_INDICATOR_MANAGER, NULL);
644
+indicator_manager_dispose (GObject *object)
646
+ EmpathyIndicatorManagerPriv *priv;
648
+ priv = GET_PRIV (object);
650
+ if (priv->indicator_events) {
651
+ g_slist_foreach (priv->indicator_events, (GFunc) indicator_event_free,
653
+ g_slist_free (priv->indicator_events);
654
+ priv->indicator_events = NULL;
656
+ if (priv->event_manager) {
657
+ g_object_unref (priv->event_manager);
658
+ priv->event_manager = NULL;
660
+ if (priv->indicate_server) {
661
+ g_object_unref (priv->indicate_server);
662
+ priv->indicate_server = NULL;
664
+ if (priv->login_timeouts) {
665
+ g_hash_table_unref (priv->login_timeouts);
666
+ priv->login_timeouts = NULL;
669
+ G_OBJECT_CLASS (empathy_indicator_manager_parent_class)->dispose (object);
674
+indicator_manager_constructor (GType type,
676
+ GObjectConstructParam *props)
680
+ if (manager_singleton != NULL) {
681
+ retval = g_object_ref (manager_singleton);
683
+ retval = G_OBJECT_CLASS (empathy_indicator_manager_parent_class)->constructor
684
+ (type, n_props, props);
686
+ manager_singleton = EMPATHY_INDICATOR_MANAGER (retval);
687
+ g_object_add_weak_pointer (retval, (gpointer) &manager_singleton);
695
+empathy_indicator_manager_class_init (EmpathyIndicatorManagerClass *klass)
697
+ GObjectClass *object_class;
699
+ object_class = G_OBJECT_CLASS (klass);
700
+ object_class->dispose = indicator_manager_dispose;
701
+ object_class->constructor = indicator_manager_constructor;
703
+ signals[SERVER_ACTIVATE] =
704
+ g_signal_new ("server-activate",
705
+ G_TYPE_FROM_CLASS (klass),
709
+ g_cclosure_marshal_VOID__UINT,
710
+ G_TYPE_NONE, 1, G_TYPE_UINT);
712
+ g_type_class_add_private (object_class, sizeof (EmpathyIndicatorManagerPriv));
717
+empathy_indicator_manager_init (EmpathyIndicatorManager *manager)
719
+ EmpathyIndicatorManagerPriv *priv;
721
+ priv = G_TYPE_INSTANCE_GET_PRIVATE (manager,
722
+ EMPATHY_TYPE_INDICATOR_MANAGER, EmpathyIndicatorManagerPriv);
723
+ manager->priv = priv;
725
+ priv->event_manager = empathy_event_manager_dup_singleton ();
726
+ priv->login_timeouts = g_hash_table_new_full (NULL, NULL,
727
+ (GDestroyNotify) g_object_unref, (GDestroyNotify) g_source_unref);
728
+ priv->indicate_server = indicate_server_ref_default ();
729
+ indicate_server_set_type (priv->indicate_server, "message.instant");
730
+ indicate_server_set_desktop_file (priv->indicate_server,
731
+ EMPATHY_DESKTOP_PATH);
733
+ g_signal_connect (priv->indicate_server,
734
+ INDICATE_SERVER_SIGNAL_SERVER_DISPLAY,
735
+ G_CALLBACK (indicate_server_activate),
738
+ g_signal_connect (priv->event_manager, "event-added",
739
+ G_CALLBACK (indicator_manager_event_added_cb),
741
+ g_signal_connect (priv->event_manager, "event-removed",
742
+ G_CALLBACK (indicator_manager_event_removed_cb),
744
+ g_signal_connect (priv->event_manager, "event-updated",
745
+ G_CALLBACK (indicator_manager_event_updated_cb),
750
+empathy_indicator_manager_set_server_visible (EmpathyIndicatorManager *manager,
753
+ EmpathyIndicatorManagerPriv *priv;
755
+ priv = GET_PRIV (manager);
757
+ DEBUG ("Show indicator");
758
+ indicate_server_show (priv->indicate_server);
760
+ DEBUG ("Hide indicator");
761
+ indicate_server_hide (priv->indicate_server);
767
+empathy_indicator_manager_create_indicator (EmpathyIndicatorManager *manager,
768
+ EmpathyContact *sender,
771
+ return empathy_indicator_new (sender, body, "im");
776
+login_data_new (EmpathyIndicator *e_indicator,
777
+ EmpathyIndicatorManager *manager)
779
+ LoginData *login_data;
781
+ login_data = g_slice_new0 (LoginData);
782
+ login_data->manager = g_object_ref (manager);
783
+ login_data->indicator = g_object_ref (e_indicator);
790
+indicator_destroy_login_data (gpointer data)
792
+ LoginData *login_data;
794
+ login_data = (LoginData *)data;
796
+ g_object_unref (login_data->manager);
797
+ g_object_unref (login_data->indicator);
798
+ g_slice_free (LoginData, login_data);
802
+/* Add an indicator for someone logging in. This will be displayed for
803
+ * a short period only.
806
+empathy_indicator_manager_add_login_indicator (EmpathyIndicatorManager *manager,
807
+ EmpathyContact *contact)
809
+ EmpathyIndicatorManagerPriv *priv;
811
+ EmpathyIndicator *e_indicator;
812
+ LoginData *login_data;
814
+ priv = GET_PRIV (manager);
815
+ e_indicator = empathy_indicator_new (contact, NULL, "login");
816
+ login_data = login_data_new (e_indicator, manager);
818
+ timeout = g_timeout_source_new_seconds (INDICATOR_LOGIN_TIMEOUT);
819
+ g_source_set_callback (timeout, indicate_login_timeout, login_data,
820
+ indicator_destroy_login_data);
821
+ g_source_attach (timeout, NULL);
823
+ g_hash_table_insert (priv->login_timeouts, e_indicator, timeout);
825
+ g_signal_connect (e_indicator, "activate",
826
+ G_CALLBACK (indicate_login_cb), manager);
827
+ empathy_indicator_show (e_indicator);
829
Index: empathy-2.34.0/src/empathy-indicator-manager.h
830
===================================================================
831
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
832
+++ empathy-2.34.0/src/empathy-indicator-manager.h 2011-03-24 12:46:24.808547063 -0400
834
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
836
+ * Copyright (C) 2009 Canonical Ltd.
838
+ * This program is free software; you can redistribute it and/or
839
+ * modify it under the terms of the GNU General Public License as
840
+ * published by the Free Software Foundation; either version 2 of the
841
+ * License, or (at your option) any later version.
843
+ * This program is distributed in the hope that it will be useful,
844
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
845
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
846
+ * General Public License for more details.
848
+ * You should have received a copy of the GNU General Public
849
+ * License along with this program; if not, write to the
850
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
851
+ * Boston, MA 02110-1301 USA
853
+ * Authors: James Westby <james.westby@ubuntu.com>
857
+#ifndef __EMPATHY_INDICATOR_MANAGER_H__
858
+#define __EMPATHY_INDICATOR_MANAGER_H__
862
+#include <libempathy/empathy-contact.h>
863
+#include "empathy-indicator.h"
867
+#define EMPATHY_TYPE_INDICATOR_MANAGER \
868
+ (empathy_indicator_manager_get_type ())
869
+#define EMPATHY_INDICATOR_MANAGER(o) \
870
+ (G_TYPE_CHECK_INSTANCE_CAST ((o), EMPATHY_TYPE_INDICATOR_MANAGER, \
871
+ EmpathyIndicatorManager))
872
+#define EMPATHY_INDICATOR_MANAGER_CLASS(k) \
873
+ (G_TYPE_CHECK_CLASS_CAST((k), EMPATHY_TYPE_INDICATOR_MANAGER, \
874
+ EmpathyIndicatorManagerClass))
875
+#define EMPATHY_IS_INDICATOR_MANAGER(o) \
876
+ (G_TYPE_CHECK_INSTANCE_TYPE ((o), EMPATHY_TYPE_INDICATOR_MANAGER))
877
+#define EMPATHY_IS_INDICATOR_MANAGER_CLASS(k) \
878
+ (G_TYPE_CHECK_CLASS_TYPE ((k), EMPATHY_TYPE_INDICATOR_MANAGER))
879
+#define EMPATHY_INDICATOR_MANAGER_GET_CLASS(o) \
880
+ (G_TYPE_INSTANCE_GET_CLASS ((o), EMPATHY_TYPE_INDICATOR_MANAGER, \
881
+ EmpathyIndicatorManagerClass))
883
+typedef struct _EmpathyIndicatorManager EmpathyIndicatorManager;
884
+typedef struct _EmpathyIndicatorManagerClass EmpathyIndicatorManagerClass;
886
+struct _EmpathyIndicatorManager {
891
+struct _EmpathyIndicatorManagerClass {
892
+ GObjectClass parent_class;
895
+GType empathy_indicator_manager_get_type (void) G_GNUC_CONST;
896
+EmpathyIndicatorManager *empathy_indicator_manager_dup_singleton (void);
897
+void empathy_indicator_manager_set_server_visible (
898
+ EmpathyIndicatorManager *manager,
900
+EmpathyIndicator *empathy_indicator_manager_create_indicator (
901
+ EmpathyIndicatorManager *manager,
902
+ EmpathyContact *sender,
903
+ const gchar *body);
904
+void empathy_indicator_manager_add_login_indicator (
905
+ EmpathyIndicatorManager *manager,
906
+ EmpathyContact *contact);
910
+#endif /* __EMPATHY_INDICATOR_MANAGER_H__ */
911
Index: empathy-2.34.0/src/empathy-indicator.c
912
===================================================================
913
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
914
+++ empathy-2.34.0/src/empathy-indicator.c 2011-03-24 12:46:24.808547063 -0400
916
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
918
+ * Copyright (C) 2009 Canonical Ltd.
920
+ * This program is free software; you can redistribute it and/or
921
+ * modify it under the terms of the GNU General Public License as
922
+ * published by the Free Software Foundation; either version 2 of the
923
+ * License, or (at your option) any later version.
925
+ * This program is distributed in the hope that it will be useful,
926
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
927
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
928
+ * General Public License for more details.
930
+ * You should have received a copy of the GNU General Public
931
+ * License along with this program; if not, write to the
932
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
933
+ * Boston, MA 02110-1301 USA
935
+ * Authors: James Westby <james.westby@ubuntu.com>
939
+#include <gtk/gtk.h>
941
+#include <libempathy/empathy-contact.h>
942
+#include <libempathy/empathy-utils.h>
944
+#include <libempathy-gtk/empathy-ui-utils.h>
945
+#include <libempathy-gtk/empathy-notify-manager.h>
947
+#include "empathy-indicator.h"
949
+#include <libindicate/indicator.h>
950
+#include <libindicate-gtk/indicator.h>
952
+#define DEBUG_FLAG EMPATHY_DEBUG_OTHER
953
+#include <libempathy/empathy-debug.h>
955
+#define GET_PRIV(obj) EMPATHY_GET_PRIV ((obj), EmpathyIndicator)
970
+static guint signals[LAST_SIGNAL];
973
+ IndicateIndicator *indicator;
974
+ EmpathyContact *contact;
977
+} EmpathyIndicatorPriv;
979
+G_DEFINE_TYPE (EmpathyIndicator, empathy_indicator, G_TYPE_OBJECT)
983
+empathy_indicator_dispose (GObject *object)
985
+ EmpathyIndicatorPriv *priv;
987
+ priv = GET_PRIV (object);
989
+ if (priv->indicator) {
990
+ g_object_unref (priv->indicator);
991
+ priv->indicator = NULL;
993
+ if (priv->contact) {
994
+ g_object_unref (priv->contact);
995
+ priv->contact = NULL;
998
+ G_OBJECT_CLASS (empathy_indicator_parent_class)->dispose (object);
1003
+empathy_indicator_finalize (GObject *object)
1005
+ EmpathyIndicatorPriv *priv;
1007
+ priv = GET_PRIV (object);
1009
+ g_free (priv->body);
1010
+ g_free (priv->subtype);
1012
+ G_OBJECT_CLASS (empathy_indicator_parent_class)->finalize (object);
1016
+indicate_show_cb (IndicateIndicator *indicator, guint timestamp,
1017
+ EmpathyIndicator *e_indicator)
1019
+ g_signal_emit (e_indicator, signals[ACTIVATE], 0, timestamp);
1023
+static IndicateIndicator *
1024
+empathy_indicator_get_indicator (EmpathyIndicator *e_indicator)
1026
+ EmpathyIndicatorPriv *priv;
1028
+ priv = GET_PRIV (e_indicator);
1029
+ if (priv->indicator)
1030
+ return priv->indicator;
1032
+ priv->indicator = indicate_indicator_new ();
1033
+ g_assert (priv->indicator);
1034
+ g_signal_connect (G_OBJECT (priv->indicator),
1035
+ INDICATE_INDICATOR_SIGNAL_DISPLAY,
1036
+ G_CALLBACK (indicate_show_cb),
1039
+ return priv->indicator;
1044
+empathy_indicator_set_property (GObject *object,
1046
+ const GValue *value,
1047
+ GParamSpec *pspec)
1049
+ EmpathyIndicator *e_indicator;
1050
+ EmpathyIndicatorPriv *priv;
1051
+ IndicateIndicator *indicator;
1053
+ GdkPixbuf *pixbuf_avatar = NULL;
1055
+ e_indicator = EMPATHY_INDICATOR (object);
1056
+ priv = GET_PRIV (e_indicator);
1058
+ indicator = empathy_indicator_get_indicator (e_indicator);
1060
+ switch (param_id) {
1061
+ case PROP_CONTACT:
1062
+ priv->contact = g_object_ref (g_value_get_object (value));
1063
+ g_assert (priv->contact);
1064
+ indicate_indicator_set_property (indicator, "sender",
1065
+ empathy_contact_get_alias (priv->contact));
1066
+ /* get the scaled avatar (22,22) until LP bug #433143 is fixed then switch to
1067
+ to letting indicate-messages handle the scaling by setting the size to 0, 0 */
1068
+ pixbuf_avatar = empathy_pixbuf_avatar_from_contact_scaled (priv->contact, 22, 22);
1069
+ if (pixbuf_avatar != NULL)
1071
+ indicate_indicator_set_property_icon(indicator, "icon", pixbuf_avatar);
1072
+ g_object_unref(G_OBJECT(pixbuf_avatar));
1077
+ g_free (priv->body);
1078
+ priv->body = g_strdup (g_value_get_string (value));
1079
+ indicate_indicator_set_property (indicator, "body", priv->body);
1080
+ if (priv->body != NULL) {
1081
+ g_get_current_time (&time);
1082
+ indicate_indicator_set_property_time (indicator, "time", &time);
1085
+ case PROP_SUBTYPE:
1086
+ if (priv->subtype)
1087
+ g_free (priv->subtype);
1088
+ priv->subtype = g_strdup (g_value_get_string (value));
1089
+ indicate_indicator_set_property (indicator, "subtype", priv->subtype);
1090
+ if (g_strcmp0 (priv->subtype, "login") != 0 ) {
1091
+ indicate_indicator_set_property (indicator, "draw-attention", "true");
1094
+ case PROP_VISIBLE:
1095
+ if (g_value_get_boolean (value))
1096
+ indicate_indicator_show (indicator);
1098
+ indicate_indicator_hide (indicator);
1101
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
1108
+empathy_indicator_get_property (GObject *object,
1111
+ GParamSpec *pspec)
1113
+ EmpathyIndicator *e_indicator;
1114
+ EmpathyIndicatorPriv *priv;
1116
+ e_indicator = EMPATHY_INDICATOR (object);
1117
+ priv = GET_PRIV (e_indicator);
1119
+ switch (param_id) {
1120
+ case PROP_CONTACT:
1121
+ g_value_set_object (value, priv->contact);
1124
+ g_value_set_string (value, priv->body);
1126
+ case PROP_SUBTYPE:
1127
+ g_value_set_string (value, priv->subtype);
1129
+ case PROP_VISIBLE:
1130
+ g_value_set_boolean (value, indicate_indicator_is_visible (priv->indicator));
1133
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
1140
+empathy_indicator_class_init (EmpathyIndicatorClass *klass)
1142
+ GObjectClass *object_class;
1144
+ object_class = G_OBJECT_CLASS (klass);
1146
+ object_class->set_property = empathy_indicator_set_property;
1147
+ object_class->get_property = empathy_indicator_get_property;
1148
+ object_class->dispose = empathy_indicator_dispose;
1149
+ object_class->finalize = empathy_indicator_finalize;
1151
+ g_object_class_install_property (object_class, PROP_CONTACT,
1152
+ g_param_spec_object ("contact",
1154
+ "The contact being indicated",
1155
+ EMPATHY_TYPE_CONTACT,
1156
+ (G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)));
1157
+ g_object_class_install_property (object_class, PROP_BODY,
1158
+ g_param_spec_string ("body",
1160
+ "The text for this contact",
1162
+ (G_PARAM_READWRITE | G_PARAM_CONSTRUCT)));
1163
+ g_object_class_install_property (object_class, PROP_SUBTYPE,
1164
+ g_param_spec_string ("subtype",
1166
+ "The type of this indicator",
1168
+ (G_PARAM_READWRITE | G_PARAM_CONSTRUCT)));
1169
+ g_object_class_install_property (object_class, PROP_VISIBLE,
1170
+ g_param_spec_boolean ("visible",
1172
+ "The visibility of this indicator",
1174
+ G_PARAM_READWRITE));
1176
+ signals[ACTIVATE] =
1177
+ g_signal_new ("activate",
1178
+ G_TYPE_FROM_CLASS (klass),
1179
+ G_SIGNAL_RUN_LAST,
1182
+ g_cclosure_marshal_VOID__UINT,
1183
+ G_TYPE_NONE, 1, G_TYPE_UINT);
1185
+ g_type_class_add_private (object_class, sizeof (EmpathyIndicatorPriv));
1190
+empathy_indicator_init (EmpathyIndicator *e_indicator)
1192
+ e_indicator->priv = G_TYPE_INSTANCE_GET_PRIVATE (e_indicator,
1193
+ EMPATHY_TYPE_INDICATOR,
1194
+ EmpathyIndicatorPriv);
1199
+empathy_indicator_new (EmpathyContact *sender,
1200
+ const gchar *body,
1201
+ const gchar *subtype)
1203
+ DEBUG ("Creating a new indicator");
1204
+ return g_object_new (EMPATHY_TYPE_INDICATOR, "contact", sender, "body", body,
1205
+ "subtype", subtype, NULL);
1210
+empathy_indicator_show (EmpathyIndicator *e_indicator)
1212
+ DEBUG ("Showing indicator %p", e_indicator);
1213
+ g_object_set (e_indicator, "visible", TRUE, NULL);
1218
+empathy_indicator_hide (EmpathyIndicator *e_indicator)
1220
+ DEBUG ("Hiding indicator %p", e_indicator);
1221
+ g_object_set (e_indicator, "visible", FALSE, NULL);
1226
+empathy_indicator_update (EmpathyIndicator *e_indicator,
1227
+ const gchar *body)
1229
+ DEBUG ("Updating existing indicator %p", e_indicator);
1230
+ g_object_set (e_indicator, "body", body, NULL);
1235
+empathy_indicator_get_contact (EmpathyIndicator *e_indicator)
1237
+ EmpathyContact *contact;
1238
+ g_object_get (e_indicator, "contact", &contact, NULL);
1241
Index: empathy-2.34.0/src/empathy-indicator.h
1242
===================================================================
1243
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1244
+++ empathy-2.34.0/src/empathy-indicator.h 2011-03-24 12:46:24.808547063 -0400
1246
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
1248
+ * Copyright (C) 2009 Canonical Ltd.
1250
+ * This program is free software; you can redistribute it and/or
1251
+ * modify it under the terms of the GNU General Public License as
1252
+ * published by the Free Software Foundation; either version 2 of the
1253
+ * License, or (at your option) any later version.
1255
+ * This program is distributed in the hope that it will be useful,
1256
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1257
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1258
+ * General Public License for more details.
1260
+ * You should have received a copy of the GNU General Public
1261
+ * License along with this program; if not, write to the
1262
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
1263
+ * Boston, MA 02110-1301 USA
1265
+ * Authors: James Westby <james.westby@ubuntu.com>
1269
+#ifndef __EMPATHY_INDICATOR_H__
1270
+#define __EMPATHY_INDICATOR_H__
1274
+#include <libempathy/empathy-contact.h>
1278
+#define EMPATHY_TYPE_INDICATOR (empathy_indicator_get_type ())
1279
+#define EMPATHY_INDICATOR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EMPATHY_TYPE_INDICATOR, EmpathyIndicator))
1280
+#define EMPATHY_INDICATOR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), EMPATHY_TYPE_INDICATOR, EmpathyIndicatorClass))
1281
+#define EMPATHY_IS_INDICATOR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EMPATHY_TYPE_INDICATOR))
1282
+#define EMPATHY_IS_INDICATOR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EMPATHY_TYPE_INDICATOR))
1283
+#define EMPATHY_INDICATOR_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EMPATHY_TYPE_INDICATOR, EmpathyIndicatorClass))
1285
+typedef struct _EmpathyIndicator EmpathyIndicator;
1286
+typedef struct _EmpathyIndicatorClass EmpathyIndicatorClass;
1288
+struct _EmpathyIndicator {
1293
+struct _EmpathyIndicatorClass {
1294
+ GObjectClass parent_class;
1297
+GType empathy_indicator_get_type (void) G_GNUC_CONST;
1298
+EmpathyIndicator *empathy_indicator_new (EmpathyContact *sender,
1299
+ const gchar *body,
1300
+ const gchar *type);
1301
+void empathy_indicator_show (EmpathyIndicator *e_indicator);
1302
+void empathy_indicator_hide (EmpathyIndicator *e_indicator);
1303
+void empathy_indicator_update (EmpathyIndicator *e_indicator,
1304
+ const gchar *body);
1305
+EmpathyContact *empathy_indicator_get_contact (EmpathyIndicator *e_indicator);
1310
+#endif /* __EMPATHY-INDICATOR_H__ */
1311
Index: empathy-2.34.0/src/empathy-main-window.c
1312
===================================================================
1313
--- empathy-2.34.0.orig/src/empathy-main-window.c 2011-03-24 12:46:07.198547066 -0400
1314
+++ empathy-2.34.0/src/empathy-main-window.c 2011-03-24 12:46:24.808547063 -0400
1316
#include "empathy-ft-manager.h"
1317
#include "empathy-migrate-butterfly-logs.h"
1319
+#ifdef HAVE_LIBINDICATE
1320
+#include "empathy-indicator-manager.h"
1323
#define DEBUG_FLAG EMPATHY_DEBUG_OTHER
1324
#include <libempathy/empathy-debug.h>
1326
@@ -161,6 +165,10 @@
1328
/* Actions that are enabled when there are connected accounts */
1329
GList *actions_connected;
1330
+#ifdef HAVE_LIBINDICATE
1331
+ EmpathyIndicatorManager *indicator_manager;
1332
+ GHashTable *indicator_timeouts;
1335
/* The idle event source to migrate butterfly's logs */
1336
guint butterfly_log_migration_members_changed_id;
1337
@@ -433,11 +441,23 @@
1338
EmpathyEvent *event,
1339
EmpathyMainWindow *window)
1341
+ EmpathyMainWindowPriv *priv = GET_PRIV (window);
1343
if (event->contact) {
1344
main_window_flash_start (window);
1345
} else if (event->type == EMPATHY_EVENT_TYPE_AUTH) {
1346
main_window_auth_display (window, event);
1349
+ #ifdef HAVE_LIBINDICATE
1350
+ if (event->type == EMPATHY_EVENT_TYPE_PRESENCE &&
1351
+ tp_connection_presence_type_cmp_availability (empathy_contact_get_presence (event->contact),
1352
+ TP_CONNECTION_PRESENCE_TYPE_OFFLINE) > 0) {
1353
+ empathy_indicator_manager_add_login_indicator (priv->indicator_manager,
1361
@@ -1004,6 +1024,10 @@
1362
g_object_unref (priv->ui_manager);
1363
g_object_unref (priv->chatroom_manager);
1365
+#ifdef HAVE_LIBINDICATE
1366
+ g_object_unref (priv->indicator_manager);
1369
g_object_unref (priv->gsettings_ui);
1370
g_object_unref (priv->gsettings_contacts);
1372
@@ -2072,6 +2096,10 @@
1376
+#ifdef HAVE_LIBINDICATE
1377
+ priv->indicator_manager = empathy_indicator_manager_dup_singleton ();
1380
/* Show offline ? */
1381
show_offline = g_settings_get_boolean (priv->gsettings_ui,
1382
EMPATHY_PREFS_UI_SHOW_OFFLINE);
1383
Index: empathy-2.34.0/src/empathy-preferences.c
1384
===================================================================
1385
--- empathy-2.34.0.orig/src/empathy-preferences.c 2011-03-24 11:15:16.000000000 -0400
1386
+++ empathy-2.34.0/src/empathy-preferences.c 2011-03-24 12:46:24.818547063 -0400
1389
GtkWidget *checkbutton_show_smileys;
1390
GtkWidget *checkbutton_show_contacts_in_rooms;
1391
+ GtkWidget *checkbutton_use_libindicate;
1392
GtkWidget *combobox_chat_theme;
1393
GtkWidget *checkbutton_separate_chat_windows;
1394
GtkWidget *checkbutton_events_notif_area;
1395
@@ -235,6 +236,16 @@
1396
priv->checkbutton_show_smileys,
1398
G_SETTINGS_BIND_DEFAULT);
1399
+#ifdef HAVE_LIBINDICATE
1400
+ g_settings_bind (priv->gsettings_ui,
1401
+ EMPATHY_PREFS_UI_USE_LIBINDICATE,
1402
+ priv->checkbutton_use_libindicate,
1404
+ G_SETTINGS_BIND_DEFAULT);
1406
+ gtk_widget_hide (GTK_WIDGET (priv->checkbutton_use_libindicate));
1409
g_settings_bind (priv->gsettings_chat,
1410
EMPATHY_PREFS_CHAT_SHOW_CONTACTS_IN_ROOMS,
1411
priv->checkbutton_show_contacts_in_rooms,
1413
"notebook", &priv->notebook,
1414
"checkbutton_show_smileys", &priv->checkbutton_show_smileys,
1415
"checkbutton_show_contacts_in_rooms", &priv->checkbutton_show_contacts_in_rooms,
1416
+ "checkbutton_use_libindicate", &priv->checkbutton_use_libindicate,
1417
"combobox_chat_theme", &priv->combobox_chat_theme,
1418
"checkbutton_separate_chat_windows", &priv->checkbutton_separate_chat_windows,
1419
"checkbutton_events_notif_area", &priv->checkbutton_events_notif_area,
1420
Index: empathy-2.34.0/src/empathy-preferences.ui
1421
===================================================================
1422
--- empathy-2.34.0.orig/src/empathy-preferences.ui 2011-02-10 07:10:25.000000000 -0500
1423
+++ empathy-2.34.0/src/empathy-preferences.ui 2011-03-24 12:46:24.818547063 -0400
1424
@@ -266,6 +266,20 @@
1425
<property name="position">1</property>
1429
+ <object class="GtkCheckButton" id="checkbutton_use_libindicate">
1430
+ <property name="label" translatable="yes">Show incoming messages in the messaging menu</property>
1431
+ <property name="visible">True</property>
1432
+ <property name="can_focus">True</property>
1433
+ <property name="receives_default">False</property>
1434
+ <property name="draw_indicator">True</property>
1437
+ <property name="expand">False</property>
1438
+ <property name="fill">False</property>
1439
+ <property name="position">2</property>
1444
<property name="position">1</property>
1445
Index: empathy-2.34.0/src/empathy-status-icon.c
1446
===================================================================
1447
--- empathy-2.34.0.orig/src/empathy-status-icon.c 2011-03-24 11:15:16.000000000 -0400
1448
+++ empathy-2.34.0/src/empathy-status-icon.c 2011-03-24 12:46:24.818547063 -0400
1450
#include <gdk/gdkkeysyms.h>
1451
#include <glib/gi18n.h>
1453
+#include <libnotify/notify.h>
1454
#include <libnotify/notification.h>
1455
#include <libnotify/notify.h>
1458
#include "empathy-preferences.h"
1459
#include "empathy-event-manager.h"
1461
+#ifdef HAVE_LIBINDICATE
1462
+#include "empathy-indicator-manager.h"
1463
+#include <libindicate/server.h>
1464
+#include <libindicate/interests.h>
1467
#define DEBUG_FLAG EMPATHY_DEBUG_DISPATCHER
1468
#include <libempathy/empathy-debug.h>
1471
GtkAction *show_window_item;
1472
GtkAction *new_message_item;
1473
GtkAction *status_item;
1474
+#ifdef HAVE_LIBINDICATE
1475
+ EmpathyIndicatorManager *indicator_manager;
1476
+ IndicateServer *indicate_server;
1478
} EmpathyStatusIconPriv;
1480
G_DEFINE_TYPE (EmpathyStatusIcon, empathy_status_icon, G_TYPE_OBJECT);
1481
@@ -457,6 +468,92 @@
1482
empathy_window_present (GTK_WINDOW (priv->window));
1485
+#ifdef HAVE_LIBINDICATE
1487
+empathy_status_icon_set_visible (gboolean show_icon, EmpathyStatusIcon *icon)
1489
+ EmpathyStatusIconPriv *priv = GET_PRIV (icon);
1490
+ gtk_status_icon_set_visible (priv->icon, show_icon);
1494
+empathy_indicator_interest_status_icon (gboolean icon_visibility,
1495
+ EmpathyStatusIcon *icon)
1497
+ EmpathyStatusIconPriv *priv = GET_PRIV (icon);
1498
+ EmpathyIndicatorManager *manager;
1499
+ gboolean use_libindicate;
1501
+ manager = empathy_indicator_manager_dup_singleton();
1502
+ use_libindicate = g_settings_get_boolean (priv->gsettings_ui,
1503
+ EMPATHY_PREFS_UI_USE_LIBINDICATE);
1505
+ if (use_libindicate && !icon_visibility) {
1506
+ empathy_indicator_manager_set_server_visible (manager, TRUE);
1507
+ /* Hide the status icon so there are not two ways to access
1510
+ DEBUG ("Hiding the icon, we are shown in the indicator");
1511
+ empathy_status_icon_set_visible (FALSE, icon);
1513
+ empathy_indicator_manager_set_server_visible (manager,
1515
+ DEBUG ("Show the icon, we are not shown in the indicator");
1516
+ empathy_status_icon_set_visible (TRUE, icon);
1521
+empathy_indicator_interest_added (IndicateServer * server,
1522
+ IndicateInterests interest, EmpathyStatusIcon *icon)
1524
+ if (interest != INDICATE_INTEREST_SERVER_SIGNAL) {
1527
+ DEBUG ("Indicator received interest-added signal");
1528
+ empathy_indicator_interest_status_icon(FALSE, icon);
1532
+empathy_indicator_interest_removed (IndicateServer * server,
1533
+ IndicateInterests interest, EmpathyStatusIcon *icon)
1535
+ if (interest != INDICATE_INTEREST_SERVER_SIGNAL) {
1539
+ DEBUG ("Indicator received interest-removed signal");
1540
+ empathy_indicator_interest_status_icon(TRUE, icon);
1544
+status_icon_set_use_libindicate (EmpathyStatusIcon *icon,
1545
+ gboolean use_libindicate)
1547
+ EmpathyStatusIconPriv *priv = GET_PRIV (icon);
1549
+ if (use_libindicate) {
1550
+ empathy_indicator_manager_set_server_visible (priv->indicator_manager, TRUE);
1552
+ empathy_indicator_manager_set_server_visible (priv->indicator_manager, FALSE);
1553
+ empathy_status_icon_set_visible(TRUE, icon);
1558
+status_icon_notify_libindicate_cb (GSettings *gsettings,
1560
+ gpointer user_data)
1562
+ EmpathyStatusIcon *icon = user_data;
1563
+ EmpathyStatusIconPriv *priv = GET_PRIV (icon);
1564
+ gboolean use_libindicate;
1566
+ use_libindicate = g_settings_get_boolean (priv->gsettings_ui,
1567
+ EMPATHY_PREFS_UI_USE_LIBINDICATE);
1568
+ status_icon_set_use_libindicate (icon, use_libindicate);
1573
status_icon_notify_visibility_cb (GSettings *gsettings,
1574
@@ -476,10 +573,36 @@
1575
EmpathyStatusIconPriv *priv = GET_PRIV (icon);
1579
visible = gtk_window_is_active (priv->window);
1580
+#ifdef HAVE_LIBINDICATE
1581
+ gboolean use_libindicate;
1582
+ use_libindicate = g_settings_get_boolean (priv->gsettings_ui,
1583
+ EMPATHY_PREFS_UI_USE_LIBINDICATE);
1584
+ if (use_libindicate) {
1585
+ /* If indicators are used then we may very well not be active
1586
+ * when toggled, as they are usually windows themselves. This
1587
+ * makes it damn hard to toggle, so we just look at whether
1590
+ visible = GTK_WIDGET_VISIBLE (priv->window);
1591
+ status_icon_set_visibility (icon, TRUE, TRUE);
1596
status_icon_set_visibility (icon, !visible, TRUE);
1599
+#ifdef HAVE_LIBINDICATE
1601
+indicate_server_activate_cb (EmpathyIndicatorManager *manager,
1602
+ guint timestamp, EmpathyStatusIcon *icon)
1604
+ status_icon_toggle_visibility (icon);
1609
status_icon_presence_changed_cb (EmpathyStatusIcon *icon)
1612
g_object_unref (priv->notify_mgr);
1613
g_object_unref (priv->gsettings_ui);
1614
g_object_unref (priv->window);
1615
+#ifdef HAVE_LIBINDICATE
1616
+ g_object_unref (priv->indicator_manager);
1621
@@ -723,6 +849,13 @@
1622
G_CALLBACK (status_icon_notify_visibility_cb),
1625
+#ifdef HAVE_LIBINDICATE
1626
+ g_signal_connect (priv->gsettings_ui,
1627
+ "changed::" EMPATHY_PREFS_UI_USE_LIBINDICATE,
1628
+ G_CALLBACK (status_icon_notify_libindicate_cb),
1632
status_icon_create_menu (icon);
1634
g_signal_connect_swapped (priv->account_manager,
1636
EmpathyStatusIconPriv *priv;
1637
EmpathyStatusIcon *icon;
1638
gboolean should_hide;
1639
+#ifdef HAVE_LIBINDICATE
1640
+ gboolean use_libindicate;
1643
g_return_val_if_fail (GTK_IS_WINDOW (window), NULL);
1645
@@ -762,6 +898,24 @@
1646
priv = GET_PRIV (icon);
1648
priv->window = g_object_ref (window);
1649
+#ifdef HAVE_LIBINDICATE
1650
+ priv->indicator_manager = empathy_indicator_manager_dup_singleton ();
1651
+ priv->indicate_server = indicate_server_ref_default ();
1653
+ g_signal_connect (priv->indicator_manager, "server-activate",
1654
+ G_CALLBACK (indicate_server_activate_cb),
1657
+ g_signal_connect (priv->indicate_server,
1658
+ INDICATE_SERVER_SIGNAL_INTEREST_ADDED,
1659
+ G_CALLBACK(empathy_indicator_interest_added),
1662
+ g_signal_connect (priv->indicate_server,
1663
+ INDICATE_SERVER_SIGNAL_INTEREST_REMOVED,
1664
+ G_CALLBACK(empathy_indicator_interest_removed),
1668
g_signal_connect_after (priv->window, "key-press-event",
1669
G_CALLBACK (status_icon_key_press_event_cb),
1670
@@ -778,6 +932,12 @@
1674
+#ifdef HAVE_LIBINDICATE
1675
+ use_libindicate = g_settings_get_boolean (priv->gsettings_ui,
1676
+ EMPATHY_PREFS_UI_USE_LIBINDICATE);
1677
+ status_icon_set_use_libindicate (icon, use_libindicate);
1680
status_icon_set_visibility (icon, !should_hide, FALSE);