Merge lp://qastaging/~jonathanlambrechts/do-plugins/chromium into lp://qastaging/do-plugins

Proposed by Jonathan Lambrechts
Status: Merged
Merge reported by: Alex Launi
Merged at revision: not available
Proposed branch: lp://qastaging/~jonathanlambrechts/do-plugins/chromium
Merge into: lp://qastaging/do-plugins
Diff against target: None lines
To merge this branch: bzr merge lp://qastaging/~jonathanlambrechts/do-plugins/chromium
Reviewer Review Type Date Requested Status
Alex Launi (community) Approve
Review via email: mp+9265@code.qastaging.launchpad.net
To post a comment you must log in.
Revision history for this message
Jonathan Lambrechts (jonathanlambrechts) wrote :

Hello,
this is a plugin to parse chromium bookmarks.
The plugin is really simple.
I tried to follow the guidelines as best as I can but this is my first c# code ...
I think the configuration for autotools is ok but I'm not completely sure about monodevelop.

Jonathan

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

Looks great! I made a couple of small style changes but really nothing major. Merging into trunk. Thanks a lot!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'Chromium'
2=== added file 'Chromium/Chromium.mdp'
3--- Chromium/Chromium.mdp 1970-01-01 00:00:00 +0000
4+++ Chromium/Chromium.mdp 2009-07-24 22:17:38 +0000
5@@ -0,0 +1,26 @@
6+<Project name="Chromium" fileversion="2.0" language="C#" targetFramework="3.5" ctype="DotNetProject">
7+ <Configurations active="Debug">
8+ <Configuration name="Debug" ctype="DotNetProjectConfiguration">
9+ <Output directory="bin/Debug" assembly="Chromium" />
10+ <Build debugmode="True" target="Library" />
11+ <Execution runwithwarnings="True" consolepause="True" runtime="MsNet" />
12+ <CodeGeneration compiler="Mcs" warninglevel="4" optimize="False" unsafecodeallowed="False" generateoverflowchecks="False" definesymbols="DEBUG" generatexmldocumentation="False" ctype="CSharpCompilerParameters" />
13+ </Configuration>
14+ <Configuration name="Release" ctype="DotNetProjectConfiguration">
15+ <Output directory="bin/Release" assembly="Chromium" />
16+ <Build debugmode="False" target="Library" />
17+ <Execution runwithwarnings="True" consolepause="False" runtime="MsNet" />
18+ <CodeGeneration compiler="Mcs" warninglevel="4" optimize="False" unsafecodeallowed="False" generateoverflowchecks="False" generatexmldocumentation="False" ctype="CSharpCompilerParameters" />
19+ </Configuration>
20+ </Configurations>
21+ <Contents>
22+ <File name="src/ChromiumBookmarkItemSource.cs" subtype="Code" buildaction="Compile" />
23+ <File name="Resources/Chromium.addin.xml" subtype="Code" buildaction="Nothing" />
24+ </Contents>
25+ <References>
26+ <ProjectReference type="Gac" localcopy="True" refto="Mono.Addins, Version=0.4.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />
27+ <ProjectReference type="Gac" localcopy="True" refto="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
28+ <ProjectReference type="Gac" localcopy="True" refto="Do.Platform, Version=0.9.0.0, Culture=neutral" />
29+ <ProjectReference type="Gac" localcopy="True" refto="Do.Universe, Version=0.9.0.0, Culture=neutral" />
30+ </References>
31+</Project>
32\ No newline at end of file
33
34=== added file 'Chromium/Makefile.am'
35--- Chromium/Makefile.am 1970-01-01 00:00:00 +0000
36+++ Chromium/Makefile.am 2009-07-24 17:22:10 +0000
37@@ -0,0 +1,17 @@
38+include $(top_srcdir)/build.rules.mk
39+
40+ASSEMBLY=Chromium
41+
42+FILES = \
43+ src/ChromiumBookmarkItemSource.cs
44+
45+RESOURCES = \
46+ Resources/Chromium.addin.xml
47+
48+REFERENCES = \
49+ System \
50+ System.Core \
51+ System.Data \
52+ Mono.Data.SqliteClient \
53+ $(DO_PLATFORM_LIBS) \
54+ $(DO_UNIVERSE_LIBS)
55
56=== added directory 'Chromium/Resources'
57=== added file 'Chromium/Resources/Chromium.addin.xml.in'
58--- Chromium/Resources/Chromium.addin.xml.in 1970-01-01 00:00:00 +0000
59+++ Chromium/Resources/Chromium.addin.xml.in 2009-07-24 17:22:10 +0000
60@@ -0,0 +1,25 @@
61+<Addin
62+ id="Chromium"
63+ namespace="Do"
64+ version="1.0"
65+ name="Chromium"
66+ description="Search your Chromium bookmarks."
67+ author="Jonathan Lambrechts"
68+ category="Community"
69+ defaultEnabled="false"
70+>
71+
72+ <Runtime>
73+ <Import assembly="Chromium.dll"/>
74+ </Runtime>
75+
76+ <Localizer type="Gettext" catalog="gnome-do-plugins" location="@expanded_datadir@/locale" />
77+
78+ <Dependencies>
79+ <Addin id="Universe" version="1.0" />
80+ </Dependencies>
81+
82+ <Extension path="/Do/ItemSource">
83+ <ItemSource type="Chromium.ChromiumBookmarkItemSource" />
84+ </Extension>
85+</Addin>
86
87=== added directory 'Chromium/src'
88=== added file 'Chromium/src/ChromiumBookmarkItemSource.cs'
89--- Chromium/src/ChromiumBookmarkItemSource.cs 1970-01-01 00:00:00 +0000
90+++ Chromium/src/ChromiumBookmarkItemSource.cs 2009-07-24 22:17:38 +0000
91@@ -0,0 +1,99 @@
92+/* ChromiumBookmarkItemSource.cs
93+ *
94+ * GNOME Do is the legal property of its developers. Please refer to the
95+ * COPYRIGHT file distributed with this
96+ * source distribution.
97+ *
98+ * This program is free software: you can redistribute it and/or modify
99+ * it under the terms of the GNU General Public License as published by
100+ * the Free Software Foundation, either version 3 of the License, or
101+ * (at your option) any later version.
102+ *
103+ * This program is distributed in the hope that it will be useful,
104+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
105+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
106+ * GNU General Public License for more details.
107+ *
108+ * You should have received a copy of the GNU General Public License
109+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
110+ */
111+using System;
112+using System.Collections.Generic;
113+using System.IO;
114+using System.Text.RegularExpressions;
115+
116+using Mono.Addins;
117+
118+using Do.Platform;
119+using Do.Universe;
120+using Do.Universe.Common;
121+
122+namespace Chromium {
123+
124+ public class ChromiumBookmarkItemSource : ItemSource {
125+
126+ List<Item> items;
127+
128+ public ChromiumBookmarkItemSource ()
129+ {
130+ items = new List<Item> ();
131+ }
132+
133+ public override string Name {
134+ get { return AddinManager.CurrentLocalizer.GetString ("Chromium Bookmarks"); }
135+ }
136+
137+ public override string Description {
138+ get { return AddinManager.CurrentLocalizer.GetString ("Indexes your Chromium bookmarks"); }
139+ }
140+
141+ public override string Icon {
142+ get { return "chromium-browser"; }
143+ }
144+
145+ public override IEnumerable<Type> SupportedItemTypes {
146+ get { yield return typeof (BookmarkItem); }
147+ }
148+
149+ public override IEnumerable<Item> Items {
150+ get { return items; }
151+ }
152+
153+ public override void UpdateItems ()
154+ {
155+ string home = Environment.GetFolderPath (Environment.SpecialFolder.Personal);
156+ string bookmarksFile = "~/.config/chromium/Default/Bookmarks".Replace ("~", home);
157+ try {
158+ string type = "";
159+ string name = "";
160+ string url = "";
161+ items.Clear ();
162+ Regex RE = new Regex ("(\"([^\"]*)\" *: *\"([^\"]*)\")|[{}]", RegexOptions.Multiline);
163+ FileStream fs = new FileStream (bookmarksFile, FileMode.Open,FileAccess.Read);
164+ StreamReader reader = new StreamReader (fs);
165+ foreach (Match m in RE.Matches (reader.ReadToEnd ())) {
166+ if (m.Value == "{") {
167+ type = "";
168+ name = "";
169+ url = "";
170+ }
171+ if (m.Value == "}" && type == "url" && name != "" && url != "") {
172+ items.Add (new BookmarkItem (name, url));
173+ }
174+ if (m.Value.StartsWith("\"")) {
175+ if (m.Groups[2].Value == "url")
176+ url = m.Groups[3].Value;
177+ if (m.Groups[2].Value == "name")
178+ name = m.Groups[3].Value;
179+ if (m.Groups[2].Value == "type")
180+ type = m.Groups[3].Value;
181+ }
182+ }
183+ }
184+ catch (Exception e) {
185+ Log.Error ("Could not read Chromium Bookmarks file {0}: {1}", bookmarksFile, e.Message);
186+ Log.Debug (e.StackTrace);
187+ }
188+ }
189+ }
190+}
191\ No newline at end of file
192
193=== modified file 'DoPlugins.mds'
194--- DoPlugins.mds 2009-07-11 16:57:37 +0000
195+++ DoPlugins.mds 2009-07-24 22:17:38 +0000
196@@ -75,6 +75,7 @@
197 <Entry build="True" name="Dropbox" configuration="Debug" />
198 <Entry build="True" name="RemindMe" configuration="Debug" />
199 <Entry build="True" name="Baconator" configuration="Debug" />
200+ <Entry build="True" name="Chromium" configuration="Debug" />
201 </Configuration>
202 <Configuration name="Release" ctype="CombineConfiguration">
203 <Entry build="True" name="Rhythmbox" configuration="Release" />
204@@ -145,13 +146,13 @@
205 <Entry build="True" name="xmms2" configuration="Release" />
206 <Entry build="True" name="TinyUrl" configuration="Release" />
207 <Entry build="True" name="Tracker" configuration="Release" />
208-
209 <Entry build="True" name="XRandR" configuration="Release" />
210 <Entry build="True" name="YouTube" configuration="Release" />
211 <Entry build="True" name="Emesene" configuration="Release" />
212 <Entry build="True" name="Dropbox" configuration="Release" />
213 <Entry build="True" name="RemindMe" configuration="Release" />
214 <Entry build="True" name="Baconator" configuration="Release" />
215+ <Entry build="True" name="Chromium" configuration="Release" />
216 </Configuration>
217 </Configurations>
218 <StartMode startupentry="Rhythmbox" single="True">
219@@ -229,6 +230,7 @@
220 <Execute type="None" entry="Dropbox" />
221 <Execute type="None" entry="RemindMe" />
222 <Execute type="None" entry="Baconator" />
223+ <Execute type="None" entry="Chromium" />
224 </StartMode>
225 <MonoDevelop.ChangeLogAddIn.ChangeLogInfo policy="UpdateNearestChangeLog" />
226 <Entries>
227@@ -306,5 +308,6 @@
228 <Entry filename="Dropbox/Dropbox.mdp" />
229 <Entry filename="RemindMe/RemindMe.mdp" />
230 <Entry filename="Baconator/Baconator.mdp" />
231+ <Entry filename="Chromium/Chromium.mdp" />
232 </Entries>
233 </Combine>
234\ No newline at end of file
235
236=== modified file 'Makefile.am'
237--- Makefile.am 2009-07-11 16:57:37 +0000
238+++ Makefile.am 2009-07-24 17:30:10 +0000
239@@ -13,6 +13,7 @@
240 Cl.ickable \
241 ClawsMail \
242 Confluence \
243+ Chromium \
244 Del.icio.us \
245 DiskMounter \
246 Dropbox \
247
248=== modified file 'configure.ac'
249--- configure.ac 2009-07-11 16:57:37 +0000
250+++ configure.ac 2009-07-24 17:22:10 +0000
251@@ -252,6 +252,8 @@
252 Banshee/Resources/Banshee.addin.xml
253 Bibtex/Makefile
254 Bibtex/Resources/Bibtex.addin.xml
255+Chromium/Makefile
256+Chromium/Resources/Chromium.addin.xml
257 Cl.ickable/Makefile
258 Cl.ickable/Resources/Cl.ickable.addin.xml
259 ClawsMail/Makefile

Subscribers

People subscribed via source and target branches