From 38e9fca3beacd71bb311ca13a7786ea091b296af Mon Sep 17 00:00:00 2001 From: Jaidyn Ann Date: Thu, 19 Aug 2021 01:18:09 -0500 Subject: [PATCH] Prioritize native protocols in protocol list --- application/windows/AccountsWindow.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/application/windows/AccountsWindow.cpp b/application/windows/AccountsWindow.cpp index 68aa4ef..3438ff8 100644 --- a/application/windows/AccountsWindow.cpp +++ b/application/windows/AccountsWindow.cpp @@ -70,6 +70,9 @@ AccountsWindow::AccountsWindow() ProtocolManager* pm = ProtocolManager::Get(); fProtosMenu = new BPopUpMenu(NULL, true); + BObjectList accountItems; + BObjectList purpleItems; + for (uint32 i = 0; i < pm->CountProtocolAddOns(); i++) { ChatProtocolAddOn* addOn = pm->ProtocolAddOnAt(i); ProtocolSettings* settings = new ProtocolSettings(addOn); @@ -83,8 +86,19 @@ AccountsWindow::AccountsWindow() BitmapMenuItem* item = new BitmapMenuItem( addOn->ProtoFriendlySignature(), msg, addOn->ProtoIcon()); - fProtosMenu->AddItem(item); + + if (BString(addOn->Signature()) == "purple") + purpleItems.AddItem(item); + else + accountItems.AddItem(item); } + + for (int i = 0; i < accountItems.CountItems(); i++) + fProtosMenu->AddItem(accountItems.ItemAt(i)); + fProtosMenu->AddSeparatorItem(); + + for (int i = 0; i < purpleItems.CountItems(); i++) + fProtosMenu->AddItem(purpleItems.ItemAt(i)); fProtosMenu->SetTargetForItems(this); MenuButton* proto = new MenuButton("addButton", B_TRANSLATE("Add"), NULL);