Merge lp:~cmsj/do-plugins/requesttracker into lp:do-plugins

Proposed by Chris Jones
Status: Merged
Merged at revision: not available
Proposed branch: lp:~cmsj/do-plugins/requesttracker
Merge into: lp:do-plugins
Diff against target: None lines
To merge this branch: bzr merge lp:~cmsj/do-plugins/requesttracker
Reviewer Review Type Date Requested Status
Chris S. Approve
Review via email: mp+4301@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Chris Jones (cmsj) wrote :

Added a plugin for Request Tracker. Works like this:

 * User selects some text (the number of an RT ticket)
 * User calls action "Request Tracker"
 * User chooses one of the sub-actions for the appropriate RT instance
 * web browser is told to display the ticket they are looking for

Initially the plugin won't talk to the web browser because they will need to configure their RT instances - there is no way to know this information ahead of time.

lp:~cmsj/do-plugins/requesttracker updated
574. By Chris Jones

Use a better test for empty strings. Suggested by cszikszoy

575. By Chris Jones

moditems are required. suggested by cszikszoy

576. By Chris Jones

don't loop around, we only care about the first part of each

Revision history for this message
Chris Jones (cmsj) wrote :

I have committed a few more revisions to my branch, clearing up some items brought up in IRC:

 * [style] use string.IsNullOrEmpty() instead of direct comparison with ""
 * Hint to Do that moditems are required
 * no pointless looping in Perform()

lp:~cmsj/do-plugins/requesttracker updated
577. By Chris Jones

list additional .cs files in Makefile.am

578. By Chris Jones

Add an additional library link, for great compiling justice

579. By Chris Jones

merge build fixes from jpds

580. By Chris Jones

Remove spaces everywhere

581. By Chris Jones

Keep the space in the name

582. By Chris Jones

Fix the URL appearance in the description of an item

583. By Chris Jones

merge in review changes from cszikszoy

584. By Chris Jones

modified patch from jpds to discard empty requests and show a nice error

585. By Chris Jones

steal jpds' idea and add a nice error when there are no RT instances defined

586. By Chris Jones

