Revision: 7387
          http://mahogany.svn.sourceforge.net/mahogany/?rev=7387&view=rev
Author:   vadz
Date:     2007-11-15 06:43:17 -0800 (Thu, 15 Nov 2007)

Log Message:
-----------
write the new folder profile to the user source selected by user

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

Modified: trunk/M/include/gui/wxDialogLayout.h
===================================================================
--- trunk/M/include/gui/wxDialogLayout.h        2007-11-15 14:35:19 UTC (rev 
7386)
+++ trunk/M/include/gui/wxDialogLayout.h        2007-11-15 14:43:17 UTC (rev 
7387)
@@ -280,6 +280,12 @@
       m_btnApply->Enable(FALSE);
    }
 
+   // call this after creating a new profile (as is done by the folder creation
+   // dialog which only creates the profile when the folder itself is being
+   // created) to ensure that changes to it are written to the config source
+   // selected by the user
+   void ApplyConfigSourceSelectedByUser(Profile& profile);
+
    // the helper for the handlers of Apply/Ok buttons, returns TRUE if the
    // changes were accepted
    bool DoApply();

Modified: trunk/M/src/gui/wxDialogLayout.cpp
===================================================================
--- trunk/M/src/gui/wxDialogLayout.cpp  2007-11-15 14:35:19 UTC (rev 7386)
+++ trunk/M/src/gui/wxDialogLayout.cpp  2007-11-15 14:43:17 UTC (rev 7387)
@@ -1499,6 +1499,17 @@
       return;
    }
 
+   Profile_obj profile(GetProfile());
+   if ( profile )
+   {
+      ApplyConfigSourceSelectedByUser(*profile);
+   }
+   //else: this can happen when we're creating a new folder, its profile isn't
+   //      created before the folder itself is
+}
+
+void wxOptionsEditDialog::ApplyConfigSourceSelectedByUser(Profile& profile)
+{
    const int sel = m_chcSources->GetSelection();
    ConfigSource *config = NULL;
    if ( sel != -1 )
@@ -1511,11 +1522,8 @@
       config = i.operator->();
    }
 
-   Profile_obj profile(GetProfile());
-   wxCHECK_RET( profile, _T("no profile in wxOptionsEditDialog?") );
+   ConfigSource *configOld = profile.SetConfigSourceForWriting(config);
 
-   ConfigSource *configOld = profile->SetConfigSourceForWriting(config);
-
    // remember the original config source if this is the first time we change
    // it
    if ( !m_changedConfigSource )

Modified: trunk/M/src/gui/wxMFolderDialogs.cpp
===================================================================
--- trunk/M/src/gui/wxMFolderDialogs.cpp        2007-11-15 14:35:19 UTC (rev 
7386)
+++ trunk/M/src/gui/wxMFolderDialogs.cpp        2007-11-15 14:43:17 UTC (rev 
7387)
@@ -782,7 +782,9 @@
       // tell the other pages that we now have a folder (and hence a profile)
       String folderName = m_newFolder->GetFullName();
       m_profile = Profile::CreateProfile(folderName);
+      CHECK( m_profile, NULL, "failed to create profile for new folder" );
 
+      ApplyConfigSourceSelectedByUser(*m_profile);
       SetPagesProfile(m_profile);
    }
 


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

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Mahogany-cvsupdates mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates

Reply via email to