Editing Documentation/Maemo 5 Developer Guide/Using Generic Platform Components/GnomeVFS File System

Warning: You are not logged in. Your IP address will be recorded in this page's edit history.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 38: Line 38:
* Notification about loading success and failures will be communicated to the user by using a widget called <code>HildonBanner</code>, which will float a small notification dialog (with an optional icon) in the top-right corner for a while, without blocking the application.
* Notification about loading success and failures will be communicated to the user by using a widget called <code>HildonBanner</code>, which will float a small notification dialog (with an optional icon) in the top-right corner for a while, without blocking the application.
* N.B. Saving into a file is not implemented in this code, as it is a lab exercise (and it is simpler than opening).
* N.B. Saving into a file is not implemented in this code, as it is a lab exercise (and it is simpler than opening).
-
* File loading failures can be simulated by attempting to load an empty file. Since empty files are not wanted, the code will turn this into an error as well. If no empty file is available, one can easily be created with the touch command (under <code>MyDocs</code>, so that the open dialog can find it). It is also possible to attempt to load a file larger than 100 KiB, since the code limits the file size (artificially), and will refuse to load large files.
+
* File loading failures can be simulated by attempting to load an empty file. Since empty files are not wanted, the code will turn this into an error as well. If no empty file is available, one can easily be created with the touch command (under '''MyDocs''', so that the open dialog can find it). It is also possible to attempt to load a file larger than 100 KiB, since the code limits the file size (artificially), and will refuse to load large files.
* The <code>goto</code> statement should normally be avoided. Team coding guidelines should be checked to see, whether this is an allowed practice. Note how it is used in this example to cut down the possibility of leaked resources (and typing). Another option for this would be using variable finalizers, but not many people know how to use them, or even that they exist. They are gcc extensions into the C language, and you can find more about them by reading gcc info pages (look for variable attributes).
* The <code>goto</code> statement should normally be avoided. Team coding guidelines should be checked to see, whether this is an allowed practice. Note how it is used in this example to cut down the possibility of leaked resources (and typing). Another option for this would be using variable finalizers, but not many people know how to use them, or even that they exist. They are gcc extensions into the C language, and you can find more about them by reading gcc info pages (look for variable attributes).
* Simple GnomeVFS functions are used here. They are all synchronous, which means that if loading the file takes a long time, the application will remain unresponsive during that time. For small files residing in local storage, this is a risk that is taken knowingly. Synchronous API should not be used when loading files over network due to the greater uncertainty.
* Simple GnomeVFS functions are used here. They are all synchronous, which means that if loading the file takes a long time, the application will remain unresponsive during that time. For small files residing in local storage, this is a risk that is taken knowingly. Synchronous API should not be used when loading files over network due to the greater uncertainty.
Line 399: Line 399:
</source>
</source>
-
In order to experiment with loading other content, a simple file can be created, containing Pango markup like this:
+
In order to experiment with loading other content, a simple file can be created, containing Pango markup like this: '''echo "&lt;b&gt;Hello world&lt;/b&gt;" &gt; MyDocs/hello.txt''' , and then loading <code>hello.txt</code>.
-
<source lang="bash">
+
-
echo "<b>Hello world</b>" > MyDocs/hello.txt
+
-
</source>
+
-
and then loading <code>hello.txt</code>.
+
As can be imagined, these examples have only scratched the surface of GnomeVFS that is quite a rich library, and contains a broad API and a large amount of plug-ins. Many things have been completely avoided, such as directory content iteration, the asynchronous interface, callback signaling on directory content changes etc. Please see [http://library.gnome.org/devel/gnome-vfs-2.0/stable/ GnomeVFS API reference] for more information. The API also contains some mini tutorials on various GnomeVFS topics, so it is well worth the time spent reading. It will also show that GnomeVFS has been overloaded with functions, which are not even file operation related (such as ZeroConf and creating TCP/IP connections etc.).
As can be imagined, these examples have only scratched the surface of GnomeVFS that is quite a rich library, and contains a broad API and a large amount of plug-ins. Many things have been completely avoided, such as directory content iteration, the asynchronous interface, callback signaling on directory content changes etc. Please see [http://library.gnome.org/devel/gnome-vfs-2.0/stable/ GnomeVFS API reference] for more information. The API also contains some mini tutorials on various GnomeVFS topics, so it is well worth the time spent reading. It will also show that GnomeVFS has been overloaded with functions, which are not even file operation related (such as ZeroConf and creating TCP/IP connections etc.).

Learn more about Contributing to the wiki.


Please note that all contributions to maemo.org wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see maemo.org wiki:Copyrights for details). Do not submit copyrighted work without permission!


Cancel | Editing help (opens in new window)