Close settings window when opening entries

This commit is contained in:
Jaidyn Ann 2021-05-01 16:15:22 -05:00
parent 30b4d01543
commit ddbfba58c1
2 changed files with 18 additions and 7 deletions

View File

@ -30,14 +30,23 @@ App::App() : BApplication("application/x-vnd.Pogger")
fPreferences->Load(); fPreferences->Load();
fMainWindow = new MainWindow(); fMainWindow = new MainWindow();
fMainWindow->Show();
SetPulseRate(100000);
BRoster roster; BRoster roster;
if (roster.IsRunning("application/x-vnd.PoggerDaemon") == false)
roster.Launch("application/x-vnd.PoggerDaemon"); roster.Launch("application/x-vnd.PoggerDaemon");
} }
void
App::Pulse()
{
// We want to delay showing the main window, just in case Pogger is used
// only to open a feed entry (see _OpenEntryFile)
fMainWindow->Show();
SetPulseRate(0);
}
void void
App::MessageReceived(BMessage* msg) App::MessageReceived(BMessage* msg)
{ {
@ -125,8 +134,9 @@ App::RefsReceived(BMessage* message)
info.GetType(type); info.GetType(type);
if (BString(type) == "application/x-feed-entry" if (BString(type) == "application/x-feed-entry"
|| BString(type) == "text/x-feed-entry") || BString(type) == "text/x-feed-entry") {
_OpenEntryFile(&msg); _OpenEntryFile(&msg);
}
else if (BString(type) == "application/x-feed-source") else if (BString(type) == "application/x-feed-source")
_OpenSourceFile(&msg); _OpenSourceFile(&msg);
} }
@ -137,7 +147,9 @@ void
App::_OpenEntryFile(BMessage* refMessage) App::_OpenEntryFile(BMessage* refMessage)
{ {
BRoster roster; BRoster roster;
roster.Launch("application/x-vnd.Pogger", refMessage); roster.Launch("application/x-vnd.PoggerDaemon", refMessage);
if (IsLaunching())
Quit();
} }
@ -147,7 +159,6 @@ App::_OpenSourceFile(BMessage* refMessage)
entry_ref entryRef; entry_ref entryRef;
refMessage->FindRef("refs", &entryRef); refMessage->FindRef("refs", &entryRef);
FeedEditWindow* window = new FeedEditWindow(BEntry(&entryRef)); FeedEditWindow* window = new FeedEditWindow(BEntry(&entryRef));
window->Show();
} }

View File

@ -5,7 +5,6 @@
#ifndef APP_H #ifndef APP_H
#define APP_H #define APP_H
#include <SupportDefs.h>
#include <Application.h> #include <Application.h>
#include "Preferences.h" #include "Preferences.h"
@ -22,6 +21,7 @@ class App : public BApplication
public: public:
App(); App();
void Pulse();
void MessageReceived(BMessage* msg); void MessageReceived(BMessage* msg);
bool QuitRequested(); bool QuitRequested();