/// <summary> /// Loads the preferences from disk, setting their values in the UI. /// </summary> private void LoadPreferences() { foreach (string gamePath in GamePathStorage.Instance.GamePaths) { if (Directory.Exists(gamePath)) { this.GamePathListStore.AppendValues(gamePath); } } ViewportColourButton.Rgba = Config.GetViewportBackgroundColour(); if (!String.IsNullOrEmpty(Config.GetDefaultExportDirectory())) { DefaultExportDirectoryFileChooserButton.SetCurrentFolderUri(Config.GetDefaultExportDirectory()); } DefaultModelExportFormatComboBox.Active = (int)Config.GetDefaultModelFormat(); DefaultImageExportFormatComboBox.Active = (int)Config.GetDefaultImageFormat(); DefaultAudioExportFormatComboBox.Active = (int)Config.GetDefaultAudioFormat(); KeepDirectoryStructureCheckButton.Active = Config.GetShouldKeepFileDirectoryStructure(); SendStatsCheckButton.Active = Config.GetAllowSendAnonymousStats(); }
#pragma warning restore 649 #region public API (ctor) public PreferenceDialog(Window parent) : base("PreferenceDialog.ui", "preference_dialog") { TransientFor = parent; //Photos Folder photosdir_chooser.SetCurrentFolderUri(FSpot.Settings.Global.PhotoUri); SafeUri storage_path = new SafeUri(Preferences.Get <string> (Preferences.STORAGE_PATH)); //If the user has set a photo directory on the commandline then don't let it be changed in Preferences if (storage_path.Equals(FSpot.Settings.Global.PhotoUri)) { photosdir_chooser.CurrentFolderChanged += HandlePhotosdirChanged; } else { photosdir_chooser.Sensitive = false; } //Write Metadata LoadPreference(Preferences.METADATA_EMBED_IN_IMAGE); LoadPreference(Preferences.METADATA_ALWAYS_USE_SIDECAR); //Screen profile ListStore sprofiles = new ListStore(typeof(string), typeof(int)); sprofiles.AppendValues(Catalog.GetString("None"), 0); if (FSpot.ColorManagement.XProfile != null) { sprofiles.AppendValues(Catalog.GetString("System profile"), -1); } sprofiles.AppendValues(null, 0); //Pick the display profiles from the full list, avoid _x_profile_ var dprofs = from profile in FSpot.ColorManagement.Profiles where (profile.Value.DeviceClass == Cms.IccProfileClass.Display && profile.Key != "_x_profile_") select profile; foreach (var p in dprofs) { sprofiles.AppendValues(p.Key, 1); } CellRendererText profilecellrenderer = new CellRendererText(); profilecellrenderer.Ellipsize = Pango.EllipsizeMode.End; screenprofile_combo.Model = sprofiles; screenprofile_combo.PackStart(profilecellrenderer, true); screenprofile_combo.RowSeparatorFunc = ProfileSeparatorFunc; screenprofile_combo.SetCellDataFunc(profilecellrenderer, ProfileCellFunc); LoadPreference(Preferences.COLOR_MANAGEMENT_DISPLAY_PROFILE); //Print profile ListStore pprofiles = new ListStore(typeof(string), typeof(int)); pprofiles.AppendValues(Catalog.GetString("None"), 0); pprofiles.AppendValues(null, 0); var pprofs = from profile in FSpot.ColorManagement.Profiles where (profile.Value.DeviceClass == Cms.IccProfileClass.Output && profile.Key != "_x_profile_") select profile; foreach (var p in pprofs) { pprofiles.AppendValues(p.Key, 1); } printprofile_combo.Model = pprofiles; printprofile_combo.PackStart(profilecellrenderer, true); printprofile_combo.RowSeparatorFunc = ProfileSeparatorFunc; printprofile_combo.SetCellDataFunc(profilecellrenderer, ProfileCellFunc); LoadPreference(Preferences.COLOR_MANAGEMENT_OUTPUT_PROFILE); //Theme chooser ListStore themes = new ListStore(typeof(string), typeof(string)); themes.AppendValues(Catalog.GetString("Standard theme"), null); themes.AppendValues(null, null); //Separator string gtkrc = System.IO.Path.Combine("gtk-2.0", "gtkrc"); string [] search = { System.IO.Path.Combine(FSpot.Settings.Global.HomeDirectory, ".themes"), "/usr/share/themes" }; foreach (string path in search) { if (Directory.Exists(path)) { foreach (string dir in Directory.GetDirectories(path)) { if (File.Exists(System.IO.Path.Combine(dir, gtkrc))) { themes.AppendValues(System.IO.Path.GetFileName(dir), System.IO.Path.Combine(dir, gtkrc)); } } } } CellRenderer themecellrenderer = new CellRendererText(); theme_combo.Model = themes; theme_combo.PackStart(themecellrenderer, true); theme_combo.RowSeparatorFunc = ThemeSeparatorFunc; theme_combo.SetCellDataFunc(themecellrenderer, ThemeCellFunc); LoadPreference(Preferences.GTK_RC); ConnectEvents(); }