1
// ColorConfigurationWidget.cs
3
// Copyright (C) 2008 GNOME Do
5
// This program is free software: you can redistribute it and/or modify
6
// it under the terms of the GNU General Public License as published by
7
// the Free Software Foundation, either version 3 of the License, or
8
// (at your option) any later version.
10
// This program is distributed in the hope that it will be useful,
11
// but WITHOUT ANY WARRANTY; without even the implied warranty of
12
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
// GNU General Public License for more details.
15
// You should have received a copy of the GNU General Public License
16
// along with this program. If not, see <http://www.gnu.org/licenses/>.
21
using System.Collections.Generic;
27
using Do.Platform.Linux;
29
using Do.Interface.CairoUtils;
30
using Do.Interface.AnimationBase;
34
public partial class ColorConfigurationWidget : Gtk.Bin, IConfigurable
38
//TODO Make this an automatic property once mono 1.9 support is dropped
40
get { return themes; }
41
set { themes = value; }
44
public ColorConfigurationWidget ()
48
Themes = new List<string> ();
49
Interface.Util.Appearance.SetColormap (this);
51
foreach (InterfaceDescription theme in InterfaceManager.GetInterfaceDescriptions ()) {
52
theme_combo.AppendText (theme.Name);
53
Themes.Add (theme.Name);
56
if (!Screen.IsComposited) {
57
composite_warning_widget.Visible = true;
58
theme_combo.Sensitive = false;
62
theme_combo.Active = Math.Max (0, Themes.IndexOf (Do.Preferences.Theme));
63
pin_check.Active = Do.Preferences.AlwaysShowResults;
65
theme_configuration_container.ShowAll ();
68
public Gtk.Bin GetConfiguration ()
73
protected virtual void OnPinCheckClicked (object sender, System.EventArgs e)
75
Do.Preferences.AlwaysShowResults = pin_check.Active;
78
protected virtual void OnThemeComboChanged (object sender, System.EventArgs e)
80
Do.Preferences.Theme = Themes[theme_combo.Active];
81
SetupConfigurationWidget ();
84
void SetupConfigurationWidget ()
86
if (theme_configuration_container.Child != null)
87
theme_configuration_container.Remove (theme_configuration_container.Child);
89
if (Do.Controller.Window is IConfigurable) {
90
IConfigurable window = Do.Controller.Window as IConfigurable;
91
Gtk.Bin bin = window.GetConfiguration ();
92
theme_configuration_container.Add (bin);
94
theme_configuration_container.ShowAll ();
97
protected virtual void OnCompositeWarningInfoBtnClicked (object sender, System.EventArgs e)
101
public new string Name {
102
get { return Catalog.GetString ("Appearance"); }
105
public string Description {
113
public override void Dispose ()
115
if (theme_configuration_container.Child != null)
116
theme_configuration_container.Child.Dispose ();