public OfficeConfig(IConfigBackendFactory configDocFactory)
        {
            IConfigBackend configDoc = null;

            try
            {
                configDoc = configDocFactory.OpenConfig();
                PreprocessPreferences(configDoc.ReadPreferences());
            }
            finally
            {
                configDoc?.Close();
            }
        }
Example #2
0
        public Config()
        {
            try {
                settings = new ConfigBackendGSettings();
            } catch (ConfigBackendUnavailableException) {
                Logger.Error("Unable to initialize the GSettings configuration. This means the schema was not properly installed "
                             + "in this distro and the gnome-subtitles package should be fixed. This is ok if you're trying the application without "
                             + "installing it, for example in a development branch.");
            } catch (Exception e) {
                Logger.Error(e, "Unable to initialize the GSettings config backend. Reverting to an in-memory backend (no settings will be saved!).");
            }

            if (settings == null)
            {
                Logger.Error("Reverting to an in-memory configuration backend. No settings will be persisted when the application closes.");
                settings = new ConfigBackendInMemory();
            }
        }