Changeset 19438 for gli/trunk


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

Location:
gli/trunk/src/org/greenstone/gatherer/gui
Files:
2 edited

Legend:

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

    r19306 r19438  
    477477    }
    478478   
     479  // some cases we have already saved the collection, but don't want to
     480  // override the general.open_collection value here
     481  public void exitNoCollectionSave(int exit_status) {
     482    // Store the current position and size of the GLI for next time
     483    Configuration.setBounds("general.bounds", true, getBounds());
     484
     485    // Save configuration
     486    Configuration.save();
     487
     488    // Hide the main window
     489    setVisible(false);
     490
     491    // If we're running as an applet we don't quit here (we quit when the browser calls GathererApplet.destroy())
     492    if (!Gatherer.isApplet) {
     493        Gatherer.exit(exit_status);
     494    }
     495
     496  }
    479497    /** This method ensures that all the things needing saving are saved before Gatherer.exit() is called.
    480498     */
  • 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.