Changeset 94 for trunk/src/Config.cxx

Show
Ignore:
Timestamp:
04/20/06 06:29:18 (3 years ago)
Author:
jordi
Message:

When the main window is resized or moved, the current position and size is saved to the configuration values.

The configuration now is saved by main.cxx when the application quits correctly.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/Config.cxx

    r93 r94  
    197197 
    198198/// 
     199/// @brief Save the current configuration to a file. 
     200/// 
     201void 
     202Config::save () 
     203{ 
     204    gchar *contents = g_key_file_to_data (m_Values, NULL, NULL); 
     205    gchar *configFile = getConfigFileName (); 
     206    GError *error = NULL; 
     207    if ( !g_file_set_contents (configFile, contents, -1, &error) ) 
     208    { 
     209        g_warning ("Couldn't write configuration file: %s\n", error->message); 
     210        g_error_free (error); 
     211    } 
     212    g_free (contents); 
     213    g_free (configFile); 
     214} 
     215 
     216/// 
    199217/// @brief Saves the current window's size. 
    200218/// 
     
    255273    GList *dirs = NULL; 
    256274    gchar *dirName = g_strdup (path); 
    257     while ( !g_file_test (dirName, G_FILE_TEST_EXISTS) ); 
     275    while ( !g_file_test (dirName, G_FILE_TEST_EXISTS) ) 
    258276    { 
    259277        dirs = g_list_prepend (dirs, dirName); 
     
    263281    // Now create all of them. 
    264282    GList *dir = g_list_first (dirs); 
    265     while ( NULL != dir ); 
     283    while ( NULL != dir ) 
    266284    { 
    267285        if ( -1 == g_mkdir ((gchar *)dir->data, 0700) )