another merge from cszikszoy to fix a static class problem

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'DoPlugins.mds'
2--- DoPlugins.mds 2009-02-28 16:16:48 +0000
3+++ DoPlugins.mds 2009-03-06 15:19:34 +0000
4@@ -65,6 +65,7 @@
5 <Entry build="True" name="GoogleContacts" configuration="Debug" />
6 <Entry build="True" name="GoogleSearch" configuration="Debug" />
7 <Entry build="True" name="Stock Quote" configuration="Debug" />
8+ <Entry build="True" name="Request Tracker" configuration="Debug" />
9 <Entry build="True" name="TerminalServerClient" configuration="Debug" />
10 <Entry build="True" name="xmms2" configuration="Debug" />
11 <Entry build="True" name="TinyUrl" configuration="Debug" />
12@@ -136,6 +137,7 @@
13 <Entry build="True" name="GoogleContacts" configuration="Release" />
14 <Entry build="True" name="GoogleSearch" configuration="Release" />
15 <Entry build="True" name="Stock Quote" configuration="Release" />
16+ <Entry build="True" name="Request Tracker" configuration="Release" />
17 <Entry build="True" name="TerminalServerClient" configuration="Release" />
18 <Entry build="True" name="xmms2" configuration="Release" />
19 <Entry build="True" name="TinyUrl" configuration="Release" />
20@@ -208,6 +210,7 @@
21 <Execute type="None" entry="GoogleContacts" />
22 <Execute type="None" entry="GoogleSearch" />
23 <Execute type="None" entry="Stock Quote" />
24+ <Execute type="None" entry="Request Tracker" />
25 <Execute type="None" entry="TerminalServerClient" />
26 <Execute type="None" entry="xmms2" />
27 <Execute type="None" entry="TinyUrl" />
28@@ -280,6 +283,7 @@
29 <Entry filename="GoogleContacts/GMailContacts.mdp" />
30 <Entry filename="GoogleSearch/GoogleSearch.mdp" />
31 <Entry filename="StockQuote/Stock Quote.mdp" />
32+ <Entry filename="RequestTracker/Request Tracker.mdp" />
33 <Entry filename="TerminalServerClient/TerminalServerClient.mdp" />
34 <Entry filename="Xmms2/xmms2.mdp" />
35 <Entry filename="TinyUrl/TinyUrl.mdp" />
36
37=== modified file 'Makefile.am'
38--- Makefile.am 2009-02-06 19:37:09 +0000
39+++ Makefile.am 2009-03-09 10:09:56 +0000
40@@ -47,6 +47,7 @@
41 Putty \
42 Quote \
43 RememberTheMilk \
44+ RequestTracker \
45 Rhythmbox \
46 Riptide \
47 RSS \
48
49=== added directory 'RequestTracker'
50=== added file 'RequestTracker/Makefile.am'
51--- RequestTracker/Makefile.am 1970-01-01 00:00:00 +0000
52+++ RequestTracker/Makefile.am 2009-03-05 11:30:40 +0000
53@@ -0,0 +1,17 @@
54+include $(top_srcdir)/build.rules.mk
55+
56+ASSEMBLY=RequestTracker
57+
58+FILES = \
59+ src/RequestTrackerAction.cs
60+
61+RESOURCES = \
62+ Resources/RequestTracker.addin.xml \
63+ Resources/icons/rt.png
64+
65+REFERENCES = \
66+ Mono.Posix \
67+ System \
68+ System.Core \
69+ $(DO_PLATFORM_LIBS) \
70+ $(DO_UNIVERSE_LIBS)
71
72=== added file 'RequestTracker/Request Tracker.mdp'
73--- RequestTracker/Request Tracker.mdp 1970-01-01 00:00:00 +0000
74+++ RequestTracker/Request Tracker.mdp 2009-03-06 15:19:34 +0000
75@@ -0,0 +1,42 @@
76+<Project name="Request Tracker" fileversion="2.0" language="C#" clr-version="Net_2_0" targetFramework="2.0" ctype="DotNetProject">
77+ <Configurations active="Debug">
78+ <Configuration name="Debug" ctype="DotNetProjectConfiguration">
79+ <Output directory="bin/Debug" assembly="Request Tracker" />
80+ <Build debugmode="True" target="Library" />
81+ <Execution runwithwarnings="True" consolepause="False" runtime="MsNet" clr-version="Net_2_0" />
82+ <CodeGeneration compiler="Mcs" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" definesymbols="DEBUG" generatexmldocumentation="False" ctype="CSharpCompilerParameters" />
83+ </Configuration>
84+ <Configuration name="Release" ctype="DotNetProjectConfiguration">
85+ <Output directory="bin/Release" assembly="Request Tracker" />
86+ <Build debugmode="False" target="Library" />
87+ <Execution runwithwarnings="True" consolepause="False" runtime="MsNet" clr-version="Net_2_0" />
88+ <CodeGeneration compiler="Mcs" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" generatexmldocumentation="False" ctype="CSharpCompilerParameters" />
89+ </Configuration>
90+ </Configurations>
91+ <Contents>
92+ <File name="." subtype="Directory" buildaction="Compile" />
93+ <File name="src" subtype="Directory" buildaction="Compile" />
94+ <File name="src/RequestTrackerAction.cs" subtype="Code" buildaction="Compile" />
95+ <File name="Resources/RequestTracker.addin.xml" subtype="Code" buildaction="EmbedAsResource" />
96+ <File name="Resources/icons/rt.png" subtype="Code" buildaction="EmbedAsResource" />
97+ <File name="gtk-gui/gui.stetic" subtype="Code" buildaction="EmbedAsResource" />
98+ <File name="gtk-gui/generated.cs" subtype="Code" buildaction="Compile" />
99+ <File name="gtk-gui/RequestTracker.RTPrefs.cs" subtype="Code" buildaction="Compile" />
100+ <File name="src/Configuration.cs" subtype="Code" buildaction="Compile" />
101+ <File name="src/RequestTrackerItem.cs" subtype="Code" buildaction="Compile" />
102+ <File name="src/RequestTrackerItems.cs" subtype="Code" buildaction="Compile" />
103+ <File name="src/Preferences.cs" subtype="Code" buildaction="Compile" />
104+ </Contents>
105+ <References>
106+ <ProjectReference type="Gac" localcopy="True" refto="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
107+ <ProjectReference type="Gac" localcopy="True" refto="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
108+ <ProjectReference type="Gac" localcopy="True" refto="Do.Universe, Version=0.8.0.0, Culture=neutral, PublicKeyToken=null" />
109+ <ProjectReference type="Gac" localcopy="True" refto="Do.Platform, Version=0.8.0.0, Culture=neutral, PublicKeyToken=null" />
110+ <ProjectReference type="Gac" localcopy="True" refto="System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
111+ <ProjectReference type="Gac" localcopy="True" refto="gtk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
112+ <ProjectReference type="Gac" localcopy="True" refto="gdk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
113+ <ProjectReference type="Gac" localcopy="True" refto="Mono.Posix, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />
114+ <ProjectReference type="Gac" localcopy="True" refto="Do.Platform.Linux, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null" />
115+ <ProjectReference type="Gac" localcopy="True" refto="Do.Interface.Linux, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null" />
116+ </References>
117+</Project>
118\ No newline at end of file
119
120=== added directory 'RequestTracker/Resources'
121=== added file 'RequestTracker/Resources/RequestTracker.addin.xml'
122--- RequestTracker/Resources/RequestTracker.addin.xml 1970-01-01 00:00:00 +0000
123+++ RequestTracker/Resources/RequestTracker.addin.xml 2009-03-05 11:30:40 +0000
124@@ -0,0 +1,24 @@
125+<Addin
126+ id="RequestTracker"
127+ namespace="Do"
128+ version="1.0"
129+ name="Request Tracker"
130+ description="Show tickets from Request Tracker."
131+ author="Chris Jones"
132+ category="Community"
133+ >
134+
135+ <Runtime>
136+ <Import assembly="Request Tracker.dll"/>
137+ </Runtime>
138+
139+ <Dependencies>
140+ <Addin id="Universe" version="1.0" />
141+ </Dependencies>
142+
143+ <!-- Extensions included in this assembly -->
144+ <Extension path="/Do/Action">
145+ <Action type="RequestTracker.RTAction" />
146+ </Extension>
147+
148+</Addin>
149
150=== added directory 'RequestTracker/Resources/icons'
151=== added file 'RequestTracker/Resources/icons/rt.png'
152Binary files RequestTracker/Resources/icons/rt.png 1970-01-01 00:00:00 +0000 and RequestTracker/Resources/icons/rt.png 2009-03-05 11:30:40 +0000 differ
153=== added directory 'RequestTracker/gtk-gui'
154=== added file 'RequestTracker/gtk-gui/RequestTracker.RTPrefs.cs'
155--- RequestTracker/gtk-gui/RequestTracker.RTPrefs.cs 1970-01-01 00:00:00 +0000
156+++ RequestTracker/gtk-gui/RequestTracker.RTPrefs.cs 2009-03-08 17:40:57 +0000
157@@ -0,0 +1,113 @@
158+// ------------------------------------------------------------------------------
159+// <autogenerated>
160+// This code was generated by a tool.
161+//
162+//
163+// Changes to this file may cause incorrect behavior and will be lost if
164+// the code is regenerated.
165+// </autogenerated>
166+// ------------------------------------------------------------------------------
167+
168+namespace RequestTracker {
169+
170+
171+ public partial class RTPrefs {
172+
173+ private Gtk.VBox vbox1;
174+
175+ private Gtk.Label label1;
176+
177+ private Gtk.HBox hbox1;
178+
179+ private Gtk.ScrolledWindow GtkScrolledWindow;
180+
181+ private Gtk.NodeView RTTree;
182+
183+ private Gtk.VButtonBox vbuttonbox1;
184+
185+ private Gtk.Button add_btn;
186+
187+ private Gtk.Button remove_btn;
188+
189+ protected virtual void Build() {
190+ Stetic.Gui.Initialize(this);
191+ // Widget RequestTracker.RTPrefs
192+ Stetic.BinContainer.Attach(this);
193+ this.Name = "RequestTracker.RTPrefs";
194+ // Container child RequestTracker.RTPrefs.Gtk.Container+ContainerChild
195+ this.vbox1 = new Gtk.VBox();
196+ this.vbox1.Name = "vbox1";
197+ this.vbox1.Spacing = 6;
198+ // Container child vbox1.Gtk.Box+BoxChild
199+ this.label1 = new Gtk.Label();
200+ this.label1.Name = "label1";
201+ this.label1.LabelProp = Mono.Unix.Catalog.GetString("Use the list below to add/configure your Request Tracker sites.\n\n<i>The ticket number will be inserted into the URL at the place specified by the string: {0}</i>");
202+ this.label1.UseMarkup = true;
203+ this.label1.Wrap = true;
204+ this.label1.Justify = ((Gtk.Justification)(2));
205+ this.vbox1.Add(this.label1);
206+ Gtk.Box.BoxChild w1 = ((Gtk.Box.BoxChild)(this.vbox1[this.label1]));
207+ w1.Position = 0;
208+ w1.Expand = false;
209+ w1.Fill = false;
210+ // Container child vbox1.Gtk.Box+BoxChild
211+ this.hbox1 = new Gtk.HBox();
212+ this.hbox1.Name = "hbox1";
213+ this.hbox1.Spacing = 6;
214+ // Container child hbox1.Gtk.Box+BoxChild
215+ this.GtkScrolledWindow = new Gtk.ScrolledWindow();
216+ this.GtkScrolledWindow.Name = "GtkScrolledWindow";
217+ this.GtkScrolledWindow.ShadowType = ((Gtk.ShadowType)(1));
218+ // Container child GtkScrolledWindow.Gtk.Container+ContainerChild
219+ this.RTTree = new Gtk.NodeView();
220+ this.RTTree.CanFocus = true;
221+ this.RTTree.Name = "RTTree";
222+ this.GtkScrolledWindow.Add(this.RTTree);
223+ this.hbox1.Add(this.GtkScrolledWindow);
224+ Gtk.Box.BoxChild w3 = ((Gtk.Box.BoxChild)(this.hbox1[this.GtkScrolledWindow]));
225+ w3.Position = 0;
226+ // Container child hbox1.Gtk.Box+BoxChild
227+ this.vbuttonbox1 = new Gtk.VButtonBox();
228+ this.vbuttonbox1.Name = "vbuttonbox1";
229+ this.vbuttonbox1.LayoutStyle = ((Gtk.ButtonBoxStyle)(3));
230+ // Container child vbuttonbox1.Gtk.ButtonBox+ButtonBoxChild
231+ this.add_btn = new Gtk.Button();
232+ this.add_btn.CanFocus = true;
233+ this.add_btn.Name = "add_btn";
234+ this.add_btn.UseStock = true;
235+ this.add_btn.UseUnderline = true;
236+ this.add_btn.Label = "gtk-add";
237+ this.vbuttonbox1.Add(this.add_btn);
238+ Gtk.ButtonBox.ButtonBoxChild w4 = ((Gtk.ButtonBox.ButtonBoxChild)(this.vbuttonbox1[this.add_btn]));
239+ w4.Expand = false;
240+ w4.Fill = false;
241+ // Container child vbuttonbox1.Gtk.ButtonBox+ButtonBoxChild
242+ this.remove_btn = new Gtk.Button();
243+ this.remove_btn.CanFocus = true;
244+ this.remove_btn.Name = "remove_btn";
245+ this.remove_btn.UseStock = true;
246+ this.remove_btn.UseUnderline = true;
247+ this.remove_btn.Label = "gtk-remove";
248+ this.vbuttonbox1.Add(this.remove_btn);
249+ Gtk.ButtonBox.ButtonBoxChild w5 = ((Gtk.ButtonBox.ButtonBoxChild)(this.vbuttonbox1[this.remove_btn]));
250+ w5.Position = 1;
251+ w5.Expand = false;
252+ w5.Fill = false;
253+ this.hbox1.Add(this.vbuttonbox1);
254+ Gtk.Box.BoxChild w6 = ((Gtk.Box.BoxChild)(this.hbox1[this.vbuttonbox1]));
255+ w6.Position = 1;
256+ w6.Expand = false;
257+ w6.Fill = false;
258+ this.vbox1.Add(this.hbox1);
259+ Gtk.Box.BoxChild w7 = ((Gtk.Box.BoxChild)(this.vbox1[this.hbox1]));
260+ w7.Position = 1;
261+ this.Add(this.vbox1);
262+ if ((this.Child != null)) {
263+ this.Child.ShowAll();
264+ }
265+ this.Hide();
266+ this.add_btn.Clicked += new System.EventHandler(this.OnAddBtnClicked);
267+ this.remove_btn.Clicked += new System.EventHandler(this.OnRemoveBtnClicked);
268+ }
269+ }
270+}
271
272=== added file 'RequestTracker/gtk-gui/generated.cs'
273--- RequestTracker/gtk-gui/generated.cs 1970-01-01 00:00:00 +0000
274+++ RequestTracker/gtk-gui/generated.cs 2009-03-05 13:19:21 +0000
275@@ -0,0 +1,82 @@
276+// ------------------------------------------------------------------------------
277+// <autogenerated>
278+// This code was generated by a tool.
279+//
280+//
281+// Changes to this file may cause incorrect behavior and will be lost if
282+// the code is regenerated.
283+// </autogenerated>
284+// ------------------------------------------------------------------------------
285+
286+namespace Stetic {
287+
288+
289+ internal class Gui {
290+
291+ private static bool initialized;
292+
293+ internal static void Initialize(Gtk.Widget iconRenderer) {
294+ if ((Stetic.Gui.initialized == false)) {
295+ Stetic.Gui.initialized = true;
296+ }
297+ }
298+ }
299+
300+ internal class BinContainer {
301+
302+ private Gtk.Widget child;
303+
304+ private Gtk.UIManager uimanager;
305+
306+ public static BinContainer Attach(Gtk.Bin bin) {
307+ BinContainer bc = new BinContainer();
308+ bin.SizeRequested += new Gtk.SizeRequestedHandler(bc.OnSizeRequested);
309+ bin.SizeAllocated += new Gtk.SizeAllocatedHandler(bc.OnSizeAllocated);
310+ bin.Added += new Gtk.AddedHandler(bc.OnAdded);
311+ return bc;
312+ }
313+
314+ private void OnSizeRequested(object sender, Gtk.SizeRequestedArgs args) {
315+ if ((this.child != null)) {
316+ args.Requisition = this.child.SizeRequest();
317+ }
318+ }
319+
320+ private void OnSizeAllocated(object sender, Gtk.SizeAllocatedArgs args) {
321+ if ((this.child != null)) {
322+ this.child.Allocation = args.Allocation;
323+ }
324+ }
325+
326+ private void OnAdded(object sender, Gtk.AddedArgs args) {
327+ this.child = args.Widget;
328+ }
329+
330+ public void SetUiManager(Gtk.UIManager uim) {
331+ this.uimanager = uim;
332+ this.child.Realized += new System.EventHandler(this.OnRealized);
333+ }
334+
335+ private void OnRealized(object sender, System.EventArgs args) {
336+ if ((this.uimanager != null)) {
337+ Gtk.Widget w;
338+ w = this.child.Toplevel;
339+ if (((w != null) && typeof(Gtk.Window).IsInstanceOfType(w))) {
340+ ((Gtk.Window)(w)).AddAccelGroup(this.uimanager.AccelGroup);
341+ this.uimanager = null;
342+ }
343+ }
344+ }
345+ }
346+
347+ internal class ActionGroups {
348+
349+ public static Gtk.ActionGroup GetActionGroup(System.Type type) {
350+ return Stetic.ActionGroups.GetActionGroup(type.FullName);
351+ }
352+
353+ public static Gtk.ActionGroup GetActionGroup(string name) {
354+ return null;
355+ }
356+ }
357+}
358
359=== added file 'RequestTracker/gtk-gui/gui.stetic'
360--- RequestTracker/gtk-gui/gui.stetic 1970-01-01 00:00:00 +0000
361+++ RequestTracker/gtk-gui/gui.stetic 2009-03-08 17:40:57 +0000
362@@ -0,0 +1,110 @@
363+<?xml version="1.0" encoding="utf-8"?>
364+<stetic-interface>
365+ <configuration>
366+ <images-root-path>..</images-root-path>
367+ <target-gtk-version>2.12</target-gtk-version>
368+ </configuration>
369+ <import>
370+ <widget-library name="Do.Platform.Linux, Version=0.9.0.0, Culture=neutral" />
371+ <widget-library name="Do.Interface.Linux, Version=0.9.0.0, Culture=neutral" />
372+ <widget-library name="../bin/Release/Request Tracker.dll" internal="true" />
373+ </import>
374+ <widget class="Gtk.Bin" id="RequestTracker.RTPrefs" design-size="481 382">
375+ <property name="MemberName" />
376+ <property name="Visible">False</property>
377+ <child>
378+ <widget class="Gtk.VBox" id="vbox1">
379+ <property name="MemberName" />
380+ <property name="Spacing">6</property>
381+ <child>
382+ <widget class="Gtk.Label" id="label1">
383+ <property name="MemberName" />
384+ <property name="LabelProp" translatable="yes">Use the list below to add/configure your Request Tracker sites.
385+
386+&lt;i&gt;The ticket number will be inserted into the URL at the place specified by the string: {0}&lt;/i&gt;</property>
387+ <property name="UseMarkup">True</property>
388+ <property name="Wrap">True</property>
389+ <property name="Justify">Center</property>
390+ </widget>
391+ <packing>
392+ <property name="Position">0</property>
393+ <property name="AutoSize">True</property>
394+ <property name="Expand">False</property>
395+ <property name="Fill">False</property>
396+ </packing>
397+ </child>
398+ <child>
399+ <widget class="Gtk.HBox" id="hbox1">
400+ <property name="MemberName" />
401+ <property name="Spacing">6</property>
402+ <child>
403+ <widget class="Gtk.ScrolledWindow" id="GtkScrolledWindow">
404+ <property name="MemberName" />
405+ <property name="ShadowType">In</property>
406+ <child>
407+ <widget class="Gtk.NodeView" id="RTTree">
408+ <property name="MemberName" />
409+ <property name="CanFocus">True</property>
410+ <property name="ShowScrollbars">True</property>
411+ </widget>
412+ </child>
413+ </widget>
414+ <packing>
415+ <property name="Position">0</property>
416+ <property name="AutoSize">True</property>
417+ </packing>
418+ </child>
419+ <child>
420+ <widget class="Gtk.VButtonBox" id="vbuttonbox1">
421+ <property name="MemberName" />
422+ <property name="Size">2</property>
423+ <property name="LayoutStyle">Start</property>
424+ <child>
425+ <widget class="Gtk.Button" id="add_btn">
426+ <property name="MemberName" />
427+ <property name="CanFocus">True</property>
428+ <property name="UseStock">True</property>
429+ <property name="Type">StockItem</property>
430+ <property name="StockId">gtk-add</property>
431+ <signal name="Clicked" handler="OnAddBtnClicked" />
432+ <property name="label">gtk-add</property>
433+ </widget>
434+ <packing>
435+ <property name="Expand">False</property>
436+ <property name="Fill">False</property>
437+ </packing>
438+ </child>
439+ <child>
440+ <widget class="Gtk.Button" id="remove_btn">
441+ <property name="MemberName" />
442+ <property name="CanFocus">True</property>
443+ <property name="UseStock">True</property>
444+ <property name="Type">StockItem</property>
445+ <property name="StockId">gtk-remove</property>
446+ <signal name="Clicked" handler="OnRemoveBtnClicked" />
447+ <property name="label">gtk-remove</property>
448+ </widget>
449+ <packing>
450+ <property name="Position">1</property>
451+ <property name="Expand">False</property>
452+ <property name="Fill">False</property>
453+ </packing>
454+ </child>
455+ </widget>
456+ <packing>
457+ <property name="Position">1</property>
458+ <property name="AutoSize">True</property>
459+ <property name="Expand">False</property>
460+ <property name="Fill">False</property>
461+ </packing>
462+ </child>
463+ </widget>
464+ <packing>
465+ <property name="Position">1</property>
466+ <property name="AutoSize">True</property>
467+ </packing>
468+ </child>
469+ </widget>
470+ </child>
471+ </widget>
472+</stetic-interface>
473\ No newline at end of file
474
475=== added directory 'RequestTracker/src'
476=== added file 'RequestTracker/src/Configuration.cs'
477--- RequestTracker/src/Configuration.cs 1970-01-01 00:00:00 +0000
478+++ RequestTracker/src/Configuration.cs 2009-03-08 18:42:30 +0000
479@@ -0,0 +1,140 @@
480+
481+using System;
482+using System.Web;
483+using Do.Platform;
484+using Do.Platform.Linux;
485+using Do.Universe;
486+using Do.Universe.Common;
487+using Mono.Unix;
488+
489+namespace RequestTracker
490+{
491+
492+ [System.ComponentModel.ToolboxItem(true)]
493+ public partial class RTPrefs : Gtk.Bin
494+ {
495+ Gtk.ListStore rtListStore;
496+ Gtk.TreeViewColumn nameColumn;
497+ Gtk.TreeViewColumn urlColumn;
498+
499+ protected virtual void OnRemoveBtnClicked (object sender, System.EventArgs e)
500+ {
501+ Gtk.TreeModel model;
502+ Gtk.TreeIter iter;
503+ RTTree.Selection.GetSelected (out model, out iter);
504+ rtListStore.Remove (ref iter);
505+
506+ UpdatePrefs ();
507+ }
508+
509+ protected virtual void OnAddBtnClicked (object sender, System.EventArgs e)
510+ {
511+ Gtk.TreeIter iter = rtListStore.AppendValues ("", "");
512+ Gtk.TreePath path = rtListStore.GetPath (iter);
513+ RTTree.SetCursor (path, nameColumn, true);
514+ }
515+
516+ protected virtual void OnNameCellEdited (object sender, Gtk.EditedArgs args)
517+ {
518+ OnCellEdited (sender, args, 0);
519+ }
520+
521+ protected virtual void OnURLCellEdited (object sender, Gtk.EditedArgs args)
522+ {
523+ // Test the URL is valid
524+ try {
525+ new System.Uri (args.NewText);
526+ } catch (System.UriFormatException) {
527+ return;
528+ }
529+
530+ OnCellEdited (sender, args, 1);
531+ }
532+
533+ protected virtual void OnCellEdited (object sender, Gtk.EditedArgs args, int column)
534+ {
535+ Gtk.TreeIter iter;
536+ rtListStore.GetIter (out iter, new Gtk.TreePath (args.Path));
537+
538+ rtListStore.SetValue (iter, column, args.NewText);
539+
540+ UpdatePrefs ();
541+ }
542+
543+ public void UpdatePrefs ()
544+ {
545+ Gtk.TreeIter iter;
546+ string URLs = "";
547+ string name;
548+ string url;
549+ int num_children = rtListStore.IterNChildren ();
550+
551+ for (int i = 0; i < num_children; i++) {
552+ rtListStore.IterNthChild (out iter, i);
553+
554+ name = rtListStore.GetValue (iter, 0).ToString ();
555+ url = rtListStore.GetValue (iter, 1).ToString ();
556+
557+ if (name != "" && url != "") {
558+ if (i > 0) {
559+ URLs += "|";
560+ }
561+ URLs += name.Replace ("|", "");
562+ URLs += "|";
563+ URLs += url.Replace ("|", "");
564+ }
565+ }
566+
567+ RTPreferences prefs = new RTPreferences ();
568+ prefs.URLs = URLs;
569+ }
570+
571+ public RTPrefs()
572+ {
573+ RTPreferences prefs = new RTPreferences();
574+
575+ this.Build();
576+
577+ nameColumn = new Gtk.TreeViewColumn ();
578+ nameColumn.Title = "Name";
579+ urlColumn = new Gtk.TreeViewColumn ();
580+ urlColumn.Title = "URL";
581+
582+ RTTree.AppendColumn (nameColumn);
583+ RTTree.AppendColumn (urlColumn);
584+
585+ rtListStore = new Gtk.ListStore (typeof (string), typeof (string));
586+ RTTree.Model = rtListStore;
587+
588+ Gtk.CellRendererText nameNameCell = new Gtk.CellRendererText ();
589+ nameNameCell.Editable = true;
590+ nameNameCell.Edited += OnNameCellEdited;
591+ nameColumn.PackStart (nameNameCell, true);
592+
593+ Gtk.CellRendererText urlTitleCell = new Gtk.CellRendererText ();
594+ urlTitleCell.Editable = true;
595+ urlTitleCell.Edited += OnURLCellEdited;
596+ urlColumn.PackStart (urlTitleCell, true);
597+
598+ nameColumn.AddAttribute (nameNameCell, "text", 0);
599+ urlColumn.AddAttribute (urlTitleCell, "text", 1);
600+
601+ if (prefs.URLs != "") {
602+ string[] urlbits = prefs.URLs.Split('|');
603+ for (int i = 0; i < urlbits.Length; i++) {
604+ string name = urlbits[i];
605+ string uri = urlbits[++i];
606+ Uri url;
607+ try {
608+ url = new System.Uri(uri);
609+ } catch (System.UriFormatException) {
610+ continue;
611+ }
612+
613+ rtListStore.AppendValues (name, url.ToString());
614+ }
615+ }
616+ }
617+
618+ }
619+}
620
621=== added file 'RequestTracker/src/Preferences.cs'
622--- RequestTracker/src/Preferences.cs 1970-01-01 00:00:00 +0000
623+++ RequestTracker/src/Preferences.cs 2009-03-06 15:19:34 +0000
624@@ -0,0 +1,43 @@
625+/* Preferences.cs
626+ *
627+ * GNOME Do is the legal property of its developers. Please refer to the
628+ * COPYRIGHT file distributed with this
629+ * source distribution.
630+ *
631+ * This program is free software: you can redistribute it and/or modify
632+ * it under the terms of the GNU General Public License as published by
633+ * the Free Software Foundation, either version 3 of the License, or
634+ * (at your option) any later version.
635+ *
636+ * This program is distributed in the hope that it will be useful,
637+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
638+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
639+ * GNU General Public License for more details.
640+ *
641+ * You should have received a copy of the GNU General Public License
642+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
643+ */
644+using System;
645+using Do.Platform;
646+
647+namespace RequestTracker
648+{
649+
650+ public class RTPreferences
651+ {
652+ const string URLsKey = "URLs";
653+
654+ IPreferences prefs;
655+
656+ public RTPreferences() {
657+ prefs = Services.Preferences.Get<RTPreferences> ();
658+ }
659+
660+ public string URLs {
661+ get { return prefs.Get<string> (URLsKey, ""); }
662+ set { prefs.Set (URLsKey, value); }
663+ }
664+ }
665+
666+}
667+
668
669=== added file 'RequestTracker/src/RequestTrackerAction.cs'
670--- RequestTracker/src/RequestTrackerAction.cs 1970-01-01 00:00:00 +0000
671+++ RequestTracker/src/RequestTrackerAction.cs 2009-03-06 15:19:34 +0000
672@@ -0,0 +1,86 @@
673+/* RequestTracker.cs
674+ *
675+ * GNOME Do is the legal property of its developers. Please refer to the
676+ * COPYRIGHT file distributed with this source distribution.
677+ *
678+ * This program is free software: you can redistribute it and/or modify
679+ * it under the terms of the GNU General Public License as published by
680+ * the Free Software Foundation, either version 3 of the License, or
681+ * (at your option) any later version.
682+ *
683+ * This program is distributed in the hope that it will be useful,
684+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
685+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
686+ * GNU General Public License for more details.
687+ *
688+ * You should have received a copy of the GNU General Public License
689+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
690+ */
691+
692+using System;
693+using System.IO;
694+using System.Net;
695+using System.Linq;
696+using System.Collections.Generic;
697+using System.Text.RegularExpressions;
698+using System.Web;
699+
700+using Do.Platform;
701+using Do.Platform.Linux;
702+using Do.Universe;
703+using Do.Universe.Common;
704+
705+using Mono.Unix;
706+
707+
708+namespace RequestTracker
709+{
710+ /// <summary>
711+ /// Given an ITextItem, RequestTrackerAction will construct a URL
712+ /// and feed it to a web browser
713+ /// </summary>
714+ class RTAction : Act, IConfigurable
715+ {
716+
717+ public override string Name {
718+ get { return Catalog.GetString ("Request Tracker"); }
719+ }
720+
721+ public override string Description {
722+ get { return Catalog.GetString ("Display tickets from Request Tracker."); }
723+ }
724+
725+ public override string Icon {
726+ get { return "rt.png@" + GetType ().Assembly.FullName; }
727+ }
728+
729+ public override IEnumerable<Type> SupportedItemTypes {
730+ get { yield return typeof (ITextItem); }
731+ }
732+
733+ public override IEnumerable<Type> SupportedModifierItemTypes {
734+ get { yield return typeof (RequestTrackerItem);}
735+ }
736+
737+ public override IEnumerable<Item> DynamicModifierItemsForItem (Item item)
738+ {
739+ RequestTrackerItems items = new RequestTrackerItems ();
740+ return items.Items.OfType<Item> ();
741+ }
742+
743+ public override IEnumerable<Item> Perform (IEnumerable<Item> items, IEnumerable<Item> modItems)
744+ {
745+ foreach (RequestTrackerItem rt in modItems)
746+ rt.Perform (items.OfType<ITextItem> ());
747+
748+ yield break;
749+ }
750+
751+ public Gtk.Bin GetConfiguration ()
752+ {
753+ return new RTPrefs ();
754+ }
755+
756+ }
757+
758+}
759
760=== added file 'RequestTracker/src/RequestTrackerItem.cs'
761--- RequestTracker/src/RequestTrackerItem.cs 1970-01-01 00:00:00 +0000
762+++ RequestTracker/src/RequestTrackerItem.cs 2009-03-08 17:40:57 +0000
763@@ -0,0 +1,80 @@
764+/* RequestTrackerItem.cs
765+ *
766+ * GNOME Do is the legal property of its developers. Please refer to the
767+ * COPYRIGHT file distributed with this source distribution.
768+ *
769+ * This program is free software: you can redistribute it and/or modify
770+ * it under the terms of the GNU General Public License as published by
771+ * the Free Software Foundation, either version 3 of the License, or
772+ * (at your option) any later version.
773+ *
774+ * This program is distributed in the hope that it will be useful,
775+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
776+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
777+ * GNU General Public License for more details.
778+ *
779+ * You should have received a copy of the GNU General Public License
780+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
781+ */
782+
783+using System;
784+using System.Linq;
785+using System.Collections.Generic;
786+using System.Web;
787+using System.Text.RegularExpressions;
788+
789+using Mono.Unix;
790+
791+using Do.Universe;
792+using Do.Platform;
793+
794+namespace RequestTracker
795+{
796+
797+
798+ public class RequestTrackerItem : Item
799+ {
800+ string name, description, url;
801+
802+ public RequestTrackerItem (string name, string description, string url)
803+ {
804+ this.name = Catalog.GetString (name);
805+ this.description = Catalog.GetString (description);
806+ this.url = url;
807+ }
808+
809+ public override string Name {
810+ get { return name; }
811+ }
812+
813+ public override string Description {
814+ get { return description; }
815+ }
816+
817+ public override string Icon {
818+ get { return "rt.png@" + GetType ().Assembly.FullName; }
819+ }
820+
821+ public void Perform (IEnumerable<ITextItem> items)
822+ {
823+ foreach (ITextItem item in items)
824+ Perform (item);
825+ }
826+
827+ public virtual void Perform (ITextItem item)
828+ {
829+ if (url.Substring (0, 4) == "FAIL") {
830+ // FIXME: Show a proper error here, and open the config dialog
831+ return;
832+ }
833+ string newtext = Regex.Replace (item.Text, @"[^0-9]", "");
834+ string query = HttpUtility.UrlEncode (newtext);
835+ Services.Environment.OpenUrl (FormatUrl (url, query));
836+ }
837+
838+ protected virtual string FormatUrl (string url, string query)
839+ {
840+ return string.Format (url, query);
841+ }
842+ }
843+}
844
845=== added file 'RequestTracker/src/RequestTrackerItems.cs'
846--- RequestTracker/src/RequestTrackerItems.cs 1970-01-01 00:00:00 +0000
847+++ RequestTracker/src/RequestTrackerItems.cs 2009-03-08 18:42:30 +0000
848@@ -0,0 +1,60 @@
849+/* RequestTrackerItems.cs
850+ *
851+ * GNOME Do is the legal property of its developers. Please refer to the
852+ * COPYRIGHT file distributed with this source distribution.
853+ *
854+ * This program is free software: you can redistribute it and/or modify
855+ * it under the terms of the GNU General Public License as published by
856+ * the Free Software Foundation, either version 3 of the License, or
857+ * (at your option) any later version.
858+ *
859+ * This program is distributed in the hope that it will be useful,
860+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
861+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
862+ * GNU General Public License for more details.
863+ *
864+ * You should have received a copy of the GNU General Public License
865+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
866+ */
867+
868+using System;
869+using System.Collections;
870+using System.Collections.ObjectModel;
871+using System.Collections.Generic;
872+using Do.Platform;
873+
874+namespace RequestTracker
875+{
876+
877+ class RequestTrackerItems
878+ {
879+ public ICollection<RequestTrackerItem> Items = new Collection<RequestTrackerItem>();
880+
881+ public RequestTrackerItems () {
882+ RTPreferences prefs = new RTPreferences ();
883+
884+ if (prefs.URLs == "") {
885+ RequestTrackerItem defitem = new RequestTrackerItem (
886+ "No Trackers Configured",
887+ "Please use the GNOME Do Preferences to add some RT sites",
888+ "FAIL{0}");
889+ Items.Add (defitem);
890+ } else {
891+ string[] urlbits = prefs.URLs.Split('|');
892+ for (int i = 0; i < urlbits.Length; i++) {
893+ string name = urlbits[i];
894+ string uri = urlbits[++i];
895+ Uri url;
896+ try {
897+ url = new System.Uri(uri);
898+ } catch (System.UriFormatException) {
899+ continue;
900+ }
901+ string description = url.Scheme + url.Host;
902+
903+ Items.Add (new RequestTrackerItem (name, description, url.ToString ()));
904+ }
905+ }
906+ }
907+ }
908+}
909
910=== modified file 'configure.ac'
911--- configure.ac 2009-02-06 19:37:09 +0000
912+++ configure.ac 2009-03-09 10:15:27 +0000
913@@ -170,6 +170,7 @@
914 SqueezeCenter/Makefile
915 SSH/Makefile
916 StockQuote/Makefile
917+RequestTracker/Makefile
918 SystemServices/Makefile
919 Tasque/Makefile
920 TerminalServerClient/Makefile

Subscribers

People subscribed via source and target branches