2008-02-18 [colin] 3.3.0cvs16
authorColin Leroy <colin@colino.net>
Mon, 18 Feb 2008 17:41:40 +0000 (17:41 +0000)
committerColin Leroy <colin@colino.net>
Mon, 18 Feb 2008 17:41:40 +0000 (17:41 +0000)
* src/imap.c
Unset folder's session before creating a
new one
* src/main.c
* src/prefs_common.c
* src/prefs_common.h
* manual/advanced.xml
Add an hidden use_networkmanager pref, to
disable NetworkManager handling. Also,
consider UNKNOWN state to be CONNECTED.

ChangeLog
PATCHSETS
configure.ac
manual/advanced.xml
src/imap.c
src/main.c
src/prefs_common.c
src/prefs_common.h

index aafcb1c..c119a1b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2008-02-18 [colin]     3.3.0cvs16
+
+       * src/imap.c
+               Unset folder's session before creating a
+               new one
+       * src/main.c
+       * src/prefs_common.c
+       * src/prefs_common.h
+       * manual/advanced.xml
+               Add an hidden use_networkmanager pref, to
+               disable NetworkManager handling. Also,
+               consider UNKNOWN state to be CONNECTED.
+
 2008-02-18 [wwp]       3.3.0cvs15
 
        * src/matcher.c
index ef79bed..d53d512 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.115.2.186 -r 1.115.2.187 src/main.c;  cvs diff -u -r 1.382.2.437 -r 1.382.2.438 src/compose.c;  ) > 3.3.0cvs13.patchset
 ( cvs diff -u -r 1.75.2.55 -r 1.75.2.56 src/matcher.c;  ) > 3.3.0cvs14.patchset
 ( cvs diff -u -r 1.75.2.56 -r 1.75.2.57 src/matcher.c;  ) > 3.3.0cvs15.patchset
+( cvs diff -u -r 1.179.2.210 -r 1.179.2.211 src/imap.c;  cvs diff -u -r 1.115.2.187 -r 1.115.2.188 src/main.c;  cvs diff -u -r 1.204.2.161 -r 1.204.2.162 src/prefs_common.c;  cvs diff -u -r 1.103.2.104 -r 1.103.2.105 src/prefs_common.h;  cvs diff -u -r 1.1.2.44 -r 1.1.2.45 manual/advanced.xml;  ) > 3.3.0cvs16.patchset
index 2b94958..301edd4 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=3
 MICRO_VERSION=0
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=15
+EXTRA_VERSION=16
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index b28c143..3224065 100644 (file)
        </para>
        </listitem>
       </varlistentry>
+      <varlistentry>
+       <term><literal>use_networkmanager</literal></term>
+       <listitem>
+       <para>
+       Use NetworkManager to switch offline automatically. This is enabled
+       by default.
+       </para>
+       </listitem>
+      </varlistentry>
       <varlistentry>
        <term><literal>use_stripes_everywhere</literal></term>
        <listitem>
index 5814b67..8b52e8a 100644 (file)
@@ -1006,8 +1006,11 @@ static IMAPSession *imap_session_get(Folder *folder)
                        debug_print("disconnected!\n");
                        if (!is_fatal(r))
                                session = imap_reconnect_if_possible(folder, session);
-                       else
+                       else {
+                               rfolder->session = NULL;
+                               rfolder->connecting = FALSE;
                                session = imap_session_get(folder);
+                       }
                }
                if (session)
                        session->cancelled = FALSE;
index 04e3937..cc949cd 100644 (file)
@@ -1014,8 +1014,8 @@ int main(int argc, char *argv[])
                                                                                                                                                        "org.freedesktop.NetworkManager");
                dbus_g_proxy_add_signal(proxy,"StateChange", G_TYPE_UINT, G_TYPE_INVALID);
                dbus_g_proxy_connect_signal(proxy, "StateChange",
-                                                                                                                               G_CALLBACK(networkmanager_state_change_cb),
-                                                                                                                               NULL,NULL);
+                       G_CALLBACK(networkmanager_state_change_cb),
+                       NULL,NULL);
        }
 #endif
 
