1442
1444
+#ifdef HAVE_LIBINDICATE
1443
1445
+#include "empathy-indicator-manager.h"
1446
+#include <libindicate/server.h>
1447
+#include <libindicate/interests.h>
1446
1450
#define DEBUG_FLAG EMPATHY_DEBUG_DISPATCHER
1447
1451
#include <libempathy/empathy-debug.h>
1450
1454
GtkAction *new_message_item;
1451
1455
GtkAction *status_item;
1452
1456
gboolean notify_supports_actions;
1453
1457
+#ifdef HAVE_LIBINDICATE
1454
1458
+ EmpathyIndicatorManager *indicator_manager;
1459
+ IndicateServer *indicate_server;
1456
1461
} EmpathyStatusIconPriv;
1458
1463
G_DEFINE_TYPE (EmpathyStatusIcon, empathy_status_icon, G_TYPE_OBJECT);
1510
@@ -347,6 +390,28 @@
1515
@@ -166,8 +212,13 @@
1516
priv->event->header, message_esc,
1519
- priv->notification = notify_notification_new_with_status_icon
1520
- (priv->event->header, message_esc, NULL, priv->icon);
1521
+ if (gtk_status_icon_get_visible (priv->icon)) {
1522
+ priv->notification = notify_notification_new_with_status_icon
1523
+ (priv->event->header, message_esc, NULL, priv->icon);
1525
+ priv->notification = notify_notification_new
1526
+ (priv->event->header, message_esc, NULL, NULL);
1528
notify_notification_set_timeout (priv->notification,
1529
NOTIFY_EXPIRES_DEFAULT);
1531
@@ -346,6 +397,94 @@
1532
empathy_window_present (GTK_WINDOW (priv->window), TRUE);
1514
1535
+#ifdef HAVE_LIBINDICATE
1537
+empathy_status_icon_set_visible (gboolean show_icon, EmpathyStatusIcon *icon)
1539
+ EmpathyStatusIconPriv *priv = GET_PRIV (icon);
1540
+ gtk_status_icon_set_visible (priv->icon, show_icon);
1544
+empathy_indicator_interest_status_icon (gboolean icon_visibility,
1545
+ EmpathyStatusIcon *icon)
1547
+ EmpathyIndicatorManager *manager;
1548
+ manager = empathy_indicator_manager_dup_singleton();
1550
+ gboolean use_libindicate = FALSE;
1551
+ empathy_conf_get_bool (empathy_conf_get (),
1552
+ EMPATHY_PREFS_UI_USE_LIBINDICATE,
1553
+ &use_libindicate);
1555
+ if (use_libindicate && !icon_visibility) {
1556
+ empathy_indicator_manager_set_server_visible (manager,
1558
+ /* Hide the status icon so there are not two ways to access
1561
+ DEBUG ("Hiding the icon, we are shown in the indicator");
1562
+ empathy_status_icon_set_visible (FALSE, icon);
1564
+ empathy_indicator_manager_set_server_visible (manager,
1566
+ DEBUG ("Show the icon, we are not shown in the indicator");
1567
+ empathy_status_icon_set_visible (TRUE, icon);
1572
+empathy_indicator_interest_added (IndicateServer * server,
1573
+ IndicateInterests interest, EmpathyStatusIcon *icon)
1575
+ if (interest != INDICATE_INTEREST_SERVER_SIGNAL) {
1578
+ DEBUG ("Indicator received interest-added signal");
1579
+ empathy_indicator_interest_status_icon(FALSE, icon);
1583
+empathy_indicator_interest_removed (IndicateServer * server,
1584
+ IndicateInterests interest, EmpathyStatusIcon *icon)
1586
+ if (interest != INDICATE_INTEREST_SERVER_SIGNAL) {
1590
+ DEBUG ("Indicator received interest-removed signal");
1591
+ empathy_indicator_interest_status_icon(TRUE, icon);
1516
1595
+status_icon_set_use_libindicate (EmpathyStatusIcon *icon,
1517
+ gboolean use_libindicate)
1596
+ gboolean use_libindicate)
1519
1598
+ EmpathyStatusIconPriv *priv = GET_PRIV (icon);
1521
1600
+ if (use_libindicate) {
1522
1601
+ empathy_indicator_manager_set_server_visible (priv->indicator_manager,
1524
+ /* Hide the status icon so there are not two ways to access empathy.
1525
+ * Should use libindicate's "interest" to confirm someone is listening.
1527
+ gtk_status_icon_set_visible (priv->icon, FALSE);
1529
1604
+ empathy_indicator_manager_set_server_visible (priv->indicator_manager,
1531
+ gtk_status_icon_set_visible (priv->icon, TRUE);
1606
+ empathy_status_icon_set_visible(TRUE, icon);
1537
status_icon_notify_visibility_cb (EmpathyConf *conf,
1539
@@ -360,16 +425,56 @@
1543
+#ifdef HAVE_LIBINDICATE
1545
1611
+status_icon_notify_libindicate_cb (EmpathyConf *conf,
1546
1612
+ const gchar *key,
1629
1696
g_return_val_if_fail (GTK_IS_WINDOW (window), NULL);
1631
@@ -632,6 +751,12 @@
1698
@@ -632,6 +811,24 @@
1632
1699
priv = GET_PRIV (icon);
1634
1701
priv->window = g_object_ref (window);
1635
1702
+#ifdef HAVE_LIBINDICATE
1636
1703
+ priv->indicator_manager = empathy_indicator_manager_dup_singleton ();
1704
+ priv->indicate_server = indicate_server_ref_default ();
1637
1706
+ g_signal_connect (priv->indicator_manager, "server-activate",
1638
1707
+ G_CALLBACK (indicate_server_activate_cb),
1710
+ g_signal_connect (priv->indicate_server,
1711
+ INDICATE_SERVER_SIGNAL_INTEREST_ADDED,
1712
+ G_CALLBACK(empathy_indicator_interest_added),
1715
+ g_signal_connect (priv->indicate_server,
1716
+ INDICATE_SERVER_SIGNAL_INTEREST_REMOVED,
1717
+ G_CALLBACK(empathy_indicator_interest_removed),
1642
1721
g_signal_connect_after (priv->window, "key-press-event",
1643
1722
G_CALLBACK (status_icon_key_press_event_cb),
1644
@@ -649,6 +774,13 @@
1723
@@ -649,6 +846,13 @@
1645
1724
should_hide = TRUE;