Do

Merge lp:~alexlauni/do/refresh-button-remove into lp:do

Proposed by Alex Launi
Status: Merged
Merged at revision: not available
Proposed branch: lp:~alexlauni/do/refresh-button-remove
Merge into: lp:do
Diff against target: None lines
To merge this branch: bzr merge lp:~alexlauni/do/refresh-button-remove
Reviewer Review Type Date Requested Status
Jason Smith (community) Approve
Review via email: mp+7881@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Alex Launi (alexlauni) wrote :

Removes the (useless) Refresh button from the plugin prefs page, and causes a Registry refresh in the plugin page constructor, making sure newest plugins always appear in the node view, ready to be enabled.

Revision history for this message
Jason Smith (jassmith) wrote :

Looks good

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Do.Platform.Linux/gtk-gui/Do.Platform.Linux.AbstractLoginWidget.cs'
2--- Do.Platform.Linux/gtk-gui/Do.Platform.Linux.AbstractLoginWidget.cs 2009-06-19 04:30:03 +0000
3+++ Do.Platform.Linux/gtk-gui/Do.Platform.Linux.AbstractLoginWidget.cs 2009-06-25 09:26:41 +0000
4@@ -130,7 +130,6 @@
5 w6.Fill = false;
6 // Container child account_vbox.Gtk.Box+BoxChild
7 this.hbuttonbox1 = new Gtk.HButtonBox();
8- this.hbuttonbox1.Name = "hbuttonbox1";
9 this.hbuttonbox1.LayoutStyle = ((Gtk.ButtonBoxStyle)(4));
10 // Container child hbuttonbox1.Gtk.ButtonBox+ButtonBoxChild
11 this.validate_btn = new Gtk.Button();
12
13=== modified file 'Do/gtk-gui/Do.UI.DoAddinInstallerDialog.cs'
14--- Do/gtk-gui/Do.UI.DoAddinInstallerDialog.cs 2009-05-27 14:56:37 +0000
15+++ Do/gtk-gui/Do.UI.DoAddinInstallerDialog.cs 2009-06-25 09:26:41 +0000
16@@ -122,7 +122,7 @@
17 w11.Spacing = 2;
18 // Container child GtkHBox1.Gtk.Container+ContainerChild
19 Gtk.Image w12 = new Gtk.Image();
20- w12.Pixbuf = Stetic.IconLoader.LoadIcon(this, "gtk-ok", Gtk.IconSize.Button, 16);
21+ w12.Pixbuf = Stetic.IconLoader.LoadIcon(this, "gtk-ok", Gtk.IconSize.Button, 20);
22 w11.Add(w12);
23 // Container child GtkHBox1.Gtk.Container+ContainerChild
24 Gtk.Label w14 = new Gtk.Label();
25
26=== modified file 'Do/gtk-gui/Do.UI.ManagePluginsPreferencesWidget.cs'
27--- Do/gtk-gui/Do.UI.ManagePluginsPreferencesWidget.cs 2009-05-27 14:56:37 +0000
28+++ Do/gtk-gui/Do.UI.ManagePluginsPreferencesWidget.cs 2009-06-25 09:26:41 +0000
29@@ -35,12 +35,10 @@
30
31 private Gtk.Button btn_configure;
32
33+ private Gtk.HButtonBox hbuttonbox2;
34+
35 private Gtk.Button btn_about;
36
37- private Gtk.HButtonBox hbuttonbox2;
38-
39- private Gtk.Button btn_refresh;
40-
41 protected virtual void Build() {
42 Stetic.Gui.Initialize(this);
43 // Widget Do.UI.ManagePluginsPreferencesWidget
44@@ -124,7 +122,7 @@
45 w9.Spacing = 2;
46 // Container child GtkHBox.Gtk.Container+ContainerChild
47 Gtk.Image w10 = new Gtk.Image();
48- w10.Pixbuf = Stetic.IconLoader.LoadIcon(this, "gtk-preferences", Gtk.IconSize.Button, 16);
49+ w10.Pixbuf = Stetic.IconLoader.LoadIcon(this, "gtk-preferences", Gtk.IconSize.Button, 20);
50 w9.Add(w10);
51 // Container child GtkHBox.Gtk.Container+ContainerChild
52 Gtk.Label w12 = new Gtk.Label();
53@@ -137,59 +135,34 @@
54 Gtk.ButtonBox.ButtonBoxChild w16 = ((Gtk.ButtonBox.ButtonBoxChild)(this.hbuttonbox1[this.btn_configure]));
55 w16.Expand = false;
56 w16.Fill = false;
57- // Container child hbuttonbox1.Gtk.ButtonBox+ButtonBoxChild
58+ this.hbox2.Add(this.hbuttonbox1);
59+ Gtk.Box.BoxChild w17 = ((Gtk.Box.BoxChild)(this.hbox2[this.hbuttonbox1]));
60+ w17.Position = 0;
61+ // Container child hbox2.Gtk.Box+BoxChild
62+ this.hbuttonbox2 = new Gtk.HButtonBox();
63+ this.hbuttonbox2.Name = "hbuttonbox2";
64+ this.hbuttonbox2.Spacing = 6;
65+ this.hbuttonbox2.LayoutStyle = ((Gtk.ButtonBoxStyle)(4));
66+ // Container child hbuttonbox2.Gtk.ButtonBox+ButtonBoxChild
67 this.btn_about = new Gtk.Button();
68 this.btn_about.Sensitive = false;
69 this.btn_about.CanFocus = true;
70 this.btn_about.Name = "btn_about";
71+ this.btn_about.UseStock = true;
72 this.btn_about.UseUnderline = true;
73- // Container child btn_about.Gtk.Container+ContainerChild
74- Gtk.Alignment w17 = new Gtk.Alignment(0.5F, 0.5F, 0F, 0F);
75- // Container child GtkAlignment.Gtk.Container+ContainerChild
76- Gtk.HBox w18 = new Gtk.HBox();
77- w18.Spacing = 2;
78- // Container child GtkHBox.Gtk.Container+ContainerChild
79- Gtk.Image w19 = new Gtk.Image();
80- w19.Pixbuf = Stetic.IconLoader.LoadIcon(this, "gtk-about", Gtk.IconSize.Menu, 16);
81- w18.Add(w19);
82- // Container child GtkHBox.Gtk.Container+ContainerChild
83- Gtk.Label w21 = new Gtk.Label();
84- w21.LabelProp = Mono.Unix.Catalog.GetString("_About");
85- w21.UseUnderline = true;
86- w18.Add(w21);
87- w17.Add(w18);
88- this.btn_about.Add(w17);
89- this.hbuttonbox1.Add(this.btn_about);
90- Gtk.ButtonBox.ButtonBoxChild w25 = ((Gtk.ButtonBox.ButtonBoxChild)(this.hbuttonbox1[this.btn_about]));
91- w25.Position = 1;
92- w25.Expand = false;
93- w25.Fill = false;
94- this.hbox2.Add(this.hbuttonbox1);
95- Gtk.Box.BoxChild w26 = ((Gtk.Box.BoxChild)(this.hbox2[this.hbuttonbox1]));
96- w26.Position = 0;
97- // Container child hbox2.Gtk.Box+BoxChild
98- this.hbuttonbox2 = new Gtk.HButtonBox();
99- this.hbuttonbox2.Name = "hbuttonbox2";
100- this.hbuttonbox2.LayoutStyle = ((Gtk.ButtonBoxStyle)(4));
101- // Container child hbuttonbox2.Gtk.ButtonBox+ButtonBoxChild
102- this.btn_refresh = new Gtk.Button();
103- this.btn_refresh.CanFocus = true;
104- this.btn_refresh.Name = "btn_refresh";
105- this.btn_refresh.UseStock = true;
106- this.btn_refresh.UseUnderline = true;
107- this.btn_refresh.Label = "gtk-refresh";
108- this.hbuttonbox2.Add(this.btn_refresh);
109- Gtk.ButtonBox.ButtonBoxChild w27 = ((Gtk.ButtonBox.ButtonBoxChild)(this.hbuttonbox2[this.btn_refresh]));
110- w27.Expand = false;
111- w27.Fill = false;
112+ this.btn_about.Label = "gtk-about";
113+ this.hbuttonbox2.Add(this.btn_about);
114+ Gtk.ButtonBox.ButtonBoxChild w18 = ((Gtk.ButtonBox.ButtonBoxChild)(this.hbuttonbox2[this.btn_about]));
115+ w18.Expand = false;
116+ w18.Fill = false;
117 this.hbox2.Add(this.hbuttonbox2);
118- Gtk.Box.BoxChild w28 = ((Gtk.Box.BoxChild)(this.hbox2[this.hbuttonbox2]));
119- w28.Position = 1;
120+ Gtk.Box.BoxChild w19 = ((Gtk.Box.BoxChild)(this.hbox2[this.hbuttonbox2]));
121+ w19.Position = 1;
122 this.vbox3.Add(this.hbox2);
123- Gtk.Box.BoxChild w29 = ((Gtk.Box.BoxChild)(this.vbox3[this.hbox2]));
124- w29.Position = 2;
125- w29.Expand = false;
126- w29.Fill = false;
127+ Gtk.Box.BoxChild w20 = ((Gtk.Box.BoxChild)(this.vbox3[this.hbox2]));
128+ w20.Position = 2;
129+ w20.Expand = false;
130+ w20.Fill = false;
131 this.Add(this.vbox3);
132 if ((this.Child != null)) {
133 this.Child.ShowAll();
134@@ -198,8 +171,7 @@
135 this.show_combo.Changed += new System.EventHandler(this.OnShowComboChanged);
136 this.scrollw.DragDataReceived += new Gtk.DragDataReceivedHandler(this.OnScrollwDragDataReceived);
137 this.btn_configure.Clicked += new System.EventHandler(this.OnBtnConfigurePluginClicked);
138- this.btn_about.Clicked += new System.EventHandler(this.OnBtnAboutClicked);
139- this.btn_refresh.Clicked += new System.EventHandler(this.OnBtnRefreshClicked);
140+ this.btn_about.Clicked += new System.EventHandler(this.OnAboutBtnClicked);
141 }
142 }
143 }
144
145=== modified file 'Do/gtk-gui/gui.stetic'
146--- Do/gtk-gui/gui.stetic 2009-06-24 10:20:55 +0000
147+++ Do/gtk-gui/gui.stetic 2009-06-25 09:26:41 +0000
148@@ -6,6 +6,9 @@
149 </configuration>
150 <import>
151 <widget-library name="Mono.Addins.Gui, Version=0.4.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />
152+ <widget-library name="../../Do.Platform.Linux/bin/Debug/Do.Platform.Linux.dll" />
153+ <widget-library name="../../Do.Interface.Linux/bin/Debug/Do.Interface.Linux.dll" />
154+ <widget-library name="../../Do.Interface.Linux.AnimationBase/bin/Debug/Do.Interface.Linux.AnimationBase.dll" />
155 <widget-library name="../bin/Debug/Do.exe" internal="true" />
156 </import>
157 <widget class="Gtk.Window" id="Do.UI.PreferencesWindow" design-size="450 470">
158@@ -360,7 +363,7 @@
159 <widget class="Gtk.HButtonBox" id="hbuttonbox1">
160 <property name="MemberName" />
161 <property name="Spacing">6</property>
162- <property name="Size">2</property>
163+ <property name="Size">1</property>
164 <property name="LayoutStyle">Start</property>
165 <child>
166 <widget class="Gtk.Button" id="btn_configure">
167@@ -378,23 +381,6 @@
168 <property name="Fill">False</property>
169 </packing>
170 </child>
171- <child>
172- <widget class="Gtk.Button" id="btn_about">
173- <property name="MemberName" />
174- <property name="Sensitive">False</property>
175- <property name="CanFocus">True</property>
176- <property name="Type">TextAndIcon</property>
177- <property name="Icon">stock:gtk-about Menu</property>
178- <property name="Label" translatable="yes">_About</property>
179- <property name="UseUnderline">True</property>
180- <signal name="Clicked" handler="OnBtnAboutClicked" />
181- </widget>
182- <packing>
183- <property name="Position">1</property>
184- <property name="Expand">False</property>
185- <property name="Fill">False</property>
186- </packing>
187- </child>
188 </widget>
189 <packing>
190 <property name="Position">0</property>
191@@ -404,17 +390,19 @@
192 <child>
193 <widget class="Gtk.HButtonBox" id="hbuttonbox2">
194 <property name="MemberName" />
195+ <property name="Spacing">6</property>
196 <property name="Size">1</property>
197 <property name="LayoutStyle">End</property>
198 <child>
199- <widget class="Gtk.Button" id="btn_refresh">
200+ <widget class="Gtk.Button" id="btn_about">
201 <property name="MemberName" />
202+ <property name="Sensitive">False</property>
203 <property name="CanFocus">True</property>
204 <property name="UseStock">True</property>
205 <property name="Type">StockItem</property>
206- <property name="StockId">gtk-refresh</property>
207- <signal name="Clicked" handler="OnBtnRefreshClicked" />
208- <property name="label">gtk-refresh</property>
209+ <property name="StockId">gtk-about</property>
210+ <signal name="Clicked" handler="OnAboutBtnClicked" />
211+ <property name="label">gtk-about</property>
212 </widget>
213 <packing>
214 <property name="Expand">False</property>
215
216=== modified file 'Do/src/Do.Core/PluginManager.cs'
217--- Do/src/Do.Core/PluginManager.cs 2009-06-24 20:45:55 +0000
218+++ Do/src/Do.Core/PluginManager.cs 2009-06-25 09:49:15 +0000
219@@ -62,20 +62,15 @@
220 /// </summary>
221 public static void Initialize ()
222 {
223+ // we need to save these before initializing mono.addins or else ones that have been update in the
224+ // plugins directory will be lost.
225 IEnumerable<string> savedPlugins = PluginsEnabledBeforeLoad ();
226
227 // Initialize Mono.Addins.
228- AddinManager.Initialize (Paths.UserPluginsDirectory);
229- // This is a workaround for a Mono.Addins bug where updated addins will get
230- // disabled on update. We save the currently enabled addins, update, then
231- // reenable them with the Id of the new version. It's a bit hackish but lluis
232- // said it's a reasonable approach until that bug is fixed
233- // https://bugzilla.novell.com/show_bug.cgi?id=490302
234- if (CorePreferences.PeekDebug)
235- AddinManager.Registry.Rebuild (null);
236- else
237- AddinManager.Registry.Update (null);
238- EnableDisabledPlugins (savedPlugins);
239+ AddinManager.Initialize (Paths.UserPluginsDirectory);
240+
241+ // reload any enabled plugins that got disabled on init
242+ RefreshPlugins (savedPlugins);
243
244 // Initialize services before addins that may use them are loaded.
245 Services.Initialize ();
246@@ -86,6 +81,32 @@
247 AddinManager.AddExtensionNodeHandler (path, OnPluginChanged);
248 }
249
250+ /// <summary>
251+ /// Refresh the addin registry in case any new plugins have shown up
252+ /// and also make upgrades.
253+ /// </summary>
254+ public static void RefreshPlugins ()
255+ {
256+ IEnumerable<string> savedPlugins = PluginsEnabledBeforeLoad ();
257+ RefreshPlugins (savedPlugins);
258+ }
259+
260+ /// <summary>
261+ /// This is a workaround for a Mono.Addins bug where updated addins will get
262+ /// disabled on update. We save the currently enabled addins, update, then
263+ /// reenable them with the Id of the new version. It's a bit hackish but lluis
264+ /// said it's a reasonable approach until that bug is fixed
265+ /// https://bugzilla.novell.com/show_bug.cgi?id=490302
266+ /// </summary>
267+ static void RefreshPlugins (IEnumerable<string> savedPlugins)
268+ {
269+ if (CorePreferences.PeekDebug)
270+ AddinManager.Registry.Rebuild (null);
271+ else
272+ AddinManager.Registry.Update (null);
273+ EnableDisabledPlugins (savedPlugins);
274+ }
275+
276 public static void InstallLocalPlugins ()
277 {
278 IEnumerable<string> saved, manual;
279
280=== modified file 'Do/src/Do.UI/ManagePluginsPreferencesWidget.cs'
281--- Do/src/Do.UI/ManagePluginsPreferencesWidget.cs 2009-06-25 08:36:33 +0000
282+++ Do/src/Do.UI/ManagePluginsPreferencesWidget.cs 2009-06-25 09:49:15 +0000
283@@ -66,6 +66,8 @@
284 {
285 Build ();
286
287+ PluginManager.RefreshPlugins ();
288+
289 search_entry = new SearchEntry ();
290 nview = new PluginNodeView ();
291 nview.PluginToggled += OnPluginToggled;
292@@ -159,6 +161,7 @@
293 btn_configure.Sensitive = nview.GetSelectedAddins ()
294 .SelectMany (id => PluginManager.ConfigurablesForAddin (id))
295 .Any ();
296+
297 btn_about.Sensitive = nview.GetSelectedAddins ().Any ();
298 }
299
300@@ -203,8 +206,8 @@
301 win.Modal = true;
302 win.ShowAll ();
303 }
304-
305- void OnBtnAboutClicked (object sender, EventArgs args)
306+
307+ void OnAboutBtnClicked (object sender, EventArgs args)
308 {
309 foreach (string id in nview.GetSelectedAddins ()) {
310 try {