[tomboy] Drop dependency on gconf-sharp-peditors
- From: Sanford Armstrong <sharm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tomboy] Drop dependency on gconf-sharp-peditors
- Date: Thu, 16 Jun 2011 23:26:13 +0000 (UTC)
commit 515b26bfeed54020774262e1210f3c1364da40da
Author: Sandy Armstrong <sanfordarmstrong gmail com>
Date: Thu Jun 16 16:01:39 2011 -0700
Drop dependency on gconf-sharp-peditors
Copy in source for property editors that we actually use. Other
bits of that library were causing continued dependency on obsolete
libraries because of a gnome-sharp dependency.
https://bugzilla.gnome.org/show_bug.cgi?id=652787
Tomboy/GConf.PropertyEditors/PropertyEditor.cs | 96 ++++++++++++++++++++
Tomboy/GConf.PropertyEditors/PropertyEditorBool.cs | 50 ++++++++++
.../GConf.PropertyEditors/PropertyEditorEntry.cs | 51 +++++++++++
.../PropertyEditorToggleButton.cs | 49 ++++++++++
Tomboy/Makefile.am | 16 ++--
configure.in | 4 +-
6 files changed, 257 insertions(+), 9 deletions(-)
---
diff --git a/Tomboy/GConf.PropertyEditors/PropertyEditor.cs b/Tomboy/GConf.PropertyEditors/PropertyEditor.cs
new file mode 100644
index 0000000..51e57d9
--- /dev/null
+++ b/Tomboy/GConf.PropertyEditors/PropertyEditor.cs
@@ -0,0 +1,96 @@
+// PropertyEditor.cs -
+//
+// Author: Rachel Hestilow <hestilow nullenvoid com>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of version 2 of the Lesser GNU General
+// Public License as published by the Free Software Foundation.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this program; if not, write to the
+// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+// Boston, MA 02111-1307, USA.
+
+namespace GConf.PropertyEditors
+{
+ using Gtk;
+
+ public abstract class PropertyEditor
+ {
+ protected abstract void ValueChanged (object sender, NotifyEventArgs args);
+ protected abstract void ConnectHandlers ();
+
+ string key;
+ Client client;
+ ChangeSet cs;
+ Widget control;
+
+ public string Key
+ {
+ get { return key; }
+ }
+
+ public Widget Control
+ {
+ get { return control; }
+ }
+
+ protected object Get ()
+ {
+ ClientBase c = (cs != null) ? (ClientBase) cs : (ClientBase) client;
+ try {
+ return c.Get (key);
+ } catch (NoSuchKeyException e) {
+ }
+
+ if (cs != null)
+ {
+ try {
+ return client.Get (key);
+ } catch (NoSuchKeyException e) {
+ }
+ }
+
+ return null;
+ }
+
+ protected virtual void Set (object val)
+ {
+ ClientBase c = (cs != null) ? (ClientBase) cs : (ClientBase) client;
+ c.Set (key, val);
+ }
+
+ public virtual void Setup ()
+ {
+ if (client == null)
+ client = new Client ();
+
+ ValueChanged (client, new NotifyEventArgs (key, Get ()));
+ ConnectHandlers ();
+ client.AddNotify (key, new NotifyEventHandler (ValueChanged));
+ }
+
+ public Client Client
+ {
+ get { return client; }
+ set { client = value; }
+ }
+
+ public ChangeSet ChangeSet
+ {
+ get { return cs; }
+ set { cs = value; }
+ }
+
+ public PropertyEditor (string key, Widget control)
+ {
+ this.key = key;
+ this.control = control;
+ }
+ }
+}
diff --git a/Tomboy/GConf.PropertyEditors/PropertyEditorBool.cs b/Tomboy/GConf.PropertyEditors/PropertyEditorBool.cs
new file mode 100644
index 0000000..fa1164f
--- /dev/null
+++ b/Tomboy/GConf.PropertyEditors/PropertyEditorBool.cs
@@ -0,0 +1,50 @@
+// PropertyEditorBool.cs -
+//
+// Author: Rachel Hestilow <hestilow nullenvoid com>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of version 2 of the Lesser GNU General
+// Public License as published by the Free Software Foundation.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this program; if not, write to the
+// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+// Boston, MA 02111-1307, USA.
+
+
+namespace GConf.PropertyEditors
+{
+ using Gtk;
+ using System;
+ using System.Collections;
+
+ public abstract class PropertyEditorBool : PropertyEditor
+ {
+ ArrayList guards = new ArrayList ();
+
+ public void AddGuard (Widget control)
+ {
+ guards.Add (control);
+ control.Sensitive = (bool) Get ();
+ }
+
+ protected override void Set (object val)
+ {
+ bool val_bool = (bool) val;
+
+ foreach (Widget control in guards)
+ control.Sensitive = val_bool;
+
+ base.Set (val);
+ }
+
+ public PropertyEditorBool (string key, Widget control) : base (key, control)
+ {
+ }
+ }
+}
diff --git a/Tomboy/GConf.PropertyEditors/PropertyEditorEntry.cs b/Tomboy/GConf.PropertyEditors/PropertyEditorEntry.cs
new file mode 100644
index 0000000..ee93ad9
--- /dev/null
+++ b/Tomboy/GConf.PropertyEditors/PropertyEditorEntry.cs
@@ -0,0 +1,51 @@
+// PropertyEditorEntry.cs -
+//
+// Author: Rachel Hestilow <hestilow nullenvoid com>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of version 2 of the Lesser GNU General
+// Public License as published by the Free Software Foundation.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this program; if not, write to the
+// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+// Boston, MA 02111-1307, USA.
+
+namespace GConf.PropertyEditors
+{
+ using Gtk;
+ using System;
+
+ public class PropertyEditorEntry : PropertyEditor
+ {
+ protected override void ValueChanged (object sender, NotifyEventArgs args)
+ {
+ object val = args.Value;
+ if (val == null)
+ return;
+ Entry entry = (Entry) Control;
+ entry.Text = (string) val;
+ }
+
+ void Changed (object obj, EventArgs args)
+ {
+ Entry entry = (Entry) Control;
+ Set (entry.Text);
+ }
+
+ protected override void ConnectHandlers ()
+ {
+ Entry entry = (Entry) Control;
+ entry.Changed += new EventHandler (Changed);
+ }
+
+ public PropertyEditorEntry (string key, Entry entry) : base (key, entry)
+ {
+ }
+ }
+}
diff --git a/Tomboy/GConf.PropertyEditors/PropertyEditorToggleButton.cs b/Tomboy/GConf.PropertyEditors/PropertyEditorToggleButton.cs
new file mode 100644
index 0000000..ab8b5a3
--- /dev/null
+++ b/Tomboy/GConf.PropertyEditors/PropertyEditorToggleButton.cs
@@ -0,0 +1,49 @@
+// PropertyEditorToggleButton.cs -
+//
+// Author: Rachel Hestilow <hestilow nullenvoid com>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of version 2 of the Lesser GNU General
+// Public License as published by the Free Software Foundation.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this program; if not, write to the
+// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+// Boston, MA 02111-1307, USA.
+
+namespace GConf.PropertyEditors
+{
+ using Gtk;
+ using System;
+
+ public class PropertyEditorToggleButton : PropertyEditorBool
+ {
+ protected override void ValueChanged (object sender, NotifyEventArgs args)
+ {
+ object val = args.Value;
+ ToggleButton checkbox = (ToggleButton) Control;
+ checkbox.Active = (bool) val;
+ }
+
+ void Toggled (object obj, EventArgs args)
+ {
+ ToggleButton checkbox = (ToggleButton) Control;
+ Set (checkbox.Active);
+ }
+
+ protected override void ConnectHandlers ()
+ {
+ ToggleButton checkbox = (ToggleButton) Control;
+ checkbox.Toggled += new EventHandler (Toggled);
+ }
+
+ public PropertyEditorToggleButton (string key, ToggleButton checkbox) : base (key, checkbox)
+ {
+ }
+ }
+}
diff --git a/Tomboy/Makefile.am b/Tomboy/Makefile.am
index bdc7fb3..b1458ce 100644
--- a/Tomboy/Makefile.am
+++ b/Tomboy/Makefile.am
@@ -44,12 +44,16 @@ endif
PANELAPPLET_CSFILES = \
$(srcdir)/Applet.cs
-GNOME_CSFILES = \
- $(srcdir)/GConfPreferencesClient.cs \
- $(srcdir)/GnomeApplication.cs \
- $(srcdir)/GnomeFactory.cs \
- $(srcdir)/GnomeSession.cs \
- $(srcdir)/XKeybinder.cs \
+GNOME_CSFILES = \
+ $(srcdir)/GConf.PropertyEditors/PropertyEditor.cs \
+ $(srcdir)/GConf.PropertyEditors/PropertyEditorBool.cs \
+ $(srcdir)/GConf.PropertyEditors/PropertyEditorEntry.cs \
+ $(srcdir)/GConf.PropertyEditors/PropertyEditorToggleButton.cs \
+ $(srcdir)/GConfPreferencesClient.cs \
+ $(srcdir)/GnomeApplication.cs \
+ $(srcdir)/GnomeFactory.cs \
+ $(srcdir)/GnomeSession.cs \
+ $(srcdir)/XKeybinder.cs \
$(srcdir)/gtk-sharp-beans/*.cs
if ENABLE_PANEL_APPLET
diff --git a/configure.in b/configure.in
index 682e2d9..a03a402 100644
--- a/configure.in
+++ b/configure.in
@@ -192,12 +192,10 @@ if test "x$ENABLE_GNOME" != "xno"; then
PKG_CHECK_MODULES(GNOME,
gnome-sharp-2.0 >= $GNOMESHARP_MINIMUM_VERSION
gconf-sharp-2.0
- gconf-sharp-peditors-2.0
gnome-panel-sharp-2.24)
else
PKG_CHECK_MODULES(GNOME,
- gconf-sharp-2.0
- gconf-sharp-peditors-2.0)
+ gconf-sharp-2.0)
fi
fi
AC_SUBST(GNOME_LIBS)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]