Ignore:
Timestamp:
2009-05-13T14:45:08+12:00 (15 years ago)
Author:
kjdon
Message:

If you change the language then the locale is set in the configuration, then when you come to save the collection config file, the worng locale is used, and you get the wrong language in the file for metadata anmes. So now we save the collection before setting the locale, but also need to call a new exit method in GUIManager so it doesn't overwrite our general.open_collection setting

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gli/trunk/src/org/greenstone/gatherer/gui/Preferences.java

    r19306 r19438  
    723723        // interface font, interface language, changed gliserver url or library url
    724724        boolean restart_required = false;
     725        boolean keep_collection_open = false;
    725726        String restart_message = "";
    726727
     
    743744            restart_required = true;
    744745            restart_message = Dictionary.get("Preferences.General.Manual_Restart_Required");
     746           
    745747        }
    746748        if(Gatherer.c_man.getCollection() != null) {
    747749            // if the gliserver url has changed while a collection is open,
    748750            // close the open collection of the old library URL
    749             Gatherer.c_man.saveCollection();
    750             Gatherer.c_man.closeCollection();
     751            Gatherer.g_man.saveThenCloseCurrentCollection();
    751752            Configuration.setString("general.open_collection"+Configuration.gliPropertyNameSuffix(), true, "");
    752753        }
     
    777778            // if the gliserver url has changed while a collection is open,
    778779            // close the open collection of the old gliserver URL
    779             Gatherer.c_man.saveCollection();
    780             Gatherer.c_man.closeCollection();
     780            Gatherer.g_man.saveThenCloseCurrentCollection();
    781781            Configuration.setString("general.open_collection"+Configuration.gliPropertyNameSuffix(), true, "");
    782782            }
     
    824824        restart_required = true;
    825825        restart_message = Dictionary.get("Preferences.General.Restart_Required");
     826
    826827        }
    827828
     
    829830        String current_lang = Configuration.getLanguage();
    830831        if (!current_lang.equals(((DictionaryEntry) language_combobox.getSelectedItem()).getLocale().getLanguage())) {
     832          // need to save the collection before changing the locale otherwise it stuffs the metadata names up
     833          if(Gatherer.c_man.getCollection() != null) {
     834          Configuration.setString("general.open_collection"+Configuration.gliPropertyNameSuffix(), true, Gatherer.c_man.getLoadedCollectionColFilePath());
     835          Gatherer.g_man.saveThenCloseCurrentCollection();
     836          keep_collection_open = true;
     837        }
     838
    831839        Configuration.setLocale("general.locale", Configuration.GENERAL_SETTING, ((DictionaryEntry) language_combobox.getSelectedItem()).getLocale());
    832840        restart_required = true;
     
    904912
    905913        if (restart_required) {
     914          if (keep_collection_open) {
     915        Gatherer.g_man.exitNoCollectionSave(Gatherer.EXIT_THEN_RESTART);
     916          } else {
    906917        Gatherer.g_man.exit(Gatherer.EXIT_THEN_RESTART);
     918          }
    907919        }
    908920    }
Note: See TracChangeset for help on using the changeset viewer.