2
* This file is a part of the Cairo-Dock project
4
* Copyright : (C) see the 'copyright' file.
5
* based on indicator-messages.c written by :
6
* Ted Gould <ted@canonical.com>
7
* Cody Russell <cody.russell@canonical.com>
8
* E-mail : see the 'copyright' file.
10
* This program is free software; you can redistribute it and/or
11
* modify it under the terms of the GNU General Public License
12
* as published by the Free Software Foundation; either version 3
13
* of the License, or (at your option) any later version.
15
* This program is distributed in the hope that it will be useful,
16
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
* GNU General Public License for more details.
19
* You should have received a copy of the GNU General Public License
20
* along with this program. If not, see <http://www.gnu.org/licenses/>.
26
#include "applet-struct.h"
27
#include "messages-service-client.h"
28
#include "applet-messaging.h"
30
#define DEFAULT_ICON "indicator-messages"
36
/* Called everytime the attention changes in the service. */
38
attention_changed_cb (DBusGProxy * proxy, gboolean dot, GldiModuleInstance *myApplet)
40
//g_print ("%s (attention : %d)\n", __func__, dot);
43
cd_indicator_set_icon (myData.pIndicator, "indicator-messages-new");
45
if (myConfig.cAnimationName != NULL)
46
CD_APPLET_DEMANDS_ATTENTION (myConfig.cAnimationName, 60);
50
cd_indicator_set_icon (myData.pIndicator, "indicator-messages");
52
CD_APPLET_STOP_DEMANDING_ATTENTION;
56
/* Change the icon to whether it should be visible or not */
58
icon_changed_cb (DBusGProxy * proxy, gboolean hidden, GldiModuleInstance *myApplet)
60
cd_debug ("%s (hidden : %d)", __func__, hidden);
69
CD_APPLET_REDRAW_MY_ICON;
72
/* Callback from getting the attention status from the service. */
74
attention_cb (DBusGProxy * proxy, gboolean dot, GError * error, GldiModuleInstance *myApplet)
77
cd_warning ("Unable to get attention status: %s", error->message);
82
return attention_changed_cb(proxy, dot, myApplet);
85
/* Change from getting the icon visibility from the service */
87
icon_cb (DBusGProxy * proxy, gboolean hidden, GError * error, GldiModuleInstance *myApplet)
90
cd_warning ("Unable to get icon visibility: %s", error->message);
95
return icon_changed_cb(proxy, hidden, myApplet);
98
void cd_messaging_on_connect (GldiModuleInstance *myApplet)
100
dbus_g_proxy_add_signal(myData.pIndicator->pServiceProxy, "AttentionChanged", G_TYPE_BOOLEAN, G_TYPE_INVALID);
101
dbus_g_proxy_connect_signal(myData.pIndicator->pServiceProxy,
103
G_CALLBACK(attention_changed_cb),
106
dbus_g_proxy_add_signal(myData.pIndicator->pServiceProxy, "IconChanged", G_TYPE_BOOLEAN, G_TYPE_INVALID);
107
dbus_g_proxy_connect_signal(myData.pIndicator->pServiceProxy,
109
G_CALLBACK(icon_changed_cb),
114
void cd_messaging_on_disconnect (GldiModuleInstance *myApplet)
116
//g_print ("disconnected\n");
117
cd_indicator_set_icon (myData.pIndicator, DEFAULT_ICON); // If we're disconnecting, go back to offline.
120
void cd_messaging_get_initial_values (GldiModuleInstance *myApplet)
122
// query the service to display initial values.
123
org_ayatana_indicator_messages_service_attention_requested_async(myData.pIndicator->pServiceProxy,
124
(org_ayatana_indicator_messages_service_attention_requested_reply)attention_cb,
127
org_ayatana_indicator_messages_service_icon_shown_async(myData.pIndicator->pServiceProxy,
128
(org_ayatana_indicator_messages_service_icon_shown_reply)icon_cb,