From 5cf3bfdf8d8e5d61ce10b2c04e467375ddac7740 Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Thu, 6 Dec 2007 15:49:12 +0000 Subject: When NM is in sleeping (=disabled) state, do just like if it was 2007-12-06 Xavier Claessens * libempathy-gtk/empathy-preferences.c: * libempathy-gtk/empathy-preferences.glade: * libempathy/empathy-idle.c: When NM is in sleeping (=disabled) state, do just like if it was connected. Remove option from preference dialog to disabled NM support because NM can be disabled using nm-applet, but let the option in gconf, it can be useful in case of buggy NM. svn path=/trunk/; revision=469 --- ChangeLog | 9 +++++++++ libempathy-gtk/empathy-preferences.c | 6 ------ libempathy-gtk/empathy-preferences.glade | 19 ------------------- libempathy/empathy-idle.c | 21 +++++++++++++-------- 4 files changed, 22 insertions(+), 33 deletions(-) diff --git a/ChangeLog b/ChangeLog index 178e9afa8..6274dd053 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2007-12-06 Xavier Claessens + + * libempathy-gtk/empathy-preferences.c: + * libempathy-gtk/empathy-preferences.glade: + * libempathy/empathy-idle.c: When NM is in sleeping (=disabled) state, + do just like if it was connected. Remove option from preference dialog + to disabled NM support because NM can be disabled using nm-applet, but + let the option in gconf, it can be useful in case of buggy NM. + 2007-12-06 Xavier Claessens * data/empathy.schemas.in: diff --git a/libempathy-gtk/empathy-preferences.c b/libempathy-gtk/empathy-preferences.c index 14ee8f763..a8b52954d 100644 --- a/libempathy-gtk/empathy-preferences.c +++ b/libempathy-gtk/empathy-preferences.c @@ -50,7 +50,6 @@ typedef struct { GtkWidget *combobox_chat_theme; GtkWidget *checkbutton_theme_chat_room; GtkWidget *checkbutton_separate_chat_windows; - GtkWidget *checkbutton_use_nm; GtkWidget *radiobutton_contact_list_sort_by_name; GtkWidget *radiobutton_contact_list_sort_by_state; @@ -178,10 +177,6 @@ preferences_setup_widgets (EmpathyPreferences *preferences) EMPATHY_PREFS_UI_SEPARATE_CHAT_WINDOWS, preferences->checkbutton_separate_chat_windows); - preferences_hookup_toggle_button (preferences, - EMPATHY_PREFS_USE_NM, - preferences->checkbutton_use_nm); - preferences_hookup_toggle_button (preferences, EMPATHY_PREFS_UI_SHOW_AVATARS, preferences->checkbutton_show_avatars); @@ -944,7 +939,6 @@ empathy_preferences_show (GtkWindow *parent) "combobox_chat_theme", &preferences->combobox_chat_theme, "checkbutton_theme_chat_room", &preferences->checkbutton_theme_chat_room, "checkbutton_separate_chat_windows", &preferences->checkbutton_separate_chat_windows, - "checkbutton_use_nm", &preferences->checkbutton_use_nm, "radiobutton_contact_list_sort_by_name", &preferences->radiobutton_contact_list_sort_by_name, "radiobutton_contact_list_sort_by_state", &preferences->radiobutton_contact_list_sort_by_state, "checkbutton_sounds_for_messages", &preferences->checkbutton_sounds_for_messages, diff --git a/libempathy-gtk/empathy-preferences.glade b/libempathy-gtk/empathy-preferences.glade index 5c3321197..4db860f13 100644 --- a/libempathy-gtk/empathy-preferences.glade +++ b/libempathy-gtk/empathy-preferences.glade @@ -232,25 +232,6 @@ False - - - - True - True - _Use network manager - True - GTK_RELIEF_NORMAL - True - False - False - True - - - 0 - False - False - - diff --git a/libempathy/empathy-idle.c b/libempathy/empathy-idle.c index 10d5b7bde..6ef72609e 100644 --- a/libempathy/empathy-idle.c +++ b/libempathy/empathy-idle.c @@ -208,8 +208,9 @@ empathy_idle_init (EmpathyIdle *idle) idle, NULL); } else { empathy_debug (DEBUG_DOMAIN, "Failed to get nm proxy"); - priv->nm_connected = TRUE; } + + priv->nm_connected = TRUE; } static void @@ -468,7 +469,7 @@ empathy_idle_set_use_nm (EmpathyIdle *idle, "Couldn't get NM state: %s", error->message); g_clear_error (&error); - nm_status = NM_STATE_CONNECTED; + nm_status = NM_STATE_ASLEEP; } idle_nm_state_change_cb (priv->nm_proxy, nm_status, idle); @@ -573,6 +574,7 @@ idle_nm_state_change_cb (DBusGProxy *proxy, EmpathyIdle *idle) { EmpathyIdlePriv *priv; + gboolean nm_connected; priv = GET_PRIV (idle); @@ -583,20 +585,23 @@ idle_nm_state_change_cb (DBusGProxy *proxy, return; } - if (state != NM_STATE_CONNECTED && priv->nm_connected) { + nm_connected = !(state == NM_STATE_CONNECTING || + state == NM_STATE_DISCONNECTED); + + if (priv->nm_connected && !nm_connected) { /* We are no more connected */ idle_ext_away_stop (idle); - priv->nm_saved_state = priv->state; + priv->nm_saved_state = priv->state; empathy_idle_set_state (idle, MC_PRESENCE_OFFLINE); - priv->nm_connected = FALSE; } - else if (state == NM_STATE_CONNECTED && !priv->nm_connected) { + else if (!priv->nm_connected && nm_connected) { /* We are now connected */ - priv->nm_connected = TRUE; - empathy_idle_set_state (idle, priv->nm_saved_state); priv->nm_saved_state = MC_PRESENCE_UNSET; + empathy_idle_set_state (idle, priv->nm_saved_state); } + + priv->nm_connected = nm_connected; } static void -- cgit v1.2.3