Changeset 960
- Timestamp:
- 09/15/06 01:01:56
- Files:
-
- trunk/ChangeLog (modified) (1 diff)
- trunk/docs/devel/reference/tmpl/tny-session-camel-priv.sgml (modified) (2 diffs)
- trunk/libtinymail-gnomevfs/tny-vfs-stream.c (modified) (8 diffs)
- trunk/libtinymail-gnomevfs/tny-vfs-stream.h (modified) (1 diff)
- trunk/libtinymail-test/Makefile.am (modified) (1 diff)
- trunk/libtinymail-test/tny-test-anything.c (modified) (4 diffs)
- trunk/libtinymailui-gtk/tny-gtk-save-strategy.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/ChangeLog
r958 r960 3 3 * Bugfixes in the list types found after improving a few unit tests 4 4 * Bugfixes in the stream types found after improving a few unit tests 5 * Fixed the TnyFsStream, TnyGtkTextBufferStream and TnyVfsStream types 5 6 6 7 2006-09-13 Philip Van Hoof <pvanhoof@gnome.org> trunk/docs/devel/reference/tmpl/tny-session-camel-priv.sgml
r953 r960 10 10 </para> 11 11 12 13 12 <!-- ##### SECTION See_Also ##### --> 14 13 <para> … … 16 15 </para> 17 16 18 19 17 <!-- ##### SECTION Stability_Level ##### --> 20 18 trunk/libtinymail-gnomevfs/tny-vfs-stream.c
r900 r960 199 199 if (G_LIKELY (res == GNOME_VFS_OK)) 200 200 { 201 priv->eos = FALSE; 201 gchar buf[1]; GnomeVFSResult res2; 202 GnomeVFSFileSize curpos, cnt; 203 gnome_vfs_tell (priv->handle, &curpos); 204 res2 = gnome_vfs_read (priv->handle, buf, 1, &cnt); 205 gnome_vfs_seek (priv->handle, GNOME_VFS_SEEK_START, curpos); 206 if (res2 == GNOME_VFS_ERROR_EOF) 207 priv->eos = TRUE; 208 else priv->eos = FALSE; 209 202 210 return (ssize_t)count; 203 211 … … 227 235 228 236 res = gnome_vfs_write (priv->handle, buffer, n, &count); 237 priv->eos = FALSE; 229 238 if (G_LIKELY (res == GNOME_VFS_OK)) 230 239 return (ssize_t)count; … … 251 260 252 261 priv->handle = NULL; 253 262 priv->eos = TRUE; 263 254 264 if (res == GNOME_VFS_OK) 255 265 return 0; … … 260 270 } 261 271 262 /*263 264 static off_t265 tny_vfs_stream_seek (TnySeekableStream *stream, off_t offset, TnyStreamSeekPolicy policy)266 {267 TnyVfsStreamPriv *priv = TNY_VFS_STREAM_GET_PRIVATE (self);268 GnomeVFSSeekPosition vpolicy;269 GnomeVFSFileSize pos;270 GnomeVFSResult res;271 272 if (priv->handle == NULL)273 {274 errno = EINVAL;275 return -1;276 }277 278 switch (policy)279 {280 case TNY_STREAM_SET:281 default:282 vpolicy = GNOME_VFS_SEEK_START;283 break;284 case TNY_STREAM_CUR:285 vpolicy = GNOME_VFS_SEEK_CURRENT;286 break;287 case TNY_STREAM_END:288 vpolicy = GNOME_VFS_SEEK_END;289 break;290 }291 292 if ( (res = gnome_vfs_seek (priv->handle, vpolicy, offset)) == GNOME_VFS_OK293 && (res = gnome_vfs_tell(priv->handle, &pos)) == GNOME_VFS_OK)294 return pos;295 296 tny_vfs_stream_set_errno (res);297 298 return -1;299 }300 301 static off_t302 tny_vfs_stream_tell (TnySeekableStream *stream)303 {304 TnyVfsStreamPriv *priv = TNY_VFS_STREAM_GET_PRIVATE (self);305 GnomeVFSFileSize pos;306 GnomeVFSResult res;307 308 if (priv->handle == NULL)309 {310 errno = EINVAL;311 return -1;312 }313 314 if ((res = gnome_vfs_tell (priv->handle, &pos)) == GNOME_VFS_OK)315 return pos;316 317 tny_vfs_stream_set_errno (res);318 319 return -1;320 }321 322 */323 272 324 273 /** … … 339 288 340 289 priv->handle = handle; 341 290 priv->eos = FALSE; 291 342 292 return; 343 293 } … … 351 301 * Return value: a new #TnyStream instance 352 302 **/ 353 Tny VfsStream*303 TnyStream* 354 304 tny_vfs_stream_new (GnomeVFSHandle *handle) 355 305 { … … 358 308 tny_vfs_stream_set_handle (self, handle); 359 309 360 return self;310 return TNY_STREAM (self); 361 311 } 362 312 … … 421 371 retval = -1; 422 372 } 423 373 priv->eos = FALSE; 374 424 375 return retval; 425 376 } trunk/libtinymail-gnomevfs/tny-vfs-stream.h
r900 r960 50 50 51 51 GType tny_vfs_stream_get_type (void); 52 Tny VfsStream*tny_vfs_stream_new (GnomeVFSHandle *handle);52 TnyStream* tny_vfs_stream_new (GnomeVFSHandle *handle); 53 53 54 54 void tny_vfs_stream_set_handle (TnyVfsStream *self, GnomeVFSHandle *handle); trunk/libtinymail-test/Makefile.am
r959 r960 6 6 -I$(top_srcdir)/libtinymailui \ 7 7 -I$(top_srcdir)/libtinymailui-gtk \ 8 -I$(top_srcdir)/libtinymail-camel 8 -I$(top_srcdir)/libtinymail-camel \ 9 -I$(top_srcdir)/libtinymail-gnomevfs 9 10 10 11 if BUILD_GNOME trunk/libtinymail-test/tny-test-anything.c
r959 r960 15 15 #include <tny-test-stream.h> 16 16 #include <tny-fs-stream.h> 17 #include <tny-vfs-stream.h> 17 18 18 static TnyStream *cmstream = NULL, * fstream, *tbstream = NULL, *source = NULL;19 static TnyStream *cmstream = NULL, *vfsstream = NULL, *fstream, *tbstream = NULL, *source = NULL; 19 20 20 21 … … 25 26 gchar *tmpl = g_strdup ("/tmp/tinymail-stream-test.XXXXXX"); 26 27 gint filed = g_mkstemp (tmpl); 28 gchar *gvfs = g_strdup_printf ("file://%s", tmpl); 29 GnomeVFSHandle *handle; 30 GnomeVFSResult result; 27 31 28 32 if (filed == -1) … … 32 36 33 37 gtk_init (&argc, &argv); 34 g_thread_init (NULL); 38 gnome_vfs_init (); 39 40 close (filed); 35 41 42 result = gnome_vfs_create (&handle,gvfs,GNOME_VFS_OPEN_WRITE|GNOME_VFS_OPEN_READ,FALSE,0777); 36 43 view = GTK_TEXT_VIEW (gtk_text_view_new ()); 37 44 buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)); … … 46 53 source = TNY_STREAM (tny_test_stream_new ()); 47 54 fstream = tny_fs_stream_new (filed); 55 if (result == GNOME_VFS_OK) 56 vfsstream = tny_vfs_stream_new (handle); 57 else printf ("Problem with vfs (%s, %d, %d)\n", gvfs,result,GNOME_VFS_ERROR_INVALID_OPEN_MODE); 48 58 49 TnyStream *streams [1] = { fstream };59 TnyStream *streams [1] = { vfsstream }; 50 60 int te=0; 51 61 trunk/libtinymailui-gtk/tny-gtk-save-strategy.c
r908 r960 57 57 GnomeVFSResult result; 58 58 GnomeVFSHandle *handle; 59 Tny VfsStream *stream = NULL;59 TnyStream *stream = NULL; 60 60 61 61 result = gnome_vfs_create (&handle, uri, … … 66 66 67 67 stream = tny_vfs_stream_new (handle); 68 tny_mime_part_decode_to_stream (part, TNY_STREAM (stream));68 tny_mime_part_decode_to_stream (part, stream); 69 69 70 70 /* This also closes the gnome-vfs handle (maybe it shouldn't?) */
