Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Engine(-Twitter),Frontend: avoid Close warning dialog (closes: #1093) #256

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,12 @@ protected bool HasTokens {
}
}

public override bool HiddenPresenceStatus {
get {
return true;
}
}

public TwitterProtocolManager(Session session) : base(session)
{
Trace.Call(session);
Expand Down
4 changes: 4 additions & 0 deletions src/Engine/Protocols/IProtocolManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ PresenceStatus PresenceStatus {
get;
}

bool HiddenPresenceStatus {
get;
}

void Connect(FrontendManager frontendManager, ServerModel server);
void Disconnect(FrontendManager frontendManager);
void Reconnect(FrontendManager frontendManager);
Expand Down
6 changes: 6 additions & 0 deletions src/Engine/Protocols/ProtocolManagerBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@ public virtual PresenceStatus PresenceStatus {
}
}

public virtual bool HiddenPresenceStatus {
get {
return false;
}
}

public abstract string NetworkID {
get;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Frontend-GNOME/Views/Chats/ProtocolChatView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public override void Close()
ownedChats++;
}
}
if (ownedChats > 1) {
if (!ProtocolManager.HiddenPresenceStatus && ownedChats > 1) {
Gtk.MessageDialog md = new Gtk.MessageDialog(
Frontend.MainWindow,
Gtk.DialogFlags.Modal,
Expand Down
6 changes: 6 additions & 0 deletions src/Frontend-Tests/Mocks/MockProtocolManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ public Session Session {
}
}

public bool HiddenPresenceStatus {
get {
return false;
}
}

public string NetworkID {
get {
return "MockProtocolManagerNetwork";
Expand Down
12 changes: 6 additions & 6 deletions src/Frontend/ChatViewSyncManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ public void Add(ChatModel chatModel)
Math.Round(duration) + " ms");
#endif

OnChatAdded(chatModel, chatId, chatType, chatPosition,
protocolManager, protocolManagerType);
RaiseChatAdded(chatModel, chatId, chatType, chatPosition,
protocolManager, protocolManagerType);
}

/// <remarks>
Expand Down Expand Up @@ -290,10 +290,10 @@ void SyncWorker(ChatModel chatModel)
}
}

void OnChatAdded(ChatModel chatModel, string chatId,
ChatType chatType, int chatPosition,
IProtocolManager protocolManager,
Type protocolManagerType)
void RaiseChatAdded(ChatModel chatModel, string chatId,
ChatType chatType, int chatPosition,
IProtocolManager protocolManager,
Type protocolManagerType)
{
if (ChatAdded != null) {
ChatAdded(this,
Expand Down