Do

Merge lp:~cszikszoy/do/config-MA-ext into lp:do

Proposed by Chris S.
Status: Rejected
Rejected by: Alex Launi
Proposed branch: lp:~cszikszoy/do/config-MA-ext
Merge into: lp:do
Diff against target: None lines
To merge this branch: bzr merge lp:~cszikszoy/do/config-MA-ext
Reviewer Review Type Date Requested Status
Alex Launi (community) Approve
Robert Dyer (community) Needs Fixing
Review via email: mp+7700@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Chris S. (cszikszoy) wrote :

Makes config widgets a MA extension, namely "/Do/Config". IConfigurable is altered slightly, and Plugin manifests must be changed to reflect this change.

Please see plugin merge request that tracks the changes in core that this would make:
https://code.edge.launchpad.net/~cszikszoy/do-plugins/MA-Config-Extension/+merge/7701

Revision history for this message
Chris Halse Rogers (raof) wrote :

What are the benefits here? I presume this makes it easier for plugins to provide environment-specific configuration pages, but it'd be nice to have it spelled out :)

Revision history for this message
Robert Dyer (psybers) wrote :

One good use case for this: Docklets. Right now, if a docklet wants to have a config page it needs to also provide an ItemSource (as Weather is doing). We could extend to look for IConfigurable on docklets, but this solution is much more robust.

Revision history for this message
Chris S. (cszikszoy) wrote :

Aside from what Robert already stated, there is a benefit here for plugins that want more than one config page, but only have one ItemSource or Action. A good example of this is the Flickr plugin. This plugin consists of only a single Action, yet an entirely empty ItemSource was also made for the sole purpose of implementing IConfigurable in order to have two config pages.

Also, as you stated, Do.Platform.* can now provide an extension point for configurables. Say we decide to move away from GTK and do everything in an environment-specific gui toolkit. Do.Platform.Windows provides an extension point: Config. Addins can specify what their dependency is, either Platform.Linux, Platform.Windows etc.

Revision history for this message
Alex Launi (alexlauni) wrote :

Yeah, this happens in a few plugins as well. This is a patch I've been
meaning to write for a year. thanks chris

--
--Alex Launi

Revision history for this message
Robert Dyer (psybers) wrote :

All line #s refer to the merge diff.

1. Line 95, too many tabs I believe

2. Line 92, you should lift 'Addin.GetIdName (id)' out of the LINQ statement as it only needs evaluated once (the compiler probably is smart enough to figure this out on its own, but it also makes the code easier to read)

3. Also, can we not just match on the ID? Why are we matching on names?

