Skip to content

Commit

Permalink
Removed unnecessary announcement and used the window messaging instead
Browse files Browse the repository at this point in the history
  • Loading branch information
topfs2 committed May 20, 2011
1 parent 7c93ed3 commit c43a7f6
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 8 deletions.
27 changes: 22 additions & 5 deletions xbmc/windows/GUIWindowHome.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,6 @@ void CGUIWindowHome::Announce(EAnnouncementFlag flag, const char *sender, const
if (strcmp(message, "NewPlayCount") == 0)
ra_flag |= Totals;
}
else if (flag & System)
{
if (strcmp(message, "ProfileChange") == 0)
ra_flag |= (Video | Audio | Totals);
}

// add the job immediatedly if the home window is active
// otherwise defer it to the next initialisation
Expand All @@ -93,3 +88,25 @@ void CGUIWindowHome::AddRecentlyAddedJobs(int flag)
CJobManager::GetInstance().AddJob(new CRecentlyAddedJob(flag), NULL);
m_updateRA = 0;
}

bool CGUIWindowHome::OnMessage(CGUIMessage& message)
{
switch ( message.GetMessage() )
{
case GUI_MSG_NOTIFY_ALL:
if (message.GetParam1() == GUI_MSG_WINDOW_RESET)
{
if (IsActive())
AddRecentlyAddedJobs(Video | Audio | Totals);
else
m_updateRA |= (Video | Audio | Totals);
return true;
}
break;

default:
break;
}

return CGUIWindow::OnMessage(message);
}
2 changes: 2 additions & 0 deletions xbmc/windows/GUIWindowHome.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ class CGUIWindowHome :
virtual void OnInitWindow();
virtual void Announce(ANNOUNCEMENT::EAnnouncementFlag flag, const char *sender, const char *message, const CVariant &data);

virtual bool OnMessage(CGUIMessage& message);

private:
int m_updateRA; // flag for which recently added items needs to be queried
void AddRecentlyAddedJobs(int flag);
Expand Down
5 changes: 2 additions & 3 deletions xbmc/windows/GUIWindowLoginScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,12 @@
#include "interfaces/python/XBPython.h"
#endif
#include "interfaces/Builtins.h"
#include "interfaces/AnnouncementManager.h"
#include "utils/Weather.h"
#include "network/Network.h"
#include "addons/Skin.h"
#include "settings/Profile.h"
#include "guilib/GUIMessage.h"
#include "GUIUserMessages.h"
#include "guilib/GUIWindowManager.h"
#include "dialogs/GUIDialogOK.h"
#include "settings/Settings.h"
Expand Down Expand Up @@ -292,6 +293,4 @@ void CGUIWindowLoginScreen::LoadProfile(unsigned int profile)
g_windowManager.ChangeActiveWindow(g_SkinInfo->GetFirstWindow());

g_application.UpdateLibraries();

ANNOUNCEMENT::CAnnouncementManager::Announce(ANNOUNCEMENT::System, "xbmc", "ProfileChange");
}

0 comments on commit c43a7f6

Please sign in to comment.