glib r7252 - in trunk: docs/reference/gio gio
- From: davidz svn gnome org
- To: svn-commits-list gnome org
- Subject: glib r7252 - in trunk: docs/reference/gio gio
- Date: Thu, 24 Jul 2008 21:21:22 +0000 (UTC)
Author: davidz
Date: Thu Jul 24 21:21:22 2008
New Revision: 7252
URL: http://svn.gnome.org/viewvc/glib?rev=7252&view=rev
Log:
2008-07-24 David Zeuthen <davidz redhat com>
* gmount.[ch]:
* gio.symbols:
Also export a g_mount_guess_content_type_sync() function.
Modified:
trunk/docs/reference/gio/gio-sections.txt
trunk/gio/ChangeLog
trunk/gio/gio.symbols
trunk/gio/gmount.c
trunk/gio/gmount.h
Modified: trunk/docs/reference/gio/gio-sections.txt
==============================================================================
--- trunk/docs/reference/gio/gio-sections.txt (original)
+++ trunk/docs/reference/gio/gio-sections.txt Thu Jul 24 21:21:22 2008
@@ -816,6 +816,7 @@
g_mount_eject_finish
g_mount_guess_content_type
g_mount_guess_content_type_finish
+g_mount_guess_content_type_sync
<SUBSECTION Standard>
G_IS_MOUNT
G_MOUNT
Modified: trunk/gio/gio.symbols
==============================================================================
--- trunk/gio/gio.symbols (original)
+++ trunk/gio/gio.symbols Thu Jul 24 21:21:22 2008
@@ -718,6 +718,7 @@
g_mount_remount_finish
g_mount_guess_content_type
g_mount_guess_content_type_finish
+g_mount_guess_content_type_sync
#endif
#endif
Modified: trunk/gio/gmount.c
==============================================================================
--- trunk/gio/gmount.c (original)
+++ trunk/gio/gmount.c Thu Jul 24 21:21:22 2008
@@ -570,9 +570,10 @@
* memory cards. See the <ulink url="http://www.freedesktop.org/wiki/Specifications/shared-mime-info-spec">shared-mime-info</ulink>
* specification for more on x-content types.
*
- * This is an asynchronous operation, and is finished by calling
- * g_mount_guess_content_type_finish() with the @mount and #GAsyncResult
- * data returned in the @callback.
+ * This is an asynchronous operation (see
+ * g_mount_guess_content_type_sync() for the synchronous version), and
+ * is finished by calling g_mount_guess_content_type_finish() with the
+ * @mount and #GAsyncResult data returned in the @callback.
*
* Since: 2.18
*/
@@ -644,6 +645,55 @@
return (* iface->guess_content_type_finish) (mount, result, error);
}
+/**
+ * g_mount_guess_content_type_sync:
+ * @mount: a #GMount
+ * @force_rescan: Whether to force a rescan of the content.
+ * Otherwise a cached result will be used if available
+ * @cancellable: optional #GCancellable object, %NULL to ignore
+ * @error: a #GError location to store the error occuring, or %NULL to
+ * ignore
+ *
+ * Tries to guess the type of content stored on @mount. Returns one or
+ * more textual identifiers of well-known content types (typically
+ * prefixed with "x-content/"), e.g. x-content/image-dcf for camera
+ * memory cards. See the <ulink url="http://www.freedesktop.org/wiki/Specifications/shared-mime-info-spec">shared-mime-info</ulink>
+ * specification for more on x-content types.
+ *
+ * This is an synchronous operation and as such may block doing IO;
+ * see g_mount_guess_content_type() for the asynchronous version.
+ *
+ * Returns: a %NULL-terminated array of content types or %NULL on error.
+ * Caller should free this array with g_strfreev() when done with it.
+ *
+ * Since: 2.18
+ */
+char **
+g_mount_guess_content_type_sync (GMount *mount,
+ gboolean force_rescan,
+ GCancellable *cancellable,
+ GError **error)
+{
+ GMountIface *iface;
+
+ g_return_val_if_fail (G_IS_MOUNT (mount), NULL);
+
+ iface = G_MOUNT_GET_IFACE (mount);
+
+ if (iface->guess_content_type_sync == NULL)
+ {
+ g_set_error_literal (error,
+ G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
+ /* Translators: This is an error
+ * message for mount objects that
+ * don't implement content type guessing. */
+ _("mount doesn't implement synchronous content type guessing"));
+
+ return NULL;
+ }
+
+ return (* iface->guess_content_type_sync) (mount, force_rescan, cancellable, error);
+}
#define __G_MOUNT_C__
#include "gioaliasdef.c"
Modified: trunk/gio/gmount.h
==============================================================================
--- trunk/gio/gmount.h (original)
+++ trunk/gio/gmount.h Thu Jul 24 21:21:22 2008
@@ -119,6 +119,11 @@
gchar ** (*guess_content_type_finish) (GMount *mount,
GAsyncResult *result,
GError **error);
+
+ gchar ** (*guess_content_type_sync) (GMount *mount,
+ gboolean force_rescan,
+ GCancellable *cancellable,
+ GError **error);
};
GType g_mount_get_type (void) G_GNUC_CONST;
@@ -166,6 +171,11 @@
GAsyncResult *result,
GError **error);
+gchar ** g_mount_guess_content_type_sync (GMount *mount,
+ gboolean force_rescan,
+ GCancellable *cancellable,
+ GError **error);
+
G_END_DECLS
#endif /* __G_MOUNT_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]