diff -r f7f0874bfe7d -r 6b87b143d312 photosgallery/viewframework/views/gridview/src/glxgridviewimp.cpp --- a/photosgallery/viewframework/views/gridview/src/glxgridviewimp.cpp Tue Feb 02 10:12:14 2010 +0200 +++ b/photosgallery/viewframework/views/gridview/src/glxgridviewimp.cpp Fri Feb 19 22:51:01 2010 +0200 @@ -106,9 +106,12 @@ ViewBaseConstructL(); MLViewBaseConstructL(aMediaListFactory, aTitle); - //Register the view to recieve toolbar events. ViewBase handles the events + //create the tool bar dynamically + //to reduce the startup time of the application. + iToolbar = CAknToolbar::NewL(R_GLX_GRID_VIEW_TOOLBAR); + SetGridToolBar(iToolbar); SetToolbarObserver(this); - ShowToolbarOnViewActivation(ETrue); + iToolbar->SetToolbarVisibility(ETrue); // Get object that stores the active media list registry iActiveMediaListRegistry = CGlxActiveMediaListRegistry::InstanceL(); @@ -151,9 +154,15 @@ // Setting the Context sensitive menu id MenuBar()->SetContextMenuTitleResourceId( iResourceIds.iOkOptionsMenuId ); iActiveMediaListRegistry->RegisterActiveMediaList(iMediaList); - + if(!iToolbar) + { + iToolbar = CAknToolbar::NewL(R_GLX_GRID_VIEW_TOOLBAR); + SetGridToolBar(iToolbar); + SetToolbarObserver(this); + iToolbar->SetToolbarVisibility(ETrue); + } //Create HG Grid, medialist observer, FS thumbnailcontext - iGlxGridViewContainer = CGlxGridViewContainer::NewL(iMediaList,iUiUtility,*this); + iGlxGridViewContainer = CGlxGridViewContainer::NewL(iMediaList,iUiUtility,*this,iToolbar); iEikonEnv->AppUi()->AddToStackL(*this,iGlxGridViewContainer); } @@ -179,7 +188,13 @@ } // Deregister active media list pointer iActiveMediaListRegistry->DeregisterActiveMediaList(iMediaList); - + if(iToolbar) + { + delete iToolbar; + iToolbar = NULL; + //set the gridtoolbar to NULL in viewbase. + SetGridToolBar(iToolbar); + } // Destroy Grid widget before going to next view DestroyGridWidget(); } @@ -205,7 +220,11 @@ { TRACER("CGlxGridViewImp::~CGlxGridViewImp"); delete iTitletext; - + if(iToolbar) + { + delete iToolbar; + iToolbar = NULL; + } if (iActiveMediaListRegistry) { iActiveMediaListRegistry->Close(); @@ -268,7 +287,7 @@ { TRACER("CGlxGridViewImp::HandleLatchToolbarL()"); CAknButton* markButton = static_cast - (Toolbar()->ControlOrNull( EGlxCmdStartMultipleMarking )); + (iToolbar->ControlOrNull( EGlxCmdStartMultipleMarking )); if(markButton) {