aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy/empathy-idle.c
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@gmail.com>2007-07-20 23:26:30 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2007-07-20 23:26:30 +0800
commit73a749cafbd78b45494aa5eba645ef2fe9c4e21a (patch)
treee6e17735f1c117203bf934ede853927a05201f92 /libempathy/empathy-idle.c
parentf2e322a3395fc21c533833cd5b9fffb0cc677e3f (diff)
downloadgsoc2013-empathy-73a749cafbd78b45494aa5eba645ef2fe9c4e21a.tar
gsoc2013-empathy-73a749cafbd78b45494aa5eba645ef2fe9c4e21a.tar.gz
gsoc2013-empathy-73a749cafbd78b45494aa5eba645ef2fe9c4e21a.tar.bz2
gsoc2013-empathy-73a749cafbd78b45494aa5eba645ef2fe9c4e21a.tar.lz
gsoc2013-empathy-73a749cafbd78b45494aa5eba645ef2fe9c4e21a.tar.xz
gsoc2013-empathy-73a749cafbd78b45494aa5eba645ef2fe9c4e21a.tar.zst
gsoc2013-empathy-73a749cafbd78b45494aa5eba645ef2fe9c4e21a.zip
Initial room list support. It does not works yet.
2007-07-20 Xavier Claessens <xclaesse@gmail.com> * libempathy/Makefile.am: * libempathy/empathy-tp-roomlist.h: * libempathy/empathy-tp-roomlist.c: * libempathy-gtk/empathy-chatrooms-window.c: * libempathy-gtk/empathy-new-chatroom-dialog.c: Initial room list support. It does not works yet. * libempathy-gtk/empathy-account-widget-generic.c: Add support for all types of integer and float. Fixes bug #457740 (Jamey Hicks). * libempathy/empathy-tp-chat.c: * libempathy-gtk/empathy-chat.c: If there is an error sending a message, show an error message to the user. * libempathy-gtk/empathy-accounts-dialog.c: Fix a leak, profile should be unrefed after mc_account_get_profile. * libempathy/empathy-utils.c: * libempathy/empathy-utils.h: * libempathy/empathy-tp-chatroom.c: * libempathy/empathy-tp-group.h: * libempathy/empathy-tp-group.c: * src/empathy.c: Rename empathy_get_channel_id() to empathy_inspect_channel(). We now have empathy_inspect_handle(). * po/POTFILES.in: * libempathy/empathy-tp-contact-list.c: Set all contacts from salut protocol to the "Local Network" group. * libempathy/empathy-idle.c: Fix NetworkManager support. * libempathy/empathy-chatroom.h: Fix indentation. * libempathy-gtk/empathy-status-icon.c: * libempathy-gtk/empathy-ui-utils.c: * libempathy-gtk/empathy-ui-utils.h: - Iconify main window to the status icon like in rhythmbox. Fixes bug #458106 (Jaap A. Haitsma). - Rounded avatars. Fixes bug #457992 (Raphael Slinckx) * Makefile.am: Fix distcheck for gtkdoc (Vincent Untz) * data/empathy.desktop.in.in: Change application description (Jaap A. Haitsma). svn path=/trunk/; revision=190
Diffstat (limited to 'libempathy/empathy-idle.c')
-rw-r--r--libempathy/empathy-idle.c33
1 files changed, 26 insertions, 7 deletions
diff --git a/libempathy/empathy-idle.c b/libempathy/empathy-idle.c
index 5b04d363f..923b499be 100644
--- a/libempathy/empathy-idle.c
+++ b/libempathy/empathy-idle.c
@@ -42,7 +42,7 @@
#define EXT_AWAY_TIME (30*60)
typedef enum {
- NM_STATE_UNKNOWN = 0,
+ NM_STATE_UNKNOWN,
NM_STATE_ASLEEP,
NM_STATE_CONNECTING,
NM_STATE_CONNECTED,
@@ -180,16 +180,31 @@ empathy_idle_init (EmpathyIdle *idle)
"org.freedesktop.NetworkManager");
}
if (priv->nm_proxy) {
+ guint nm_status;
+
dbus_g_proxy_add_signal (priv->nm_proxy, "StateChange",
G_TYPE_UINT, G_TYPE_INVALID);
dbus_g_proxy_connect_signal (priv->nm_proxy, "StateChange",
G_CALLBACK (idle_nm_state_change_cb),
idle, NULL);
+ dbus_g_proxy_call (priv->nm_proxy, "state",
+ &error,
+ G_TYPE_INVALID,
+ G_TYPE_UINT, &nm_status,
+ G_TYPE_INVALID);
+ priv->nm_connected = (nm_status == NM_STATE_CONNECTED);
+
+ empathy_debug (DEBUG_DOMAIN, "NetworkManager connected: %s",
+ priv->nm_connected ? "Yes" : "No");
+
+ if (!priv->nm_connected) {
+ priv->saved_state = priv->state;
+ priv->saved_status = g_strdup (priv->status);
+ }
} else {
empathy_debug (DEBUG_DOMAIN, "Failed to get nm proxy");
+ priv->nm_connected = TRUE;
}
- /* FIXME: get value */
- priv->nm_connected = TRUE;
}
static void
@@ -363,7 +378,13 @@ empathy_idle_set_presence (EmpathyIdle *idle,
priv = GET_PRIV (idle);
+ empathy_debug (DEBUG_DOMAIN, "Changing presence to %s (%d)",
+ status, state);
+
if (!priv->nm_connected) {
+ empathy_debug (DEBUG_DOMAIN,
+ "NM not connected, saving requested presence");
+
g_free (priv->saved_status);
priv->saved_state = state;
priv->saved_status = g_strdup (status);
@@ -475,8 +496,7 @@ idle_nm_state_change_cb (DBusGProxy *proxy,
empathy_debug (DEBUG_DOMAIN, "New network state (%d)", state);
- if (state != NM_STATE_CONNECTED &&
- priv->state > MC_PRESENCE_OFFLINE) {
+ if (state != NM_STATE_CONNECTED && priv->nm_connected) {
/* We are no more connected */
idle_ext_away_stop (idle);
g_free (priv->saved_status);
@@ -486,8 +506,7 @@ idle_nm_state_change_cb (DBusGProxy *proxy,
empathy_idle_set_state (idle, MC_PRESENCE_OFFLINE);
priv->nm_connected = FALSE;
}
- else if (priv->state <= MC_PRESENCE_OFFLINE &&
- state == NM_STATE_CONNECTED) {
+ else if (state == NM_STATE_CONNECTED && !priv->nm_connected) {
/* We are now connected */
priv->nm_connected = TRUE;
empathy_idle_set_presence (idle,