[smuxi: 4/5] Frontend-GNOME: don't push last seen message for each chat when disconnecting



commit e42a6f220c29dd7cfea99a8c87bbb3f0677f301d
Author: Mirco Bauer <meebey meebey net>
Date:   Fri Jun 12 05:55:11 2015 +0200

    Frontend-GNOME: don't push last seen message for each chat when disconnecting
    
    Each chat gets removed to release all resources when disconnecting the frontend
    from the engine. This triggered a chat switch for each removed chat. Then each
    chat switch triggered pushing the last seen message to the remote engine.

 src/Frontend-GNOME/Frontend.cs |    6 ++++++
 src/Frontend-GNOME/Notebook.cs |    2 +-
 2 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/src/Frontend-GNOME/Frontend.cs b/src/Frontend-GNOME/Frontend.cs
index 0cb5892..cf56b0a 100644
--- a/src/Frontend-GNOME/Frontend.cs
+++ b/src/Frontend-GNOME/Frontend.cs
@@ -61,6 +61,7 @@ namespace Smuxi.Frontend.Gnome
         public static string IconName { get; private set; }
         public static bool HasSystemIconTheme { get; private set; }
         public static bool HadSession { get; private set; }
+        public static bool IsDisconnecting { get; private set; }
         public static bool IsGtkInitialized { get; private set; }
         public static bool InGtkApplicationRun { get; private set; }
         public static bool IsWindows { get; private set; }
@@ -355,6 +356,7 @@ namespace Smuxi.Frontend.Gnome
         {
             Trace.Call(cleanly);
 
+            IsDisconnecting = true;
             MainWindow.ChatViewManager.IsSensitive = false;
             if (cleanly) {
                 try {
@@ -387,6 +389,7 @@ namespace Smuxi.Frontend.Gnome
 
             _FrontendManager = null;
             Session = null;
+            IsDisconnecting = false;
         }
 
         public static void ReconnectEngineToGUI()
@@ -498,6 +501,9 @@ namespace Smuxi.Frontend.Gnome
                 if (!UseLowBandwidthMode && currentChatView != null) {
                     currentChatView.UpdateLastSeenMessage();
                 }
+                // OPT: switch to Smuxi chat so switch page events are not
+                // triggered when each chat gets removed
+                _MainWindow.ChatViewManager.CurrentChatNumber = 0;
 
                 DisconnectEngineFromGUI();
             }
diff --git a/src/Frontend-GNOME/Notebook.cs b/src/Frontend-GNOME/Notebook.cs
index 36faea4..0b1529b 100644
--- a/src/Frontend-GNOME/Notebook.cs
+++ b/src/Frontend-GNOME/Notebook.cs
@@ -194,7 +194,7 @@ namespace Smuxi.Frontend.Gnome
         [GLib.ConnectBefore]
         protected virtual void OnBeforeSwitchPage(object sender, Gtk.SwitchPageArgs e)
         {
-            if (f_IsBrowseModeEnabled) {
+            if (f_IsBrowseModeEnabled || Frontend.IsDisconnecting) {
                 return;
             }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]