<commit_before>/*
 * FSpot.UI.Dialog.PreferenceDialog.cs
 *
 * Authors(s):
 *	<NAME>  <<EMAIL>>
 *	<NAME>  <<EMAIL>>
 *
 * Copyright (c) 2005-2009 Novell, Inc.
 * Copyright (c) 2007,2010 <NAME>
 *
 * This is free software. See COPYING for details.
 */

using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using Gtk;
using Mono.Unix;
using Hyena;

using FSpot.Widgets;

namespace FSpot.UI.Dialog {
	public class PreferenceDialog : BuilderDialog
	{
		[GtkBeans.Builder.Object] FileChooserButton photosdir_chooser;

		[GtkBeans.Builder.Object] RadioButton writemetadata_radio;
		[GtkBeans.Builder.Object] RadioButton dontwrite_radio;
		[GtkBeans.Builder.Object] CheckButton always_sidecar_check;

		[GtkBeans.Builder.Object] ComboBox theme_combo;
		[GtkBeans.Builder.Object] ComboBox screenprofile_combo;
		[GtkBeans.Builder.Object] ComboBox printprofile_combo;

#region public API (ctor)
		public PreferenceDialog (Window parent) : base ("PreferenceDialog.ui", "preference_dialog")
		{
			TransientFor = parent;

			//Photos Folder
			if (FSpot.Core.Global.PhotoUri == new SafeUri (Preferences.Get<string> (Preferences.STORAGE_PATH))) {
				photosdir_chooser.SetCurrentFolderUri (FSpot.Core.Global.PhotoUri);
				photosdir_chooser.CurrentFolderChanged += HandlePhotosdirChanged;
			} else {
				photosdir_chooser.SetCurrentFolderUri (FSpot.Core.Global.PhotoUri);
				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<commit_msg>Correctly decide when to make the library location sensitive<commit_after>/*
 * FSpot.UI.Dialog.PreferenceDialog.cs
 *
 * Authors(s):
 *	<NAME>  <<EMAIL>>
 *	<NAME>  <<EMAIL>>
 *
 * Copyright (c) 2005-2009 Novell, Inc.
 * Copyright (c) 2007,2010 <NAME>
 *
 * This is free software. See COPYING for details.
 */

using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using Gtk;
using Mono.Unix;
using Hyena;

using FSpot.Widgets;

namespace FSpot.UI.Dialog {
	public class PreferenceDialog : BuilderDialog
	{
		[GtkBeans.Builder.Object] FileChooserButton photosdir_chooser;

		[GtkBeans.Builder.Object] RadioButton writemetadata_radio;
		[GtkBeans.Builder.Object] RadioButton dontwrite_radio;
		[GtkBeans.Builder.Object] CheckButton always_sidecar_check;

		[GtkBeans.Builder.Object] ComboBox theme_combo;
		[GtkBeans.Builder.Object] ComboBox screenprofile_combo;
		[GtkBeans.Builder.Object] ComboBox printprofile_combo;

#region public API (ctor)
		public PreferenceDialog (Window parent) : base ("PreferenceDialog.ui", "preference_dialog")
		{
			TransientFor = parent;

			//Photos Folder
			photosdir_chooser.SetCurrentFolderUri (FSpot.Core.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.Core.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
{'fraction_non_alphanumeric': 0.10421657882127455, 'fraction_numerical': 0.009103977000479156, 'mean_word_length': 4.839160839160839, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5008510', 'n_tokens_mistral': 1526, 'n_tokens_neox': 1339, 'n_words': 314}