4. Why are we calling notebook.RemovePage(i) in OnBtnCloseClicked now? Is the window re-used somewhere (that's the only reason I can see for removing the pages, since the Build() will just create a new notebook each time a new Window is created).

review: Needs Fixing
Revision history for this message
Chris S. (cszikszoy) wrote :

> 1. Line 95, too many tabs I believe
 - fixed
> 2. Line 92, you should lift 'Addin.GetIdName (id)' out of the LINQ statement
> as it only needs evaluated once (the compiler probably is smart enough to
> figure this out on its own, but it also makes the code easier to read)
 - See next comment
> 3. Also, can we not just match on the ID? Why are we matching on names?
 - This might not make sense, but here goes: M.A. is strange. Let's start with this. This method (ConfigurablesForAddin (string id) gets the id from the PluginNodeView. Behind the scenes there, PluginNodeView strips away some of the name of the plugin ID, so, when I'm looking at say the Files plugin, this method gets given this for the id: "Do.File,2.5", but Addin.GetIdName ("Do.File,2.5") returns "Do.File"

So, that LINQ query returns a set of TypeExtensionNodes, but n.addin.id will return "Do.File".

Long story short, maybe id is a bad variable name, because the "id" coming from another place, isn't what the M.A. "id" really is. Either way, I just copied that comparrison code from somewhere else in that file (line 281 of PluginManager.cs). After experimenting a bit, I found that you can actually compare with ".Where (n => n.Addin.Id == Addin.GetIdName (id))", so I've reduced it to that. And, I've also updated the old code (line 281) to reflect this change as well.

> 4. Why are we calling notebook.RemovePage(i) in OnBtnCloseClicked now? Is the
> window re-used somewhere (that's the only reason I can see for removing the
> pages, since the Build() will just create a new notebook each time a new
> Window is created).
As for this... I honestly have no idea what's going on here. All I know is that if you remove these lines Do blows up hard (in native code) when you open a plugin's preferences window twice. The only thing I found relevant was that the notebook.Add () method is actually taking a reference to the widgets or notebook pages. Something about how I'm grabbing the IConfigurable classes must be creating those classes in memory, and then they get added fine the first time, but on the 2nd time there's a nasty GTK error saying you can't set the parent of a widget that already has a parent. My thinking is that notebook.Add the 2nd time is still referring to those original widgets that got created the first time but still exist somewhere in managed memory. When you try to add those widgets to the notebook, GTK tries to set the parent for those widgets a 2nd time and Do blows up here. I don't know if I'm just rambling at this point or if that actually made any sense. But again, I have no idea why that's happening, but that's my best guess. Feel free to remove those lines and see for yourself, or if you have any ideas or suggestions that would be helpful too.

lp:~cszikszoy/do/config-MA-ext updated
1238. By Chris S.

LINQ query & indentation fixes as per review

1239. By Chris S.

change extension point to /Do/Configuration

1240. By Chris S.

add FIXME comment

1241. By Chris S.

lift statement out of loops

Revision history for this message
Alex Launi (alexlauni) wrote :

Looks pretty good to me, just a couple of things I noticed
line 91 (of the diff) Gets an IEnumerable and then loops over it, you can probably do this whole thing with a single linq statement and then return the IEnumerable LINQ gives you. I think it'd be cleaner and possibly a small bit faster.

Also, this means we need to update the plugins, I'd like an approved plugins merge before we merge this one.

review: Needs Fixing
lp:~cszikszoy/do/config-MA-ext updated
1242. By Chris S.

merge w/ trunk

Revision history for this message
Alex Launi (alexlauni) wrote :

PluginManager.cs: ObjectsForAddin<T>, you made a string idName var; put it back the way it was, you only use it once there's no point in assigning it way ahead of time. Also, maybe we should define ExtensionPaths as a Dictionary, so that in the class we can refer to the paths with human names instead of hardcoding the paths in a bunch of places?

Other than that, looks good. +1

review: Approve
Revision history for this message
Robert Dyer (psybers) wrote :

I still won't approve until we have a merge request fixing do-plugins.

Revision history for this message
Alex Launi (alexlauni) wrote :

I will approve, I just won't merge.

--
-- Alex Launi

Revision history for this message
Chris Halse Rogers (raof) wrote :

Is there any particular reason why this hasn't got merged? It still seems like something that's reasonable to have, even if it might get somewhat reworked by 0.9.

Revision history for this message
Alex Launi (alexlauni) wrote :

I think plugins were why this never got merged, but I dont remember

On Fri, Apr 2, 2010 at 3:35 AM, Chris Halse Rogers <email address hidden> wrote:

> Is there any particular reason why this hasn't got merged? It still seems
> like something that's reasonable to have, even if it might get somewhat
> reworked by 0.9.
> --
> https://code.edge.launchpad.net/~cszikszoy/do/config-MA-ext/+merge/7700
> You are reviewing the proposed merge of lp:~cszikszoy/do/config-MA-ext into
> lp:do.
>

--
--Alex Launi

Unmerged revisions

1242. By Chris S.

merge w/ trunk

1241. By Chris S.

lift statement out of loops

1240. By Chris S.

add FIXME comment

1239. By Chris S.

change extension point to /Do/Configuration

1238. By Chris S.

LINQ query & indentation fixes as per review

1237. By Chris S.

remove MA requirement for Do.Universe

1236. By Chris S.

merge trunk

1235. By Chris S.

more fixes

1234. By Chris S.

remove property

1233. By Chris S.

fix crash when opening preference window twice

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'Do.Platform.Linux/Resources/Do.Platform.Linux.addin.xml'
--- Do.Platform.Linux/Resources/Do.Platform.Linux.addin.xml 2009-06-10 05:30:30 +0000
+++ Do.Platform.Linux/Resources/Do.Platform.Linux.addin.xml 2009-06-20 02:35:45 +0000
@@ -32,4 +32,8 @@
32 <Service type="Do.Platform.Linux.GnomeKeyringSecurePreferencesService" />32 <Service type="Do.Platform.Linux.GnomeKeyringSecurePreferencesService" />
33 </Extension>33 </Extension>
34 34
35 <ExtensionPoint path="/Do/Config">
36 <ExtensionNode name="Config" objectType="Do.Platform.Linux.IConfigurable"/>
37 </ExtensionPoint>
38
35</Addin>39</Addin>
3640
=== modified file 'Do.Platform.Linux/gtk-gui/gui.stetic'
--- Do.Platform.Linux/gtk-gui/gui.stetic 2009-05-29 10:26:49 +0000
+++ Do.Platform.Linux/gtk-gui/gui.stetic 2009-06-19 20:22:55 +0000
@@ -7,7 +7,6 @@
7 <import>7 <import>
8 <widget-library name="gnomedesktop-sharp, Version=2.20.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />8 <widget-library name="gnomedesktop-sharp, Version=2.20.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
9 <widget-library name="notify-sharp, Version=0.4.0.0, Culture=neutral, PublicKeyToken=2df29c54e245917a" />9 <widget-library name="notify-sharp, Version=0.4.0.0, Culture=neutral, PublicKeyToken=2df29c54e245917a" />
10 <widget-library name="../../Do.Interface.Linux/bin/Debug/Do.Interface.Linux.dll" />
11 <widget-library name="gnome-sharp, Version=2.24.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />10 <widget-library name="gnome-sharp, Version=2.24.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
12 <widget-library name="../bin/Debug/Do.Platform.Linux.dll" internal="true" />11 <widget-library name="../bin/Debug/Do.Platform.Linux.dll" internal="true" />
13 </import>12 </import>
1413
=== modified file 'Do.Platform.Linux/src/Do.Platform/Do.Platform.Linux/IConfigurable.cs'
--- Do.Platform.Linux/src/Do.Platform/Do.Platform.Linux/IConfigurable.cs 2008-12-21 23:10:16 +0000
+++ Do.Platform.Linux/src/Do.Platform/Do.Platform.Linux/IConfigurable.cs 2009-06-19 02:19:46 +0000
@@ -25,10 +25,7 @@
25{25{
26 public interface IConfigurable26 public interface IConfigurable
27 {27 {
28 string Name { get; }28 string Title { get; }
29 string Description { get; }29 Bin GetConfiguration ();
30 string Icon { get; }
31
32 Bin GetConfiguration ();
33 }30 }
34}31}
3532
=== modified file 'Do/gtk-gui/objects.xml'
--- Do/gtk-gui/objects.xml 2009-06-06 18:05:52 +0000
+++ Do/gtk-gui/objects.xml 2009-06-19 02:19:46 +0000
@@ -1,12 +1,13 @@
1<objects attr-sync="on">1<objects attr-sync="on">
2 <object type="Do.UI.GeneralPreferencesWidget" palette-category="Do" allow-children="false" base-type="Gtk.Bin">
3 <itemgroups>
4 </itemgroups>
5 <signals />
6 </object>
2 <object type="Do.UI.KeybindingsPreferencesWidget" palette-category="Do" allow-children="false" base-type="Gtk.Bin">7 <object type="Do.UI.KeybindingsPreferencesWidget" palette-category="Do" allow-children="false" base-type="Gtk.Bin">
3 <itemgroups />8 <itemgroups />
4 <signals />9 <signals />
5 </object>10 </object>
6 <object type="Do.UI.GeneralPreferencesWidget" palette-category="Do" allow-children="false" base-type="Gtk.Bin">
7 <itemgroups />
8 <signals />
9 </object>
10 <object type="Do.UI.ManagePluginsPreferencesWidget" palette-category="Do" allow-children="false" base-type="Gtk.Bin">11 <object type="Do.UI.ManagePluginsPreferencesWidget" palette-category="Do" allow-children="false" base-type="Gtk.Bin">
11 <itemgroups />12 <itemgroups />
12 <signals />13 <signals />
1314
=== modified file 'Do/src/Do.Core/PluginManager.cs'
--- Do/src/Do.Core/PluginManager.cs 2009-06-05 19:45:45 +0000
+++ Do/src/Do.Core/PluginManager.cs 2009-06-20 02:35:37 +0000
@@ -46,7 +46,7 @@
46 {46 {
47 const string DefaultPluginIcon = "folder_tar";47 const string DefaultPluginIcon = "folder_tar";
48 48
49 static IEnumerable<string> ExtensionPaths = new [] { "/Do/ItemSource", "/Do/Action" };49 static IEnumerable<string> ExtensionPaths = new [] { "/Do/ItemSource", "/Do/Action", "/Do/Config" };
5050
51 public static readonly IEnumerable<AddinClassifier> Classifiers =51 public static readonly IEnumerable<AddinClassifier> Classifiers =
52 new AddinClassifier [] {52 new AddinClassifier [] {
@@ -80,7 +80,7 @@
80 // Initialize services before addins that may use them are loaded.80 // Initialize services before addins that may use them are loaded.
81 Services.Initialize ();81 Services.Initialize ();
82 InterfaceManager.Initialize ();82 InterfaceManager.Initialize ();
83 83
84 // Now allow loading of non-services.84 // Now allow loading of non-services.
85 foreach (string path in ExtensionPaths)85 foreach (string path in ExtensionPaths)
86 AddinManager.AddExtensionNodeHandler (path, OnPluginChanged);86 AddinManager.AddExtensionNodeHandler (path, OnPluginChanged);
@@ -297,12 +297,19 @@
297 /// </returns>297 /// </returns>
298 public static IEnumerable<IConfigurable> ConfigurablesForAddin (string id)298 public static IEnumerable<IConfigurable> ConfigurablesForAddin (string id)
299 {299 {
300 return ObjectsForAddin<IConfigurable> (id);300 IEnumerable<TypeExtensionNode> configs = AddinManager.GetExtensionNodes ("/Do/Config")
301 .OfType <TypeExtensionNode> ().Where (n => Addin.GetIdName (n.Addin.Id) == Addin.GetIdName (id));
302
303 foreach (TypeExtensionNode page in configs) {
304 yield return page.GetInstance () as IConfigurable;
305 }
306
307 yield break;
301 }308 }
302 309
303 static string AddinIdWithoutVersion (string id)310 static string AddinIdWithoutVersion (string id)
304 {311 {
305 return id.Substring (0, id.IndexOf (','));312 return id.Substring (0, id.IndexOf (','));
306 }313 }
307 }314 }
308}315}
309\ No newline at end of file316\ No newline at end of file
310317
=== modified file 'Do/src/Do.UI/ColorConfigurationWidget.cs'
--- Do/src/Do.UI/ColorConfigurationWidget.cs 2009-04-21 02:15:39 +0000
+++ Do/src/Do.UI/ColorConfigurationWidget.cs 2009-06-19 02:19:46 +0000
@@ -44,6 +44,7 @@
44 public ColorConfigurationWidget ()44 public ColorConfigurationWidget ()
45 {45 {
46 Build ();46 Build ();
47
47 AppPaintable = true;48 AppPaintable = true;
48 Themes = new List<string> ();49 Themes = new List<string> ();
49 Interface.Util.Appearance.SetColormap (this);50 Interface.Util.Appearance.SetColormap (this);
@@ -57,7 +58,6 @@
57 composite_warning_widget.Visible = true;58 composite_warning_widget.Visible = true;
58 theme_combo.Sensitive = false;59 theme_combo.Sensitive = false;
59 }60 }
60
61 // Setup theme combo61 // Setup theme combo
62 theme_combo.Active = Math.Max (0, Themes.IndexOf (Do.Preferences.Theme));62 theme_combo.Active = Math.Max (0, Themes.IndexOf (Do.Preferences.Theme));
63 pin_check.Active = Do.Preferences.AlwaysShowResults;63 pin_check.Active = Do.Preferences.AlwaysShowResults;
@@ -65,6 +65,10 @@
65 theme_configuration_container.ShowAll ();65 theme_configuration_container.ShowAll ();
66 }66 }
67 67
68 public string Title {
69 get { return Catalog.GetString ("Appearance"); }
70 }
71
68 public Gtk.Bin GetConfiguration ()72 public Gtk.Bin GetConfiguration ()
69 {73 {
70 return this;74 return this;
@@ -86,11 +90,13 @@
86 if (theme_configuration_container.Child != null)90 if (theme_configuration_container.Child != null)
87 theme_configuration_container.Remove (theme_configuration_container.Child);91 theme_configuration_container.Remove (theme_configuration_container.Child);
88 92
93
89 if (Do.Controller.Window is IConfigurable) {94 if (Do.Controller.Window is IConfigurable) {
90 IConfigurable window = Do.Controller.Window as IConfigurable;95 IConfigurable window = Do.Controller.Window as IConfigurable;
91 Gtk.Bin bin = window.GetConfiguration ();96 Gtk.Bin bin = window.GetConfiguration ();
92 theme_configuration_container.Add (bin);97 theme_configuration_container.Add (bin);
93 }98 }
99
94 theme_configuration_container.ShowAll ();100 theme_configuration_container.ShowAll ();
95 }101 }
96102
@@ -98,18 +104,6 @@
98 {104 {
99 }105 }
100 106
101 public new string Name {
102 get { return Catalog.GetString ("Appearance"); }
103 }
104
105 public string Description {
106 get { return ""; }
107 }
108
109 public string Icon {
110 get { return ""; }
111 }
112
113 public override void Dispose ()107 public override void Dispose ()
114 {108 {
115 if (theme_configuration_container.Child != null)109 if (theme_configuration_container.Child != null)
116110
=== modified file 'Do/src/Do.UI/GeneralPreferencesWidget.cs'
--- Do/src/Do.UI/GeneralPreferencesWidget.cs 2009-02-18 00:31:48 +0000
+++ Do/src/Do.UI/GeneralPreferencesWidget.cs 2009-06-19 02:19:46 +0000
@@ -33,39 +33,32 @@
3333
34namespace Do.UI34namespace Do.UI
35{35{
36 [System.ComponentModel.Category("Do")]36 [System.ComponentModel.Category("Do")]
37 [System.ComponentModel.ToolboxItem(true)]37 [System.ComponentModel.ToolboxItem(true)]
38 public partial class GeneralPreferencesWidget : Bin, IConfigurable38 public partial class GeneralPreferencesWidget : Bin, IConfigurable
39 {39 {
40 new public string Name {
41 get { return Catalog.GetString ("General"); }
42 }
43
44 public string Description {
45 get { return ""; }
46 }
47
48 public string Icon {
49 get { return ""; }
50 }
51 40
52 public GeneralPreferencesWidget ()41 public GeneralPreferencesWidget ()
53 {42 {
54 Build ();43 Build ();
55 44
56 // Setup checkboxes45 // Setup checkboxes
57 hide_check.Active = Do.Preferences.QuietStart;46 hide_check.Active = Do.Preferences.QuietStart;
58 login_check.Active = AutostartEnabled;47 login_check.Active = AutostartEnabled;
59 notification_check.Active = TrayIconService.Visible;48 notification_check.Active = TrayIconService.Visible;
60 }49 }
61 50
51 public string Title {
52 get { return Catalog.GetString ("General"); }
53 }
54
62 public Bin GetConfiguration ()55 public Bin GetConfiguration ()
63 {56 {
64 return this;57 return this;
65 }58 }
66 59
67 protected bool AutostartEnabled {60 protected bool AutostartEnabled {
68 get {61 get {
69 return Services.System.IsAutoStartEnabled ();62 return Services.System.IsAutoStartEnabled ();
70 }63 }
71 64
@@ -80,17 +73,17 @@
80 73
81 protected virtual void OnLoginCheckClicked (object sender, EventArgs e)74 protected virtual void OnLoginCheckClicked (object sender, EventArgs e)
82 {75 {
83 AutostartEnabled = login_check.Active;76 AutostartEnabled = login_check.Active;
84 }77 }
85 78
86 protected virtual void OnHideCheckClicked (object sender, EventArgs e)79 protected virtual void OnHideCheckClicked (object sender, EventArgs e)
87 {80 {
88 Do.Preferences.QuietStart = hide_check.Active;81 Do.Preferences.QuietStart = hide_check.Active;
89 }82 }
90 83
91 protected virtual void OnNotificationCheckClicked (object sender, System.EventArgs e)84 protected virtual void OnNotificationCheckClicked (object sender, System.EventArgs e)
92 {85 {
93 TrayIconService.Visible = notification_check.Active;86 TrayIconService.Visible = notification_check.Active;
94 }87 }
95 }88 }
96}89}
97\ No newline at end of file90\ No newline at end of file
9891
=== modified file 'Do/src/Do.UI/KeybindingsPreferencesWidget.cs'
--- Do/src/Do.UI/KeybindingsPreferencesWidget.cs 2009-01-27 05:08:07 +0000
+++ Do/src/Do.UI/KeybindingsPreferencesWidget.cs 2009-06-19 02:19:46 +0000
@@ -36,18 +36,6 @@
36 {36 {
37 private KeybindingTreeView kbview;37 private KeybindingTreeView kbview;
38 38
39 new public string Name {
40 get { return Catalog.GetString ("Keyboard"); }
41 }
42
43 public string Description {
44 get { return ""; }
45 }
46
47 public string Icon {
48 get { return ""; }
49 }
50
51 public KeybindingsPreferencesWidget ()39 public KeybindingsPreferencesWidget ()
52 {40 {
53 Build ();41 Build ();
@@ -58,9 +46,13 @@
58 action_scroll.ShowAll ();46 action_scroll.ShowAll ();
59 }47 }
60 48
49 public string Title {
50 get { return Catalog.GetString ("Keyboard"); }
51 }
52
61 public Bin GetConfiguration ()53 public Bin GetConfiguration ()
62 {54 {
63 return this;55 return this;
64 }56 }
65 }57 }
66}58}
67\ No newline at end of file59\ No newline at end of file
6860
=== modified file 'Do/src/Do.UI/ManagePluginsPreferencesWidget.cs'
--- Do/src/Do.UI/ManagePluginsPreferencesWidget.cs 2009-06-05 19:45:45 +0000
+++ Do/src/Do.UI/ManagePluginsPreferencesWidget.cs 2009-06-19 02:19:46 +0000
@@ -50,18 +50,6 @@
50 PluginNodeView nview;50 PluginNodeView nview;
51 SearchEntry search_entry;51 SearchEntry search_entry;
5252
53 new public string Name {
54 get { return Catalog.GetString ("Plugins"); }
55 }
56
57 public string Description {
58 get { return ""; }
59 }
60
61 public string Icon {
62 get { return ""; }
63 }
64
65 public ManagePluginsPreferencesWidget ()53 public ManagePluginsPreferencesWidget ()
66 {54 {
67 Build ();55 Build ();
@@ -98,6 +86,15 @@
98 Services.Application.RunOnMainThread (() => search_entry.InnerEntry.GrabFocus ());86 Services.Application.RunOnMainThread (() => search_entry.InnerEntry.GrabFocus ());
99 }87 }
100 88
89 public string Title {
90 get { return Catalog.GetString ("Plugins"); }
91 }
92
93 public Bin GetConfiguration ()
94 {
95 return this;
96 }
97
101 protected void OnDragDataReceived (object sender, DragDataReceivedArgs args)98 protected void OnDragDataReceived (object sender, DragDataReceivedArgs args)
102 {99 {
103 string data;100 string data;
@@ -144,11 +141,6 @@
144 } 141 }
145 }142 }
146143
147 public Bin GetConfiguration ()
148 {
149 return this;
150 }
151
152 private void OnPluginSelected (object sender, PluginSelectionEventArgs e)144 private void OnPluginSelected (object sender, PluginSelectionEventArgs e)
153 {145 {
154 UpdateButtonState ();146 UpdateButtonState ();
155147
=== modified file 'Do/src/Do.UI/PluginConfigurationWindow.cs'
--- Do/src/Do.UI/PluginConfigurationWindow.cs 2008-12-21 23:34:14 +0000
+++ Do/src/Do.UI/PluginConfigurationWindow.cs 2009-06-19 20:29:23 +0000
@@ -37,18 +37,20 @@
3737
38 const string TitleMarkup =38 const string TitleMarkup =
39 "<span weight=\"heavy\" size=\"large\">{0}</span>";39 "<span weight=\"heavy\" size=\"large\">{0}</span>";
4040
41 public PluginConfigurationWindow (string id) : 41 public PluginConfigurationWindow (string id) :
42 base (WindowType.Toplevel)42 base (WindowType.Toplevel)
43 {43 {
44 Addin addin;44 Addin addin;
45
46 Build ();
47
45 IEnumerable<IConfigurable> configs;48 IEnumerable<IConfigurable> configs;
4649
47 Build ();
48
49 addin = AddinManager.Registry.GetAddin (id);50 addin = AddinManager.Registry.GetAddin (id);
50 configs = PluginManager.ConfigurablesForAddin (id);51 configs = PluginManager.ConfigurablesForAddin (id);
51 Title = string.Format ("{0} Configuration", addin.Name);52 Title = string.Format ("{0} Configuration", addin.Name);
53
52 notebook.RemovePage (0);54 notebook.RemovePage (0);
53 notebook.ShowTabs = configs.Count () > 1;55 notebook.ShowTabs = configs.Count () > 1;
5456
@@ -61,7 +63,7 @@
6163
62 try {64 try {
63 config = configurable.GetConfiguration ();65 config = configurable.GetConfiguration ();
64 notebook.AppendPage (config, new Label (configurable.Name));66 notebook.AppendPage (config, new Label (configurable.Title));
65 config.ShowAll ();67 config.ShowAll ();
66 } catch (Exception e) {68 } catch (Exception e) {
67 Log.Error ("Failed to load configuration: {0}", e.Message);69 Log.Error ("Failed to load configuration: {0}", e.Message);
@@ -73,6 +75,11 @@
73 protected virtual void OnBtnCloseClicked (object sender, EventArgs e)75 protected virtual void OnBtnCloseClicked (object sender, EventArgs e)
74 {76 {
75 Hide ();77 Hide ();
78 int i=0;
79 while (i < notebook.NPages) {
80 notebook.RemovePage (i);
81 i++;
82 }
76 }83 }
77 }84 }
78}85}
7986
=== modified file 'Do/src/Do.UI/PreferencesWindow.cs'
--- Do/src/Do.UI/PreferencesWindow.cs 2009-04-22 04:42:48 +0000
+++ Do/src/Do.UI/PreferencesWindow.cs 2009-06-19 02:19:46 +0000
@@ -57,7 +57,7 @@
57 57
58 // Add notebook pages.58 // Add notebook pages.
59 foreach (IConfigurable page in Pages) {59 foreach (IConfigurable page in Pages) {
60 notebook.AppendPage (page.GetConfiguration (), new Label (page.Name));60 notebook.AppendPage (page.GetConfiguration (), new Label (page.Title));
61 }61 }
62 62
63 // Sets default page to the plugins tab, a good default.63 // Sets default page to the plugins tab, a good default.