From 52d6131cc2b05aad73a5627e3b19ffced62615cf Mon Sep 17 00:00:00 2001
From: Bertrand Bellenot <Bertrand.Bellenot@cern.ch>
Date: Wed, 23 Jun 2010 09:33:26 +0000
Subject: [PATCH] Go to the "ROOT Files" folder only if a file has been
 selected in the File Open dialog

git-svn-id: http://root.cern.ch/svn/root/trunk@34075 27541ba8-7e3a-0410-8455-c3a389f83636
---
 gui/gui/src/TRootBrowser.cxx | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/gui/gui/src/TRootBrowser.cxx b/gui/gui/src/TRootBrowser.cxx
index 676ce0e74d3..f41bb5eec0a 100644
--- a/gui/gui/src/TRootBrowser.cxx
+++ b/gui/gui/src/TRootBrowser.cxx
@@ -633,6 +633,7 @@ void TRootBrowser::HandleMenu(Int_t id)
          break;
       case kOpenFile:
          {
+            Bool_t newfile = kFALSE;
             static TString dir(".");
             TGFileInfo fi;
             fi.fFileTypes = gOpenFileTypes;
@@ -647,12 +648,14 @@ void TRootBrowser::HandleMenu(Int_t id)
                   gROOT->ProcessLine(Form("new TFile(\"%s\");",
                                      gSystem->UnixPathName(el->GetString())));
                }
+               newfile = kTRUE;
             }
             else if (fi.fFilename) {
                gROOT->ProcessLine(Form("new TFile(\"%s\");",
                                   gSystem->UnixPathName(fi.fFilename)));
+               newfile = kTRUE;
             }
-            if (fActBrowser) {
+            if (fActBrowser && newfile) {
                TGFileBrowser *fb = dynamic_cast<TGFileBrowser *>(fActBrowser);
                if (fb) fb->Selected(0);
             }
-- 
GitLab