Changeset 25 for trunk/src/MainPter.cxx

Show
Ignore:
Timestamp:
04/11/06 11:16:59 (3 years ago)
Author:
jordi
Message:

It's now possible to cancel the open file dialog :-)

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/MainPter.cxx

    r24 r25  
    142142    IMainView &view = getView (); 
    143143    gchar *fileName = view.openFileDialog (); 
    144     GError *error; 
    145     if ( m_Document->loadFile (fileName, NULL, &error) ) 
     144    // if openFileDialog returns NULL, then the user cancelled the operation. 
     145    // I don't need to do anything in this case. I'm only interested when 
     146    // the user tried to open a file. 
     147    if ( NULL != fileName ) 
    146148    { 
    147         // Now that the document has been loaded, just reset the initial 
    148         // state. 
    149         setInitialState (); 
    150         g_free (fileName); 
     149        GError *error; 
     150        if ( m_Document->loadFile (fileName, NULL, &error) ) 
     151        { 
     152            // Now that the document has been loaded, just reset the initial 
     153            // state. 
     154            setInitialState (); 
     155            g_free (fileName); 
     156        } 
    151157    } 
    152158}