SF.net SVN: mahogany: [7194] trunk/M

[email protected]
Newsgroups gmane.mail.mahogany.cvs
Message-ID <[email protected]>
Revision: 7194
          http://svn.sourceforge.net/mahogany/?rev=7194&view=rev
Author:   vadz
Date:     2006-12-25 12:05:39 -0800 (Mon, 25 Dec 2006)

Log Message:
-----------
close the currently opened folder if OnOpenHere(NULL) is called (as it may be when the open-on-single-click option is true) instead of asserting

Modified Paths:
--------------
    trunk/M/include/gui/wxMainFrame.h
    trunk/M/src/gui/wxMainFrame.cpp

Modified: trunk/M/include/gui/wxMainFrame.h
===================================================================
--- trunk/M/include/gui/wxMainFrame.h	2006-12-25 20:00:19 UTC (rev 7193)
+++ trunk/M/include/gui/wxMainFrame.h	2006-12-25 20:05:39 UTC (rev 7194)
@@ -53,8 +53,9 @@
    // multiple times) in read write (default) or read only mode
    bool OpenFolder(MFolder *folder, bool readonly = false);
 
-   // close the given folder if it is opened
-   void CloseFolder(MFolder *folder);
+   // close the given folder if it is opened or the currently opened one if
+   // folder is NULL
+   void CloseFolder(MFolder *folder = NULL);
 
    // add the folder menu to the menu bar
    void AddFolderMenu(void);

Modified: trunk/M/src/gui/wxMainFrame.cpp
===================================================================
--- trunk/M/src/gui/wxMainFrame.cpp	2006-12-25 20:00:19 UTC (rev 7193)
+++ trunk/M/src/gui/wxMainFrame.cpp	2006-12-25 20:05:39 UTC (rev 7194)
@@ -137,10 +137,12 @@
 
    virtual void OnOpenHere(MFolder *folder)
    {
-      CHECK_RET( folder, _T("can't open a NULL folder") );
-
-      if ( !m_frame->OpenFolder(folder) )
+      if ( !folder )
       {
+         m_frame->CloseFolder();
+      }
+      else if ( !m_frame->OpenFolder(folder) )
+      {
          // normally the base class version DecRef()s it but as we're going to
          // pass NULL to it, do it ourselves
          folder->DecRef();
@@ -684,7 +686,7 @@
 void
 wxMainFrame::CloseFolder(MFolder *folder)
 {
-   if ( folder && folder->GetFullName() == m_folderName )
+   if ( !folder || folder->GetFullName() == m_folderName )
    {
       m_FolderView->SetFolder(NULL);
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.