@@ -2354,17 +2354,20 @@ osso_context_t *get_osso_context(void)
 
 #ifdef HAVE_NETWORKMANAGER_SUPPORT
 static void networkmanager_state_change_cb(DBusGProxy *proxy, gchar *dev,
-                                                                                                                                                                        gpointer data)
+                                        gpointer data)
 {
        MainWindow *mainWin;
 
        mainWin = NULL;
-       if(static_mainwindow)
+       if (static_mainwindow)
                mainWin = static_mainwindow;
-       else if(data)
+       else if (data)
                mainWin = (MainWindow*)data;
        
-       if(mainWin) {
+       if (!prefs_common.use_networkmanager)
+               return;
+
+       if (mainWin) {
                GError *error;
                gboolean online;
 
@@ -2375,11 +2378,13 @@ static void networkmanager_state_change_cb(DBusGProxy *proxy, gchar *dev,
                                went_offline_nm = FALSE;
                                main_window_toggle_work_offline(mainWin, FALSE, FALSE);
                                debug_print("NetworkManager: Went online\n");
+                               log_message(LOG_PROTOCOL, _("NetworkManager: network is online."));
                        }
                        else if(!online) {
                                went_offline_nm = TRUE;
                                main_window_toggle_work_offline(mainWin, TRUE, FALSE);
                                debug_print("NetworkManager: Went offline\n");
+                               log_message(LOG_PROTOCOL, _("NetworkManager: network is offline."));
                        }
                }
                else {
@@ -2397,16 +2402,19 @@ static void networkmanager_state_change_cb(DBusGProxy *proxy, gchar *dev,
 gboolean networkmanager_is_online(GError **error)
 {
        DBusGConnection *connection;
-  DBusGProxy *proxy;
+       DBusGProxy *proxy;
        GError *tmp_error;
        gboolean retVal;
        guint32 state;
 
+       if (!prefs_common.use_networkmanager)
+               return TRUE;
+
        tmp_error = NULL;
        proxy = NULL;
-  connection = dbus_g_bus_get(DBUS_BUS_SYSTEM, &tmp_error);
+       connection = dbus_g_bus_get(DBUS_BUS_SYSTEM, &tmp_error);
 
-  if(!connection) {
+       if(!connection) {
                /* If calling code doesn't do error checking, at least print some debug */
                if((error == NULL) || (*error == NULL))
                        debug_print("Failed to open connection to system bus: %s\n",
@@ -2416,12 +2424,12 @@ gboolean networkmanager_is_online(GError **error)
        }
 
        proxy = dbus_g_proxy_new_for_name(connection,
-                                                                                                                                               "org.freedesktop.NetworkManager",
-                                                                                                                                               "/org/freedesktop/NetworkManager",
-                                                                                                                                               "org.freedesktop.NetworkManager");
+                       "org.freedesktop.NetworkManager",
+                       "/org/freedesktop/NetworkManager",
+                       "org.freedesktop.NetworkManager");
 
-       retVal = dbus_g_proxy_call(proxy,"state",&tmp_error,G_TYPE_INVALID,
-                                                                                                                G_TYPE_UINT,&state,G_TYPE_INVALID);
+       retVal = dbus_g_proxy_call(proxy,"state",&tmp_error, G_TYPE_INVALID,
+                       G_TYPE_UINT, &state, G_TYPE_INVALID);
 
        if(proxy)
                g_object_unref(proxy);
@@ -2437,6 +2445,6 @@ gboolean networkmanager_is_online(GError **error)
                return TRUE;
        }
 
-       return (state == NM_STATE_CONNECTED);
+       return (state == NM_STATE_CONNECTED || state == NM_STATE_UNKNOWN);
 }
 #endif
index d2d92b4..70749b7 100644 (file)
@@ -1098,6 +1098,8 @@ static PrefParam param[] = {
         NULL, NULL, NULL},
        {"print_previewwin_height", "-1", &prefs_common.print_previewwin_height, P_INT,
         NULL, NULL, NULL},
+       {"use_networkmanager", "TRUE", &prefs_common.use_networkmanager, P_BOOL,
+        NULL, NULL, NULL},
 
        {NULL, NULL, NULL, P_OTHER, NULL, NULL, NULL}
 };
index a49c5d0..a3f4cc4 100644 (file)
@@ -483,6 +483,8 @@ struct _PrefsCommon
        gint print_imgs;
        gint print_previewwin_width;
        gint print_previewwin_height;
+       
+       gboolean use_networkmanager;
 };
 
 extern PrefsCommon prefs_common;