~ubuntu-branches/ubuntu/jaunty/gnome-do-plugins/jaunty-proposed

« back to all changes in this revision

Viewing changes to BundledLibraries/libgoogle-data-mono-1.4.0.2/src/extensions/entrylink.cs

  • Committer: Bazaar Package Importer
  • Author(s): Iain Lane, Daniel T Chen, Iain Lane
  • Date: 2009-03-18 00:40:51 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20090318004051-ujn1ja3kiu3ky7ru
Tags: 0.8.1.3+dfsg-0ubuntu1
[ Daniel T Chen ]
* New upstream release (LP: #344578)
  + Banshee plugin goes crazy if banshee isn't loaded first
    (LP: #289802)
  + gnome-do gCalculate plugin fails to display "times" symbol
    (LP: #274252)
  + Banshee-1 fails to build in Mono 2.0 (LP: #309188)
  + Pidgin 2.5.4 has incompatible dbus interface. s/uint/int/
    (LP: #314927)
  + Pidgin plugin hangs opening a chat if pidgin is unresponsive
    (LP: #315565)
  + twitter plugin still reports friend updates even when
    deactivated (LP: #317674)
  + Misspelling in microblogging plugin confirmation message
    (LP: #319433)
  + make install uses mdtool, but configure doesn't check for it
    (LP: #322951)
  + Virtualbox Icon in 2.10 are broken because of a new
    specification (LP: #323902)
  + Google Maps Plugin shouldn't always use route (LP: #324271)
  + Fix for Google Maps when using newlines and other special
    characters (LP: #324667)
  + VirtualBox failed to load icon (LP: #325712)
  + 'Read Man Pages' plugin makes Gnome-Do unresponsive
    (LP: #325935)
  + Search returns broken URLs (LP: #327855)
  + Default action for SSH hosts is "open" (LP: #328236)
  + Files and Folders Configuration doesn't use standard buttons
    (LP: #328236)
  + Window manager maximize action should focus if window is not
    currently focused (LP: #258893)
  + Locate plugin has no error message (LP: #262360)
  + Wishlist: Let user specify files and folders to ignore
    (LP: #263177)
  + ts-client plugin doesn't index subdirectories (LP: #322352)
  + Max 3000 items in Files and Folders plugin (LP: #324105)
  + putty cannot find host when running from gnome do
    (LP: #324282)
  + locate plugin with globbing (LP: #334798)
  + Twitter plugin encountered an error in UpdateFriends
    (LP: #317575)
  + gnome-terminal profiles no longer work (LP: #321977)
  + Creating a task using Remember the Milk plugin can fail if
    no task list is specified (LP: #324066)
  + bundled libraries makefile needs destdir (LP: #324704)
  + Typographical error in del.icio.us plugin (LP: #330525)
  + ImageShack fails to upload (LP: #337324)
* debian/copyright
  + Refresh for new upstream version; new plugins added.
* debian/patches/00_dfsg_autofoo.dpatch
  + Update for new upstream version
  + Don't build the YouTube plugin due to removal of shipped
    exes and dlls causing FTBFS
* debian/patches/02_ssh_respect_exec_arg.dpatch
  debian/patches/03_buildsystem_respect_mcs.dpatch
  debian/patches/04_fix_pidgin_dbus_ints.dpatch
  + Drop; fixed upstream

[ Iain Lane ]
* debian/rules: Update repackaging to not delete *.dll; upstream now ships
  source copies of google-gdata meaning we can now enable the Google and
  Youtube plugins.
* debian/patches/00_dfsg_autofoo: Drop, fixed by including and building
  these libs now. 
* debian/copyright: Update with information for google-gdata. 
* debian/patches/04_fix_pidgin_dbus_ints.dpatch: Add left out piece of patch
* debian/control: Bump gnome-do build-dep to require current version. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright (c) 2006-2008 Google Inc.
 
2
 *
 
3
 * Licensed under the Apache License, Version 2.0 (the "License");
 
4
 * you may not use this file except in compliance with the License.
 
5
 * You may obtain a copy of the License at
 
6
 *
 
7
 *     http://www.apache.org/licenses/LICENSE-2.0
 
8
 *
 
9
 * Unless required by applicable law or agreed to in writing, software
 
10
 * distributed under the License is distributed on an "AS IS" BASIS,
 
11
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
12
 * See the License for the specific language governing permissions and
 
13
 * limitations under the License.
 
14
*/
 
15
/* Change history
 
16
* Oct 13 2008  Joe Feser       joseph.feser@gmail.com
 
17
* Converted ArrayLists and other .NET 1.1 collections to use Generics
 
18
* Combined IExtensionElement and IExtensionElementFactory interfaces
 
19
 
20
*/
 
21
 
 
22
using System;
 
23
using System.IO;
 
24
using System.Collections;
 
25
using System.Text;
 
26
using System.Xml;
 
27
using Google.GData.Client;
 
28
 
 
29
namespace Google.GData.Extensions {
 
30
 
 
31
    /// <summary>
 
32
    /// GData schema extension describing a nested entry link.
 
33
    /// </summary>
 
34
    public class EntryLink : IExtensionElementFactory
 
35
    {
 
36
 
 
37
        /// <summary>holds the href property of the EntryLink element</summary>
 
38
        private string href;
 
39
        /// <summary>holds the readOnlySet property of the EntryLink element</summary>
 
40
        private bool readOnly;
 
41
        /// <summary>holds the AtomEntry  property of the EntryLink element</summary>
 
42
        private AtomEntry entry;
 
43
        /// <summary>holds the rel attribute of the EntyrLink element</summary> 
 
44
        private string rel;
 
45
 
 
46
        private bool readOnlySet; 
 
47
 
 
48
        /// <summary>
 
49
        /// Entry  URI
 
50
        /// </summary>
 
51
        public string Href
 
52
        {
 
53
            get { return href; }
 
54
            set { href = value; }
 
55
        }
 
56
 
 
57
        /// <summary>
 
58
        /// Read only flag.
 
59
        /// </summary>
 
60
        public bool ReadOnly
 
61
        {
 
62
            get { return this.readOnly; }
 
63
            set { this.readOnly = value; this.readOnlySet = true; }
 
64
        }
 
65
 
 
66
        /// <summary>
 
67
        ///  Nested entry (optional).
 
68
        /// </summary>
 
69
        public AtomEntry Entry
 
70
        {
 
71
            get { return entry; }
 
72
            set { entry = value; }
 
73
        }
 
74
 
 
75
         //////////////////////////////////////////////////////////////////////
 
76
        /// <summary>accessor method public string Rel</summary> 
 
77
        /// <returns> </returns>
 
78
        //////////////////////////////////////////////////////////////////////
 
79
        public string Rel
 
80
        {
 
81
            get {return this.rel;}
 
82
            set {this.rel = value;}
 
83
        }
 
84
        /////////////////////////////////////////////////////////////////////////////
 
85
 
 
86
 
 
87
        #region EntryLink Parser
 
88
        //////////////////////////////////////////////////////////////////////
 
89
        /// <summary>parses an xml node to create an EntryLink object</summary> 
 
90
        /// <param name="node">entrylink node</param>
 
91
        /// <param name="parser">AtomFeedParser to use</param>
 
92
        /// <returns> the created EntryLink object</returns>
 
93
        //////////////////////////////////////////////////////////////////////
 
94
        public static EntryLink ParseEntryLink(XmlNode node, AtomFeedParser parser)
 
95
        {
 
96
            Tracing.TraceCall();
 
97
            EntryLink link = null;
 
98
            Tracing.Assert(node != null, "node should not be null");
 
99
            if (node == null)
 
100
            {
 
101
                throw new ArgumentNullException("node");
 
102
            }
 
103
            
 
104
 
 
105
            object localname = node.LocalName;
 
106
            if (localname.Equals(GDataParserNameTable.XmlEntryLinkElement))
 
107
            {
 
108
                link = new EntryLink();
 
109
                if (node.Attributes != null)
 
110
                {
 
111
                    if (node.Attributes[GDataParserNameTable.XmlAttributeHref] != null)
 
112
                    {
 
113
                        link.Href = node.Attributes[GDataParserNameTable.XmlAttributeHref].Value;
 
114
                    }
 
115
 
 
116
                    if (node.Attributes[GDataParserNameTable.XmlAttributeReadOnly] != null)
 
117
                    {
 
118
                        link.ReadOnly = node.Attributes[GDataParserNameTable.XmlAttributeReadOnly].Value.Equals(Utilities.XSDTrue);
 
119
                    }
 
120
 
 
121
                    if (node.Attributes[GDataParserNameTable.XmlAttributeRel] != null)
 
122
                    {
 
123
                        link.Rel = node.Attributes[GDataParserNameTable.XmlAttributeRel].Value;
 
124
                    }
 
125
 
 
126
                }
 
127
 
 
128
                if (node.HasChildNodes)
 
129
                {
 
130
                    XmlNode entryChild = node.FirstChild;
 
131
 
 
132
                    while (entryChild != null && entryChild is XmlElement)
 
133
                    {
 
134
                        if (entryChild.LocalName == AtomParserNameTable.XmlAtomEntryElement &&
 
135
                            entryChild.NamespaceURI == BaseNameTable.NSAtom)
 
136
                        {
 
137
 
 
138
                            if (link.Entry == null)
 
139
                            {
 
140
                                XmlReader reader = new XmlNodeReader(entryChild);
 
141
                                // move the reader to the first node
 
142
                                reader.Read();
 
143
                                AtomFeedParser p = new AtomFeedParser(); 
 
144
                                p.NewAtomEntry += new FeedParserEventHandler(link.OnParsedNewEntry);
 
145
                                p.ParseEntry(reader); 
 
146
                            }
 
147
                            else
 
148
                            {
 
149
                                throw new ArgumentException("Only one entry is allowed inside the g:entryLink");
 
150
                            }
 
151
                        }
 
152
                        entryChild = entryChild.NextSibling;
 
153
                    }
 
154
                }
 
155
 
 
156
            }
 
157
 
 
158
            return link;
 
159
        }
 
160
 
 
161
 
 
162
        //////////////////////////////////////////////////////////////////////
 
163
        /// <summary>Event chaining. We catch this from the AtomFeedParser
 
164
        /// we want to set this to our property, and do not add the entry to the collection
 
165
        /// </summary> 
 
166
        /// <param name="sender"> the object which send the event</param>
 
167
        /// <param name="e">FeedParserEventArguments, holds the feed entry</param> 
 
168
        /// <returns> </returns>
 
169
        //////////////////////////////////////////////////////////////////////
 
170
        internal void OnParsedNewEntry(object sender, FeedParserEventArgs e)
 
171
        {
 
172
            // by default, if our event chain is not hooked, add it to the collection
 
173
            Tracing.TraceCall("received new item notification");
 
174
            Tracing.Assert(e != null, "e should not be null");
 
175
            if (e == null)
 
176
            {
 
177
                throw new ArgumentNullException("e"); 
 
178
            }
 
179
 
 
180
            if (e.CreatingEntry == false)
 
181
            {
 
182
                if (e.Entry != null)
 
183
                {
 
184
                    // add it to the collection
 
185
                    Tracing.TraceMsg("\t new EventEntry found"); 
 
186
                    this.Entry = e.Entry; 
 
187
                    e.DiscardEntry = true; 
 
188
                }
 
189
            }
 
190
        }
 
191
        /////////////////////////////////////////////////////////////////////////////
 
192
 
 
193
 
 
194
 
 
195
        #endregion
 
196
 
 
197
        #region overloaded for persistence
 
198
 
 
199
        //////////////////////////////////////////////////////////////////////
 
200
        /// <summary>Returns the constant representing this XML element.</summary> 
 
201
        //////////////////////////////////////////////////////////////////////
 
202
        public static string XmlName
 
203
        {
 
204
            get { return GDataParserNameTable.XmlEntryLinkElement; }
 
205
        }
 
206
 
 
207
        /// <summary>
 
208
        /// Used to save the EntryLink instance into the passed in xmlwriter
 
209
        /// </summary>
 
210
        /// <param name="writer">the XmlWriter to write into</param>
 
211
        public void Save(XmlWriter writer)
 
212
        {
 
213
            if (Utilities.IsPersistable(this.Href) ||
 
214
                this.readOnlySet ||
 
215
                this.entry != null) 
 
216
            {
 
217
                writer.WriteStartElement(XmlPrefix, XmlName, XmlNameSpace);
 
218
                if (Utilities.IsPersistable(this.Href))
 
219
                {
 
220
                    writer.WriteAttributeString(GDataParserNameTable.XmlAttributeHref, this.Href);
 
221
                }
 
222
                if (Utilities.IsPersistable(this.Rel))
 
223
                {
 
224
                    writer.WriteAttributeString(GDataParserNameTable.XmlAttributeRel, this.Rel);
 
225
                }
 
226
                if (this.readOnlySet)
 
227
                {
 
228
                    writer.WriteAttributeString(GDataParserNameTable.XmlAttributeReadOnly, 
 
229
                                                Utilities.ConvertBooleanToXSDString(this.ReadOnly));
 
230
                }
 
231
    
 
232
                if (entry != null)
 
233
                {
 
234
                    entry.SaveToXml(writer);
 
235
                }
 
236
                writer.WriteEndElement();
 
237
            }
 
238
        }
 
239
        #endregion
 
240
 
 
241
        #region IExtensionElementFactory Members
 
242
 
 
243
 
 
244
        /// <summary>
 
245
        ///  returns the xml local name for this element
 
246
        /// </summary>
 
247
        string IExtensionElementFactory.XmlName
 
248
        {
 
249
            get
 
250
            {
 
251
                return XmlName;
 
252
            }
 
253
        }
 
254
 
 
255
        /// <summary>
 
256
        /// returns the xml namespace for this element
 
257
        /// </summary>
 
258
        public string XmlNameSpace
 
259
        {
 
260
            get
 
261
            {
 
262
                return BaseNameTable.gNamespace;
 
263
            }
 
264
        }
 
265
 
 
266
        /// <summary>
 
267
        /// returns the xml prefix to be used for this element
 
268
        /// </summary>
 
269
        public string XmlPrefix
 
270
        {
 
271
            get
 
272
            {
 
273
                return BaseNameTable.gDataPrefix;
 
274
            }
 
275
        }
 
276
 
 
277
        /// <summary>
 
278
        /// factory method to create an instance of a batchinterrupt during parsing
 
279
        /// </summary>
 
280
        /// <param name="node">the xmlnode that is going to be parsed</param>
 
281
        /// <param name="parser">the feedparser that is used right now</param>
 
282
        /// <returns></returns>
 
283
        public IExtensionElementFactory CreateInstance(XmlNode node, AtomFeedParser parser)
 
284
        {
 
285
            return EntryLink.ParseEntryLink(node, parser);
 
286
        }
 
287
 
 
288
        #endregion
 
289
    }
 
290
}