static int run(MythMediaDevice *dev = NULL, bool startRandomShow = false) { QDir startdir(gCoreContext->GetSetting("GalleryDir")); if (startdir.exists() && startdir.isReadable()) { MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack(); IconView *iconview = new IconView(mainStack, "mythgallery", startdir.absolutePath(), dev); if (iconview->Create()) { if (startRandomShow) { iconview->HandleRandomShow(); } else { mainStack->AddScreen(iconview); } return 0; } else delete iconview; } else { ShowOkPopup(QObject::tr("MythGallery cannot find its start directory." "\n%1\n" "Check the directory exists, is readable and " "the setting is correct on MythGallery's " "settings page.") .arg(startdir.absolutePath())); } return -1; }