~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/gspreadsheet/cellfeed.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 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
 
 
16
using System;
 
17
using System.Collections;
 
18
using System.Text;
 
19
using System.Xml;
 
20
using System.Net;
 
21
using Google.GData.Client;
 
22
using Google.GData.Extensions;
 
23
 
 
24
namespace Google.GData.Spreadsheets
 
25
{
 
26
    /// <summary>
 
27
    /// Feed API customization class for defining a Cells feed.
 
28
    /// </summary>
 
29
    public class CellFeed : AbstractFeed
 
30
    {
 
31
 
 
32
        /// <summary>
 
33
        /// Constructor
 
34
        /// </summary>
 
35
        /// <param name="uriBase">The uri for this cells feed.</param>
 
36
        /// <param name="iService">The Spreadsheets service.</param>
 
37
        public CellFeed(Uri uriBase, IService iService) : base(uriBase, iService)
 
38
        {
 
39
            this.AddExtension(new ColCountElement());
 
40
            this.AddExtension(new RowCountElement());
 
41
        }
 
42
 
 
43
        /// <summary>
 
44
        /// The number of rows in this cell feed, as a RowCountElement
 
45
        /// </summary>
 
46
        public RowCountElement RowCount
 
47
        {
 
48
            get
 
49
            {
 
50
                return FindExtension(GDataSpreadsheetsNameTable.XmlRowCountElement,
 
51
                                     GDataSpreadsheetsNameTable.NSGSpreadsheets) as RowCountElement;
 
52
            }
 
53
        }
 
54
 
 
55
        /// <summary>
 
56
        /// The number of columns in this cell feed, as a ColCountElement
 
57
        /// </summary>
 
58
        public ColCountElement ColCount
 
59
        {
 
60
            get
 
61
            {
 
62
                return FindExtension(GDataSpreadsheetsNameTable.XmlColCountElement,
 
63
                                     GDataSpreadsheetsNameTable.NSGSpreadsheets) as ColCountElement;
 
64
            }
 
65
        }
 
66
 
 
67
   
 
68
        /// <summary>checks if this is a namespace 
 
69
        /// decl that we already added</summary> 
 
70
        /// <param name="node">XmlNode to check</param>
 
71
        /// <returns>true if this node should be skipped </returns>
 
72
        protected override bool SkipNode(XmlNode node)
 
73
        {
 
74
            if (base.SkipNode(node) == true)
 
75
            {
 
76
                return true;
 
77
            }
 
78
 
 
79
            return node.NodeType == XmlNodeType.Attribute
 
80
            && (node.Name.StartsWith("xmlns") == true)
 
81
            && (String.Compare(node.Value, GDataSpreadsheetsNameTable.NSGSpreadsheets) == 0);
 
82
        }
 
83
 
 
84
        /// <summary>
 
85
        /// creates our cellfeed type entry
 
86
        /// </summary>
 
87
        /// <returns>AtomEntry</returns>
 
88
        public override AtomEntry CreateFeedEntry()
 
89
        {
 
90
            return new CellEntry();
 
91
        }
 
92
 
 
93
        /// <summary>
 
94
        /// returns an update URI for a given row/column combination
 
95
        /// in general that URI is based on the feeds POST feed plus the
 
96
        /// cell address in RnCn notation:
 
97
        /// http://spreadsheets.google.com/feeds/cells/key/worksheetId/private/full/cell
 
98
        /// </summary>
 
99
        /// <param name="row"></param>
 
100
        /// <param name="column"></param>
 
101
        /// <returns>string</returns>
 
102
        [CLSCompliant(false)]
 
103
        public string CellUri(uint row, uint column)
 
104
        {
 
105
            string target = this.Post;
 
106
            if (!target.EndsWith("/"))
 
107
            {
 
108
                target += "/";
 
109
            }
 
110
            target += "R" + row.ToString() + "C" + column.ToString();
 
111
            return target;
 
112
        }
 
113
   
 
114
        /// <summary>
 
115
        /// returns the given CellEntry object. Note that the getter will go to the server
 
116
        /// to get CellEntries that are NOT yet on the client
 
117
        /// </summary>
 
118
        /// <returns>CellEntry</returns>
 
119
        [CLSCompliant(false)]
 
120
        public CellEntry this[uint row, uint column]
 
121
        {
 
122
            get 
 
123
            {
 
124
                // let's find the cell
 
125
                foreach (CellEntry entry in this.Entries )
 
126
                {
 
127
                    CellEntry.CellElement cell = entry.Cell;
 
128
                    if (cell.Row == row && cell.Column == column)
 
129
                    {
 
130
                        return entry; 
 
131
                    }
 
132
                }
 
133
                // if we are here, we need to get the entry from the service
 
134
                string url = CellUri(row, column);
 
135
                CellQuery query = new CellQuery(url);
 
136
 
 
137
                CellFeed feed = this.Service.Query(query) as CellFeed;
 
138
                CellEntry newEntry = feed.Entries[0] as CellEntry;
 
139
                this.Entries.Add(newEntry);
 
140
                // we don't want this one to show up in the batch feed on it's own
 
141
                newEntry.Dirty = false;
 
142
                return newEntry;
 
143
            }
 
144
        }
 
145
 
 
146
 
 
147
        /// <summary>
 
148
        /// deletes a cell by using row and column addressing
 
149
        /// </summary>
 
150
        /// <param name="row"></param>
 
151
        /// <param name="column"></param>
 
152
        [CLSCompliant(false)]
 
153
        public void Delete(uint row, uint column)
 
154
        {
 
155
            // now we need to create a new guy
 
156
            string url = CellUri(row, column);
 
157
            this.Service.Delete(new Uri(url));
 
158
        }
 
159
 
 
160
        //////////////////////////////////////////////////////////////////////
 
161
        /// <summary>uses GData batch to batchupdate the cell feed. If the returned
 
162
        /// batch result set contained an error, it will throw a GDataRequestBatchException</summary> 
 
163
        /// <returns> </returns>
 
164
        //////////////////////////////////////////////////////////////////////
 
165
        public override void Publish()
 
166
        {
 
167
            if (this.Batch == null)
 
168
            {
 
169
                throw new InvalidOperationException("This feed has no batch URI");
 
170
            }
 
171
 
 
172
            AtomFeed batchFeed = CreateBatchFeed(GDataBatchOperationType.update);
 
173
            if (batchFeed != null)
 
174
            {
 
175
                AtomFeed resultFeed = this.Service.Batch(batchFeed, new Uri(this.Batch));
 
176
                foreach (AtomEntry resultEntry in resultFeed.Entries )
 
177
                {
 
178
                    GDataBatchEntryData data = resultEntry.BatchData;
 
179
                    if (data.Status.Code != (int) HttpStatusCode.OK)
 
180
                    {
 
181
                        throw new GDataBatchRequestException(resultFeed);
 
182
                    }
 
183
                }
 
184
 
 
185
                // if we get here, everything is fine. So update the edit URIs in the original feed,
 
186
                // because those might have changed. 
 
187
                foreach (AtomEntry resultEntry in resultFeed.Entries )
 
188
                {
 
189
                    AtomEntry originalEntry = this.Entries.FindById(resultEntry.Id);
 
190
                    if (originalEntry == null)
 
191
                    {
 
192
                        throw new GDataBatchRequestException(resultFeed);
 
193
                    }
 
194
                    if (originalEntry != null)
 
195
                    {
 
196
                        originalEntry.EditUri = resultEntry.EditUri;
 
197
                    }
 
198
                }
 
199
               
 
200
            }
 
201
            this.Dirty = false; 
 
202
        }
 
203
        /////////////////////////////////////////////////////////////////////////////
 
204
 
 
205
    }
 
206
}