2007-11-29 Matthias Clasen <mclasen@redhat.com>
+ * *.c: More coding style fixes.
+
+2007-11-29 Matthias Clasen <mclasen@redhat.com>
+
* gasyncresult.c: Add another paragraph to the intro,
adjust coding style of example.
res = flush_buffer (bstream, cancellable, error);
- if (res == FALSE) {
+ if (res == FALSE)
return FALSE;
- }
- res = g_output_stream_flush (base_stream,
- cancellable,
- error);
+ res = g_output_stream_flush (base_stream, cancellable, error);
+
return res;
}
/* report the first error but still close the stream */
if (res)
- {
- res = g_output_stream_close (base_stream,
- cancellable,
- error);
- }
+ res = g_output_stream_close (base_stream, cancellable, error);
else
- {
- g_output_stream_close (base_stream,
- cancellable,
- NULL);
- }
+ g_output_stream_close (base_stream, cancellable, NULL);
return res;
}
/* if flushing the buffer didn't work don't even bother
* to flush the stream but just report that error */
if (res && fdata->flush_stream)
- {
- res = g_output_stream_flush (base_stream,
- cancellable,
- &error);
- }
+ res = g_output_stream_flush (base_stream, cancellable, &error);
if (fdata->close_stream)
{
* an error report that first error but still try
* close the stream */
if (res == FALSE)
- {
- g_output_stream_close (base_stream,
- cancellable,
- NULL);
- }
+ g_output_stream_close (base_stream, cancellable, NULL);
else
- {
- res = g_output_stream_close (base_stream,
- cancellable,
- &error);
- }
-
+ res = g_output_stream_close (base_stream, cancellable, &error);
}
if (res == FALSE)
mimetype = g_strdup_printf ("application/x-extension-%s", extension);
- if (!g_file_test (filename, G_FILE_TEST_EXISTS)) {
- char *contents;
-
- contents =
- g_strdup_printf ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
- "<mime-info xmlns=\"http://www.freedesktop.org/standards/shared-mime-info\">\n"
- " <mime-type type=\"%s\">\n"
- " <comment>%s document</comment>\n"
- " <glob pattern=\"*.%s\"/>\n"
- " </mime-type>\n"
- "</mime-info>\n", mimetype, extension, extension);
-
- g_file_set_contents (filename, contents, -1, NULL);
- g_free (contents);
-
- run_update_command ("update-mime-database", "mime");
- }
+ if (!g_file_test (filename, G_FILE_TEST_EXISTS))
+ {
+ char *contents;
+
+ contents =
+ g_strdup_printf ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ "<mime-info xmlns=\"http://www.freedesktop.org/standards/shared-mime-info\">\n"
+ " <mime-type type=\"%s\">\n"
+ " <comment>%s document</comment>\n"
+ " <glob pattern=\"*.%s\"/>\n"
+ " </mime-type>\n"
+ "</mime-info>\n", mimetype, extension, extension);
+
+ g_file_set_contents (filename, contents, -1, NULL);
+ g_free (contents);
+
+ run_update_command ("update-mime-database", "mime");
+ }
g_free (filename);
res = g_desktop_app_info_set_as_default_for_type (appinfo,
/* Go through all entries that support the mimetype */
for (dir_list = mime_info_cache->dirs;
dir_list != NULL;
- dir_list = dir_list->next) {
- dir = dir_list->data;
+ dir_list = dir_list->next)
+ {
+ dir = dir_list->data;
- list = g_hash_table_lookup (dir->mime_info_cache_map, mime_type);
- for (tmp = list; tmp != NULL; tmp = tmp->next) {
- desktop_entries = append_desktop_entry (desktop_entries, tmp->data);
- }
- }
+ list = g_hash_table_lookup (dir->mime_info_cache_map, mime_type);
+ for (tmp = list; tmp != NULL; tmp = tmp->next)
+ desktop_entries = append_desktop_entry (desktop_entries, tmp->data);
+ }
}
G_UNLOCK (mime_info_cache);
descendant_dummy->decoded_uri != NULL)
{
if (uri_same_except_path (parent_dummy->decoded_uri,
- descendant_dummy->decoded_uri)) {
- remainder = match_prefix (descendant_dummy->decoded_uri->path,
- parent_dummy->decoded_uri->path);
- if (remainder != NULL && *remainder == '/')
- {
- while (*remainder == '/')
- remainder++;
- if (*remainder != 0)
- return TRUE;
- }
- }
+ descendant_dummy->decoded_uri))
+ {
+ remainder = match_prefix (descendant_dummy->decoded_uri->path,
+ parent_dummy->decoded_uri->path);
+ if (remainder != NULL && *remainder == '/')
+ {
+ while (*remainder == '/')
+ remainder++;
+ if (*remainder != 0)
+ return TRUE;
+ }
+ }
}
else
{
descendant_dummy->decoded_uri != NULL)
{
if (uri_same_except_path (parent_dummy->decoded_uri,
- descendant_dummy->decoded_uri)) {
- remainder = match_prefix (descendant_dummy->decoded_uri->path,
- parent_dummy->decoded_uri->path);
- if (remainder != NULL && *remainder == '/')
- {
- while (*remainder == '/')
- remainder++;
- if (*remainder != 0)
- return g_strdup (remainder);
- }
- }
+ descendant_dummy->decoded_uri))
+ {
+ remainder = match_prefix (descendant_dummy->decoded_uri->path,
+ parent_dummy->decoded_uri->path);
+ if (remainder != NULL && *remainder == '/')
+ {
+ while (*remainder == '/')
+ remainder++;
+ if (*remainder != 0)
+ return g_strdup (remainder);
+ }
+ }
}
else
{
static GFile *
-g_dummy_file_resolve_relative_path (GFile *file,
+g_dummy_file_resolve_relative_path (GFile *file,
const char *relative_path)
{
GDummyFile *dummy = G_DUMMY_FILE (file);
result = g_malloc (escaped_string_end - escaped_string + 1);
out = result;
- for (in = escaped_string; in < escaped_string_end; in++) {
- character = *in;
- if (*in == '%') {
- in++;
- if (escaped_string_end - in < 2)
- {
- g_free (result);
- return NULL;
- }
+ for (in = escaped_string; in < escaped_string_end; in++)
+ {
+ character = *in;
+ if (*in == '%')
+ {
+ in++;
+ if (escaped_string_end - in < 2)
+ {
+ g_free (result);
+ return NULL;
+ }
- character = unescape_character (in);
+ character = unescape_character (in);
- /* Check for an illegal character. We consider '\0' illegal here. */
- if (character <= 0 ||
- (illegal_characters != NULL &&
- strchr (illegal_characters, (char)character) != NULL))
- {
- g_free (result);
- return NULL;
- }
- in++; /* The other char will be eaten in the loop header */
+ /* Check for an illegal character. We consider '\0' illegal here. */
+ if (character <= 0 ||
+ (illegal_characters != NULL &&
+ strchr (illegal_characters, (char)character) != NULL))
+ {
+ g_free (result);
+ return NULL;
+ }
+ in++; /* The other char will be eaten in the loop header */
+ }
+ *out++ = (char)character;
}
- *out++ = (char)character;
- }
*out = '\0';
g_assert (out - result <= strlen (escaped_string));
* g_file_attribute_matcher_new:
* @attributes: an attribute string to match.
*
- * Creates a new file attribute matcher, which matches attributes against
- * a given string. #GFileAttributeMatcher<!-- -->s are reference counted structures,
- * and are created with a reference count of 1. If the number of references
- * falls to 0, the #GFileAttributeMatcher is automatically destroyed.
+ * Creates a new file attribute matcher, which matches attributes
+ * against a given string. #GFileAttributeMatcher<!-- -->s are reference
+ * counted structures, and are created with a reference count of 1. If
+ * the number of references falls to 0, the #GFileAttributeMatcher is
+ * automatically destroyed.
*
* The @attribute string should be formatted with specific keys separated
* from namespaces with a colon. Several "namespace:key" strings may be
* concatenated with a single comma (e.g. "std:type,std:is_hidden").
- * The wildcard "*" may be used to match all keys and namespaces, or "namespace:*" will
- * match all keys in a given namespace.
+ * The wildcard "*" may be used to match all keys and namespaces, or
+ * "namespace:*" will match all keys in a given namespace.
*
* Examples of strings to use:
* <table>
/**
* SECTION:gicon
- * @short_description: base class for icons
+ * @short_description: interface for icons
*
- * #GIcon is a base class for implementing more complex icon classes. It
- * contains a very minimal interface for checking the equality of two icons
- * and hashing of icons.
+ * #GIcon is a very minimal interface for icons. It provides functions
+ * for checking the equality of two icons and hashing of icons.
*
* #GIcon does not provide the actual pixmap for the icon as this is out
- * of gio's scope, however implementations of #GIcon may contain the name
+ * of GIO's scope, however implementations of #GIcon may contain the name
* of an icon (see #GThemedIcon), or the path to an icon (see #GLoadableIcon).
*
* To obtain a hash of a #GIcon, see g_icon_hash().
* @short_description: Loadable Icons
* @see_also: #GIcon, #GThemedIcon
*
- * Implements #GIcon and adds the ability to load icons.
- *
+ * Extends the #GIcon interface and adds the ability to load icons.
**/
static void g_loadable_icon_real_load_async (GLoadableIcon *icon,
iface = G_LOADABLE_ICON_GET_IFACE (icon);
return (* iface->load) (icon, size, type, cancellable, error);
-
}
/**
* Loads an icon asynchronously. To finish this function, see
* g_loadable_icon_load_finish(). For the synchronous, blocking
* version of this function, see g_loadable_icon_load().
- *
**/
void
g_loadable_icon_load_async (GLoadableIcon *icon,
iface = G_LOADABLE_ICON_GET_IFACE (icon);
(* iface->load_async) (icon, size, cancellable, callback, user_data);
-
}
/**
iface = G_LOADABLE_ICON_GET_IFACE (icon);
return (* iface->load_finish) (icon, res, type, error);
-
}
/********************************************
}
static void
-g_local_directory_monitor_set_property (GObject *object,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec)
+g_local_directory_monitor_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
switch (property_id)
{
}
static GObject *
-g_local_directory_monitor_constructor (GType type,
- guint n_construct_properties,
- GObjectConstructParam *construct_properties)
+g_local_directory_monitor_constructor (GType type,
+ guint n_construct_properties,
+ GObjectConstructParam *construct_properties)
{
GObject *obj;
GLocalDirectoryMonitorClass *klass;
static void
mounts_changed (GUnixMountMonitor *mount_monitor,
- gpointer user_data)
+ gpointer user_data)
{
GLocalDirectoryMonitor *local_monitor = user_data;
GUnixMount *mount;
static gint
_compare_monitor_class_by_prio (gconstpointer a,
gconstpointer b,
- gpointer user_data)
+ gpointer user_data)
{
GType *type1 = (GType *) a, *type2 = (GType *) b;
GLocalDirectoryMonitorClass *klass1, *klass2;
* Returns: new #GDirectoryMonitor for the given @dirname.
**/
GDirectoryMonitor*
-_g_local_directory_monitor_new (const char* dirname,
+_g_local_directory_monitor_new (const char* dirname,
GFileMonitorFlags flags)
{
static GOnce once_init = G_ONCE_INIT;
}
static gboolean
-g_local_file_has_uri_scheme (GFile *file,
+g_local_file_has_uri_scheme (GFile *file,
const char *uri_scheme)
{
return g_ascii_strcasecmp (uri_scheme, "file") == 0;
static gboolean
name_is_valid_for_display (const char *string,
- gboolean is_valid_utf8)
+ gboolean is_valid_utf8)
{
char c;
}
static const char *
-match_prefix (const char *path, const char *prefix)
+match_prefix (const char *path,
+ const char *prefix)
{
int prefix_len;
}
static GFile *
-g_local_file_resolve_relative_path (GFile *file,
+g_local_file_resolve_relative_path (GFile *file,
const char *relative_path)
{
GLocalFile *local = G_LOCAL_FILE (file);
}
static GFileEnumerator *
-g_local_file_enumerate_children (GFile *file,
- const char *attributes,
- GFileQueryInfoFlags flags,
- GCancellable *cancellable,
- GError **error)
+g_local_file_enumerate_children (GFile *file,
+ const char *attributes,
+ GFileQueryInfoFlags flags,
+ GCancellable *cancellable,
+ GError **error)
{
GLocalFile *local = G_LOCAL_FILE (file);
return _g_local_file_enumerator_new (local->filename,
{
/* filesystem ids taken from linux manpage */
- switch (f_type) {
- case 0xadf5:
- return "adfs";
- case 0xADFF:
- return "affs";
- case 0x42465331:
- return "befs";
- case 0x1BADFACE:
- return "bfs";
- case 0xFF534D42:
- return "cifs";
- case 0x73757245:
- return "coda";
- case 0x012FF7B7:
- return "coh";
- case 0x28cd3d45:
- return "cramfs";
- case 0x1373:
- return "devfs";
- case 0x00414A53:
- return "efs";
- case 0x137D:
- return "ext";
- case 0xEF51:
- return "ext2";
- case 0xEF53:
- return "ext3";
- case 0x4244:
- return "hfs";
- case 0xF995E849:
- return "hpfs";
- case 0x958458f6:
- return "hugetlbfs";
- case 0x9660:
- return "isofs";
- case 0x72b6:
- return "jffs2";
- case 0x3153464a:
- return "jfs";
- case 0x137F:
- return "minix";
- case 0x138F:
- return "minix2";
- case 0x2468:
- return "minix2";
- case 0x2478:
- return "minix22";
- case 0x4d44:
- return "msdos";
- case 0x564c:
- return "ncp";
- case 0x6969:
- return "nfs";
- case 0x5346544e:
- return "ntfs";
- case 0x9fa1:
- return "openprom";
- case 0x9fa0:
- return "proc";
- case 0x002f:
- return "qnx4";
- case 0x52654973:
- return "reiserfs";
- case 0x7275:
- return "romfs";
- case 0x517B:
- return "smb";
- case 0x012FF7B6:
- return "sysv2";
- case 0x012FF7B5:
- return "sysv4";
- case 0x01021994:
- return "tmpfs";
- case 0x15013346:
- return "udf";
- case 0x00011954:
- return "ufs";
- case 0x9fa2:
- return "usbdevice";
- case 0xa501FCF5:
- return "vxfs";
- case 0x012FF7B4:
- return "xenix";
- case 0x58465342:
- return "xfs";
- case 0x012FD16D:
- return "xiafs";
- default:
- return NULL;
- }
+ switch (f_type)
+ {
+ case 0xadf5:
+ return "adfs";
+ case 0xADFF:
+ return "affs";
+ case 0x42465331:
+ return "befs";
+ case 0x1BADFACE:
+ return "bfs";
+ case 0xFF534D42:
+ return "cifs";
+ case 0x73757245:
+ return "coda";
+ case 0x012FF7B7:
+ return "coh";
+ case 0x28cd3d45:
+ return "cramfs";
+ case 0x1373:
+ return "devfs";
+ case 0x00414A53:
+ return "efs";
+ case 0x137D:
+ return "ext";
+ case 0xEF51:
+ return "ext2";
+ case 0xEF53:
+ return "ext3";
+ case 0x4244:
+ return "hfs";
+ case 0xF995E849:
+ return "hpfs";
+ case 0x958458f6:
+ return "hugetlbfs";
+ case 0x9660:
+ return "isofs";
+ case 0x72b6:
+ return "jffs2";
+ case 0x3153464a:
+ return "jfs";
+ case 0x137F:
+ return "minix";
+ case 0x138F:
+ return "minix2";
+ case 0x2468:
+ return "minix2";
+ case 0x2478:
+ return "minix22";
+ case 0x4d44:
+ return "msdos";
+ case 0x564c:
+ return "ncp";
+ case 0x6969:
+ return "nfs";
+ case 0x5346544e:
+ return "ntfs";
+ case 0x9fa1:
+ return "openprom";
+ case 0x9fa0:
+ return "proc";
+ case 0x002f:
+ return "qnx4";
+ case 0x52654973:
+ return "reiserfs";
+ case 0x7275:
+ return "romfs";
+ case 0x517B:
+ return "smb";
+ case 0x012FF7B6:
+ return "sysv2";
+ case 0x012FF7B5:
+ return "sysv4";
+ case 0x01021994:
+ return "tmpfs";
+ case 0x15013346:
+ return "udf";
+ case 0x00011954:
+ return "ufs";
+ case 0x9fa2:
+ return "usbdevice";
+ case 0xa501FCF5:
+ return "vxfs";
+ case 0x012FF7B4:
+ return "xenix";
+ case 0x58465342:
+ return "xfs";
+ case 0x012FD16D:
+ return "xiafs";
+ default:
+ return NULL;
+ }
}
#endif
static gboolean
device_equal (gconstpointer v1,
- gconstpointer v2)
+ gconstpointer v2)
{
return *(dev_t *)v1 == * (dev_t *)v2;
}
static guint
-device_hash (gconstpointer v)
+device_hash (gconstpointer v)
{
return (guint) *(dev_t *)v;
}
static void
-get_mount_info (GFileInfo *fs_info,
- const char *path,
+get_mount_info (GFileInfo *fs_info,
+ const char *path,
GFileAttributeMatcher *matcher)
{
struct stat buf;
}
static GFileInfo *
-g_local_file_query_filesystem_info (GFile *file,
- const char *attributes,
- GCancellable *cancellable,
- GError **error)
+g_local_file_query_filesystem_info (GFile *file,
+ const char *attributes,
+ GCancellable *cancellable,
+ GError **error)
{
GLocalFile *local = G_LOCAL_FILE (file);
GFileInfo *info;
}
static GVolume *
-g_local_file_find_enclosing_volume (GFile *file,
- GCancellable *cancellable,
- GError **error)
+g_local_file_find_enclosing_volume (GFile *file,
+ GCancellable *cancellable,
+ GError **error)
{
GLocalFile *local = G_LOCAL_FILE (file);
struct stat buf;
}
static GFile *
-g_local_file_set_display_name (GFile *file,
- const char *display_name,
- GCancellable *cancellable,
- GError **error)
+g_local_file_set_display_name (GFile *file,
+ const char *display_name,
+ GCancellable *cancellable,
+ GError **error)
{
GLocalFile *local, *new_local;
GFile *new_file, *parent;
}
static GFileAttributeInfoList *
-g_local_file_query_settable_attributes (GFile *file,
- GCancellable *cancellable,
- GError **error)
+g_local_file_query_settable_attributes (GFile *file,
+ GCancellable *cancellable,
+ GError **error)
{
return g_file_attribute_info_list_ref (local_writable_attributes);
}
static GFileAttributeInfoList *
-g_local_file_query_writable_namespaces (GFile *file,
- GCancellable *cancellable,
- GError **error)
+g_local_file_query_writable_namespaces (GFile *file,
+ GCancellable *cancellable,
+ GError **error)
{
return g_file_attribute_info_list_ref (local_writable_namespaces);
}
static gboolean
-g_local_file_set_attribute (GFile *file,
- const char *attribute,
- const GFileAttributeValue *value,
- GFileQueryInfoFlags flags,
- GCancellable *cancellable,
- GError **error)
+g_local_file_set_attribute (GFile *file,
+ const char *attribute,
+ const GFileAttributeValue *value,
+ GFileQueryInfoFlags flags,
+ GCancellable *cancellable,
+ GError **error)
{
GLocalFile *local = G_LOCAL_FILE (file);
}
static gboolean
-g_local_file_set_attributes_from_info (GFile *file,
- GFileInfo *info,
- GFileQueryInfoFlags flags,
- GCancellable *cancellable,
- GError **error)
+g_local_file_set_attributes_from_info (GFile *file,
+ GFileInfo *info,
+ GFileQueryInfoFlags flags,
+ GCancellable *cancellable,
+ GError **error)
{
GLocalFile *local = G_LOCAL_FILE (file);
int res, chained_res;
}
static GFileInputStream *
-g_local_file_read (GFile *file,
- GCancellable *cancellable,
- GError **error)
+g_local_file_read (GFile *file,
+ GCancellable *cancellable,
+ GError **error)
{
GLocalFile *local = G_LOCAL_FILE (file);
int fd;
}
static GFileOutputStream *
-g_local_file_append_to (GFile *file,
- GFileCreateFlags flags,
- GCancellable *cancellable,
- GError **error)
+g_local_file_append_to (GFile *file,
+ GFileCreateFlags flags,
+ GCancellable *cancellable,
+ GError **error)
{
return _g_local_file_output_stream_append (G_LOCAL_FILE (file)->filename,
flags, cancellable, error);
}
static GFileOutputStream *
-g_local_file_create (GFile *file,
- GFileCreateFlags flags,
- GCancellable *cancellable,
- GError **error)
+g_local_file_create (GFile *file,
+ GFileCreateFlags flags,
+ GCancellable *cancellable,
+ GError **error)
{
return _g_local_file_output_stream_create (G_LOCAL_FILE (file)->filename,
flags, cancellable, error);
}
static GFileOutputStream *
-g_local_file_replace (GFile *file,
- const char *etag,
- gboolean make_backup,
- GFileCreateFlags flags,
- GCancellable *cancellable,
- GError **error)
+g_local_file_replace (GFile *file,
+ const char *etag,
+ gboolean make_backup,
+ GFileCreateFlags flags,
+ GCancellable *cancellable,
+ GError **error)
{
return _g_local_file_output_stream_replace (G_LOCAL_FILE (file)->filename,
etag, make_backup, flags,
static gboolean
-g_local_file_delete (GFile *file,
- GCancellable *cancellable,
- GError **error)
+g_local_file_delete (GFile *file,
+ GCancellable *cancellable,
+ GError **error)
{
GLocalFile *local = G_LOCAL_FILE (file);
}
static char *
-get_parent (const char *path, dev_t *parent_dev)
+get_parent (const char *path,
+ dev_t *parent_dev)
{
char *parent, *tmp;
struct stat parent_stat;
}
static char *
-find_mountpoint_for (const char *file, dev_t dev)
+find_mountpoint_for (const char *file,
+ dev_t dev)
{
char *dir, *parent;
dev_t dir_dev, parent_dev;
dir = g_strdup (file);
dir_dev = dev;
- while (1) {
- parent = get_parent (dir, &parent_dev);
- if (parent == NULL)
- return dir;
+ while (1)
+ {
+ parent = get_parent (dir, &parent_dev);
+ if (parent == NULL)
+ return dir;
- if (parent_dev != dir_dev)
- {
- g_free (parent);
- return dir;
- }
+ if (parent_dev != dir_dev)
+ {
+ g_free (parent);
+ return dir;
+ }
- g_free (dir);
- dir = parent;
- }
+ g_free (dir);
+ dir = parent;
+ }
}
static char *
}
static char *
-get_unique_filename (const char *basename, int id)
+get_unique_filename (const char *basename,
+ int id)
{
const char *dot;
}
static gboolean
-path_has_prefix (const char *path, const char *prefix)
+path_has_prefix (const char *path,
+ const char *prefix)
{
int prefix_len;
}
static char *
-try_make_relative (const char *path, const char *base)
+try_make_relative (const char *path,
+ const char *base)
{
char *path2, *base2;
char *relative;
}
static gboolean
-g_local_file_trash (GFile *file,
- GCancellable *cancellable,
- GError **error)
+g_local_file_trash (GFile *file,
+ GCancellable *cancellable,
+ GError **error)
{
GLocalFile *local = G_LOCAL_FILE (file);
struct stat file_stat, home_stat, trash_stat, global_stat;
}
static gboolean
-g_local_file_make_directory (GFile *file,
- GCancellable *cancellable,
- GError **error)
+g_local_file_make_directory (GFile *file,
+ GCancellable *cancellable,
+ GError **error)
{
GLocalFile *local = G_LOCAL_FILE (file);
}
static gboolean
-g_local_file_make_symbolic_link (GFile *file,
- const char *symlink_value,
- GCancellable *cancellable,
- GError **error)
+g_local_file_make_symbolic_link (GFile *file,
+ const char *symlink_value,
+ GCancellable *cancellable,
+ GError **error)
{
#ifdef HAVE_SYMLINK
GLocalFile *local = G_LOCAL_FILE (file);
static gboolean
-g_local_file_copy (GFile *source,
- GFile *destination,
- GFileCopyFlags flags,
- GCancellable *cancellable,
- GFileProgressCallback progress_callback,
- gpointer progress_callback_data,
- GError **error)
+g_local_file_copy (GFile *source,
+ GFile *destination,
+ GFileCopyFlags flags,
+ GCancellable *cancellable,
+ GFileProgressCallback progress_callback,
+ gpointer progress_callback_data,
+ GError **error)
{
/* Fall back to default copy */
g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED, "Copy not supported");
}
static gboolean
-g_local_file_move (GFile *source,
- GFile *destination,
- GFileCopyFlags flags,
- GCancellable *cancellable,
- GFileProgressCallback progress_callback,
- gpointer progress_callback_data,
- GError **error)
+g_local_file_move (GFile *source,
+ GFile *destination,
+ GFileCopyFlags flags,
+ GCancellable *cancellable,
+ GFileProgressCallback progress_callback,
+ gpointer progress_callback_data,
+ GError **error)
{
GLocalFile *local_source = G_LOCAL_FILE (source);
GLocalFile *local_destination = G_LOCAL_FILE (destination);
static GDirectoryMonitor*
-g_local_file_monitor_dir (GFile* file,
- GFileMonitorFlags flags,
- GCancellable *cancellable)
+g_local_file_monitor_dir (GFile *file,
+ GFileMonitorFlags flags,
+ GCancellable *cancellable)
{
GLocalFile* local_file = G_LOCAL_FILE(file);
return _g_local_directory_monitor_new (local_file->filename, flags);
}
static GFileMonitor*
-g_local_file_monitor_file (GFile* file,
- GFileMonitorFlags flags,
- GCancellable *cancellable)
+g_local_file_monitor_file (GFile *file,
+ GFileMonitorFlags flags,
+ GCancellable *cancellable)
{
GLocalFile* local_file = G_LOCAL_FILE(file);
return _g_local_file_monitor_new (local_file->filename, flags);
static void
convert_file_to_io_error (GError **error,
- GError *file_error)
+ GError *file_error)
{
int new_code;
new_code = G_IO_ERROR_FAILED;
- if (file_error->domain == G_FILE_ERROR) {
- switch (file_error->code) {
- case G_FILE_ERROR_NOENT:
- new_code = G_IO_ERROR_NOT_FOUND;
- break;
- case G_FILE_ERROR_ACCES:
- new_code = G_IO_ERROR_PERMISSION_DENIED;
- break;
- case G_FILE_ERROR_NOTDIR:
- new_code = G_IO_ERROR_NOT_DIRECTORY;
- break;
- default:
- break;
+ if (file_error->domain == G_FILE_ERROR)
+ {
+ switch (file_error->code)
+ {
+ case G_FILE_ERROR_NOENT:
+ new_code = G_IO_ERROR_NOT_FOUND;
+ break;
+ case G_FILE_ERROR_ACCES:
+ new_code = G_IO_ERROR_PERMISSION_DENIED;
+ break;
+ case G_FILE_ERROR_NOTDIR:
+ new_code = G_IO_ERROR_NOT_DIRECTORY;
+ break;
+ default:
+ break;
+ }
}
- }
g_set_error (error, G_IO_ERROR,
new_code,
}
GFileEnumerator *
-_g_local_file_enumerator_new (const char *filename,
- const char *attributes,
- GFileQueryInfoFlags flags,
- GCancellable *cancellable,
- GError **error)
+_g_local_file_enumerator_new (const char *filename,
+ const char *attributes,
+ GFileQueryInfoFlags flags,
+ GCancellable *cancellable,
+ GError **error)
{
GLocalFileEnumerator *local;
GDir *dir;
dir_error = NULL;
dir = g_dir_open (filename, 0, error != NULL ? &dir_error : NULL);
- if (dir == NULL) {
- convert_file_to_io_error (error, dir_error);
- g_error_free (dir_error);
- return NULL;
- }
+ if (dir == NULL)
+ {
+ convert_file_to_io_error (error, dir_error);
+ g_error_free (dir_error);
+ return NULL;
+ }
local = g_object_new (G_TYPE_LOCAL_FILE_ENUMERATOR, NULL);
}
static GFileInfo *
-g_local_file_enumerator_next_file (GFileEnumerator *enumerator,
+g_local_file_enumerator_next_file (GFileEnumerator *enumerator,
GCancellable *cancellable,
- GError **error)
+ GError **error)
{
GLocalFileEnumerator *local = G_LOCAL_FILE_ENUMERATOR (enumerator);
const char *filename;
}
static gboolean
-g_local_file_enumerator_close (GFileEnumerator *enumerator,
+g_local_file_enumerator_close (GFileEnumerator *enumerator,
GCancellable *cancellable,
GError **error)
{
/* Get the SELinux security context */
static void
-get_selinux_context (const char *path,
- GFileInfo *info,
+get_selinux_context (const char *path,
+ GFileInfo *info,
GFileAttributeMatcher *attribute_matcher,
- gboolean follow_symlinks)
+ gboolean follow_symlinks)
{
#ifdef HAVE_SELINUX
char *context;
}
static char *
-hex_escape_string (const char *str, gboolean *free_return)
+hex_escape_string (const char *str,
+ gboolean *free_return)
{
int num_invalid, i;
char *escaped_str, *p;
}
static char *
-hex_unescape_string (const char *str, int *out_len, gboolean *free_return)
+hex_unescape_string (const char *str,
+ int *out_len,
+ gboolean *free_return)
{
int i;
char *unescaped_str, *p;
}
static void
-escape_xattr (GFileInfo *info,
+escape_xattr (GFileInfo *info,
const char *gio_attr, /* gio attribute name */
const char *value, /* Is zero terminated */
- size_t len /* not including zero termination */)
+ size_t len /* not including zero termination */)
{
char *escaped_val;
gboolean free_escaped_val;
static void
get_one_xattr (const char *path,
- GFileInfo *info,
+ GFileInfo *info,
const char *gio_attr,
const char *xattr,
- gboolean follow_symlinks)
+ gboolean follow_symlinks)
{
char value[64];
char *value_p;
#endif /* defined HAVE_XATTR */
static void
-get_xattrs (const char *path,
- gboolean user,
- GFileInfo *info,
+get_xattrs (const char *path,
+ gboolean user,
+ GFileInfo *info,
GFileAttributeMatcher *matcher,
- gboolean follow_symlinks)
+ gboolean follow_symlinks)
{
#ifdef HAVE_XATTR
gboolean all;
#ifdef HAVE_XATTR
static void
-get_one_xattr_from_fd (int fd,
- GFileInfo *info,
+get_one_xattr_from_fd (int fd,
+ GFileInfo *info,
const char *gio_attr,
const char *xattr)
{
#endif /* defined HAVE_XATTR */
static void
-get_xattrs_from_fd (int fd,
- gboolean user,
- GFileInfo *info,
+get_xattrs_from_fd (int fd,
+ gboolean user,
+ GFileInfo *info,
GFileAttributeMatcher *matcher)
{
#ifdef HAVE_XATTR
#ifdef HAVE_XATTR
static gboolean
-set_xattr (char *filename,
- const char *escaped_attribute,
- const GFileAttributeValue *attr_value,
- GError **error)
+set_xattr (char *filename,
+ const char *escaped_attribute,
+ const GFileAttributeValue *attr_value,
+ GError **error)
{
char *attribute, *value;
gboolean free_attribute, free_value;
attribute = hex_unescape_string (escaped_attribute, NULL, &free_attribute);
value = hex_unescape_string (attr_value->u.string, &val_len, &free_value);
-
if (is_user)
a = g_strconcat ("user.", attribute, NULL);
else
void
-_g_local_file_info_get_parent_info (const char *dir,
- GFileAttributeMatcher *attribute_matcher,
- GLocalParentFileInfo *parent_info)
+_g_local_file_info_get_parent_info (const char *dir,
+ GFileAttributeMatcher *attribute_matcher,
+ GLocalParentFileInfo *parent_info)
{
struct stat statbuf;
int res;
static void
get_access_rights (GFileAttributeMatcher *attribute_matcher,
- GFileInfo *info,
- const gchar *path,
- struct stat *statbuf,
- GLocalParentFileInfo *parent_info)
+ GFileInfo *info,
+ const gchar *path,
+ struct stat *statbuf,
+ GLocalParentFileInfo *parent_info)
{
if (g_file_attribute_matcher_matches (attribute_matcher,
G_FILE_ATTRIBUTE_ACCESS_CAN_READ))
}
static void
-set_info_from_stat (GFileInfo *info, struct stat *statbuf,
+set_info_from_stat (GFileInfo *info,
+ struct stat *statbuf,
GFileAttributeMatcher *attribute_matcher)
{
GFileType file_type;
}
static char *
-get_content_type (const char *basename,
- const char *path,
- struct stat *statbuf,
- gboolean is_symlink,
- gboolean symlink_broken,
- GFileQueryInfoFlags flags,
- gboolean fast)
+get_content_type (const char *basename,
+ const char *path,
+ struct stat *statbuf,
+ gboolean is_symlink,
+ gboolean symlink_broken,
+ GFileQueryInfoFlags flags,
+ gboolean fast)
{
if (is_symlink &&
(symlink_broken || (flags & G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS)))
}
static char *
-thumb_digest_to_ascii (unsigned char digest[16], const char *suffix)
+thumb_digest_to_ascii (unsigned char digest[16],
+ const char *suffix)
{
static const char hex_digits[] = "0123456789abcdef";
char *res;
res = g_malloc (33 + strlen (suffix));
- for (i = 0; i < 16; i++) {
- res[2*i] = hex_digits[digest[i] >> 4];
- res[2*i+1] = hex_digits[digest[i] & 0xf];
- }
+ for (i = 0; i < 16; i++)
+ {
+ res[2*i] = hex_digits[digest[i] >> 4];
+ res[2*i+1] = hex_digits[digest[i] & 0xf];
+ }
res[32] = 0;
static void
get_thumbnail_attributes (const char *path,
- GFileInfo *info)
+ GFileInfo *info)
{
char *uri;
unsigned char digest[16];
GFileInfo *
-_g_local_file_info_get (const char *basename,
- const char *path,
- GFileAttributeMatcher *attribute_matcher,
- GFileQueryInfoFlags flags,
- GLocalParentFileInfo *parent_info,
- GError **error)
+_g_local_file_info_get (const char *basename,
+ const char *path,
+ GFileAttributeMatcher *attribute_matcher,
+ GFileQueryInfoFlags flags,
+ GLocalParentFileInfo *parent_info,
+ GError **error)
{
GFileInfo *info;
struct stat statbuf;
}
GFileInfo *
-_g_local_file_info_get_from_fd (int fd,
- char *attributes,
+_g_local_file_info_get_from_fd (int fd,
+ char *attributes,
GError **error)
{
struct stat stat_buf;
}
static gboolean
-get_uint32 (const GFileAttributeValue *value,
- guint32 *val_out,
- GError **error)
+get_uint32 (const GFileAttributeValue *value,
+ guint32 *val_out,
+ GError **error)
{
if (value->type != G_FILE_ATTRIBUTE_TYPE_UINT32)
{
}
static gboolean
-get_uint64 (const GFileAttributeValue *value,
- guint64 *val_out,
- GError **error)
+get_uint64 (const GFileAttributeValue *value,
+ guint64 *val_out,
+ GError **error)
{
if (value->type != G_FILE_ATTRIBUTE_TYPE_UINT64)
{
#if defined(HAVE_SYMLINK)
static gboolean
-get_byte_string (const GFileAttributeValue *value,
- const char **val_out,
- GError **error)
+get_byte_string (const GFileAttributeValue *value,
+ const char **val_out,
+ GError **error)
{
if (value->type != G_FILE_ATTRIBUTE_TYPE_BYTE_STRING)
{
#endif
static gboolean
-set_unix_mode (char *filename,
- const GFileAttributeValue *value,
- GError **error)
+set_unix_mode (char *filename,
+ const GFileAttributeValue *value,
+ GError **error)
{
guint32 val;
#ifdef HAVE_CHOWN
static gboolean
-set_unix_uid_gid (char *filename,
- const GFileAttributeValue *uid_value,
- const GFileAttributeValue *gid_value,
- GFileQueryInfoFlags flags,
- GError **error)
+set_unix_uid_gid (char *filename,
+ const GFileAttributeValue *uid_value,
+ const GFileAttributeValue *gid_value,
+ GFileQueryInfoFlags flags,
+ GError **error)
{
int res;
guint32 val;
#ifdef HAVE_SYMLINK
static gboolean
-set_symlink (char *filename,
- const GFileAttributeValue *value,
- GError **error)
+set_symlink (char *filename,
+ const GFileAttributeValue *value,
+ GError **error)
{
const char *val;
struct stat statbuf;
#endif
static int
-lazy_stat (char *filename, struct stat *statbuf, gboolean *called_stat)
+lazy_stat (char *filename,
+ struct stat *statbuf,
+ gboolean *called_stat)
{
int res;
#ifdef HAVE_UTIMES
static gboolean
-set_mtime_atime (char *filename,
- const GFileAttributeValue *mtime_value,
- const GFileAttributeValue *mtime_usec_value,
- const GFileAttributeValue *atime_value,
- const GFileAttributeValue *atime_usec_value,
- GError **error)
+set_mtime_atime (char *filename,
+ const GFileAttributeValue *mtime_value,
+ const GFileAttributeValue *mtime_usec_value,
+ const GFileAttributeValue *atime_value,
+ const GFileAttributeValue *atime_usec_value,
+ GError **error)
{
int res;
guint64 val;
#endif
gboolean
-_g_local_file_info_set_attribute (char *filename,
- const char *attribute,
- const GFileAttributeValue *value,
- GFileQueryInfoFlags flags,
- GCancellable *cancellable,
- GError **error)
+_g_local_file_info_set_attribute (char *filename,
+ const char *attribute,
+ const GFileAttributeValue *value,
+ GFileQueryInfoFlags flags,
+ GCancellable *cancellable,
+ GError **error)
{
if (strcmp (attribute, G_FILE_ATTRIBUTE_UNIX_MODE) == 0)
return set_unix_mode (filename, value, error);
}
gboolean
-_g_local_file_info_set_attributes (char *filename,
- GFileInfo *info,
- GFileQueryInfoFlags flags,
- GCancellable *cancellable,
- GError **error)
+_g_local_file_info_set_attributes (char *filename,
+ GFileInfo *info,
+ GFileQueryInfoFlags flags,
+ GCancellable *cancellable,
+ GError **error)
{
GFileAttributeValue *value, *uid, *gid;
GFileAttributeValue *mtime, *mtime_usec, *atime, *atime_usec;
* Note: this code is harmless on little-endian machines.
*/
static void
-byteReverse(unsigned char *buf, unsigned longs)
+byteReverse (unsigned char *buf,
+ unsigned longs)
{
guint32 t;
do {
*/
static void
thumb_md5_update (struct ThumbMD5Context *ctx,
- unsigned char const *buf,
- unsigned len)
+ unsigned char const *buf,
+ unsigned len)
{
guint32 t;
* 1 0* (64-bit count of bits processed, MSB-first)
*/
static void
-thumb_md5_final (unsigned char digest[16], struct ThumbMD5Context *ctx)
+thumb_md5_final (unsigned char digest[16],
+ struct ThumbMD5Context *ctx)
{
unsigned count;
unsigned char *p;
* the data and converts bytes into longwords for this routine.
*/
static void
-thumb_md5_transform (guint32 buf[4], guint32 const in[16])
+thumb_md5_transform (guint32 buf[4],
+ guint32 const in[16])
{
register guint32 a, b, c, d;
}
static gssize
-g_local_file_input_stream_read (GInputStream *stream,
- void *buffer,
- gsize count,
- GCancellable *cancellable,
- GError **error)
+g_local_file_input_stream_read (GInputStream *stream,
+ void *buffer,
+ gsize count,
+ GCancellable *cancellable,
+ GError **error)
{
GLocalFileInputStream *file;
gssize res;
}
static gssize
-g_local_file_input_stream_skip (GInputStream *stream,
- gsize count,
- GCancellable *cancellable,
- GError **error)
+g_local_file_input_stream_skip (GInputStream *stream,
+ gsize count,
+ GCancellable *cancellable,
+ GError **error)
{
off_t res, start;
GLocalFileInputStream *file;
}
static gboolean
-g_local_file_input_stream_close (GInputStream *stream,
- GCancellable *cancellable,
- GError **error)
+g_local_file_input_stream_close (GInputStream *stream,
+ GCancellable *cancellable,
+ GError **error)
{
GLocalFileInputStream *file;
int res;
{
res = close (file->priv->fd);
if (res == -1)
- {
- g_set_error (error, G_IO_ERROR,
- g_io_error_from_errno (errno),
- _("Error closing file: %s"),
- g_strerror (errno));
- }
+ g_set_error (error, G_IO_ERROR,
+ g_io_error_from_errno (errno),
+ _("Error closing file: %s"),
+ g_strerror (errno));
break;
}
}
static gboolean
-g_local_file_input_stream_seek (GFileInputStream *stream,
- goffset offset,
- GSeekType type,
- GCancellable *cancellable,
- GError **error)
+g_local_file_input_stream_seek (GFileInputStream *stream,
+ goffset offset,
+ GSeekType type,
+ GCancellable *cancellable,
+ GError **error)
{
GLocalFileInputStream *file;
off_t pos;
}
static GFileInfo *
-g_local_file_input_stream_query_info (GFileInputStream *stream,
- char *attributes,
- GCancellable *cancellable,
- GError **error)
+g_local_file_input_stream_query_info (GFileInputStream *stream,
+ char *attributes,
+ GCancellable *cancellable,
+ GError **error)
{
GLocalFileInputStream *file;
}
static void
-g_local_file_monitor_set_property (GObject *object,
- guint property_id,
+g_local_file_monitor_set_property (GObject *object,
+ guint property_id,
const GValue *value,
- GParamSpec *pspec)
+ GParamSpec *pspec)
{
switch (property_id)
{
}
static GObject *
-g_local_file_monitor_constructor (GType type,
- guint n_construct_properties,
+g_local_file_monitor_constructor (GType type,
+ guint n_construct_properties,
GObjectConstructParam *construct_properties)
{
GObject *obj;
static gint
_compare_monitor_class_by_prio (gconstpointer a,
gconstpointer b,
- gpointer user_data)
+ gpointer user_data)
{
GType *type1 = (GType *) a, *type2 = (GType *) b;
GLocalFileMonitorClass *klass1, *klass2;
* Returns: a new #GFileMonitor for the given @pathname.
**/
GFileMonitor*
-_g_local_file_monitor_new (const char* pathname,
- GFileMonitorFlags flags)
+_g_local_file_monitor_new (const char *pathname,
+ GFileMonitorFlags flags)
{
static GOnce once_init = G_ONCE_INIT;
static GType monitor_type = G_TYPE_INVALID;
}
static gssize
-g_local_file_output_stream_write (GOutputStream *stream,
- const void *buffer,
- gsize count,
- GCancellable *cancellable,
- GError **error)
+g_local_file_output_stream_write (GOutputStream *stream,
+ const void *buffer,
+ gsize count,
+ GCancellable *cancellable,
+ GError **error)
{
GLocalFileOutputStream *file;
gssize res;
}
static gboolean
-g_local_file_output_stream_close (GOutputStream *stream,
- GCancellable *cancellable,
- GError **error)
+g_local_file_output_stream_close (GOutputStream *stream,
+ GCancellable *cancellable,
+ GError **error)
{
GLocalFileOutputStream *file;
struct stat final_stat;
}
static char *
-g_local_file_output_stream_get_etag (GFileOutputStream *stream)
+g_local_file_output_stream_get_etag (GFileOutputStream *stream)
{
GLocalFileOutputStream *file;
}
static gboolean
-g_local_file_output_stream_seek (GFileOutputStream *stream,
- goffset offset,
- GSeekType type,
- GCancellable *cancellable,
- GError **error)
+g_local_file_output_stream_seek (GFileOutputStream *stream,
+ goffset offset,
+ GSeekType type,
+ GCancellable *cancellable,
+ GError **error)
{
GLocalFileOutputStream *file;
off_t pos;
}
static gboolean
-g_local_file_output_stream_can_truncate (GFileOutputStream *stream)
+g_local_file_output_stream_can_truncate (GFileOutputStream *stream)
{
/* We can't truncate pipes and stuff where we can't seek */
return g_local_file_output_stream_can_seek (stream);
}
static gboolean
-g_local_file_output_stream_truncate (GFileOutputStream *stream,
- goffset size,
- GCancellable *cancellable,
- GError **error)
+g_local_file_output_stream_truncate (GFileOutputStream *stream,
+ goffset size,
+ GCancellable *cancellable,
+ GError **error)
{
GLocalFileOutputStream *file;
int res;
file = G_LOCAL_FILE_OUTPUT_STREAM (stream);
restart:
- res = ftruncate(file->priv->fd, size);
+ res = ftruncate (file->priv->fd, size);
if (res == -1)
{
static GFileInfo *
-g_local_file_output_stream_query_info (GFileOutputStream *stream,
- char *attributes,
- GCancellable *cancellable,
- GError **error)
+g_local_file_output_stream_query_info (GFileOutputStream *stream,
+ char *attributes,
+ GCancellable *cancellable,
+ GError **error)
{
GLocalFileOutputStream *file;
}
GFileOutputStream *
-_g_local_file_output_stream_create (const char *filename,
- GFileCreateFlags flags,
- GCancellable *cancellable,
- GError **error)
+_g_local_file_output_stream_create (const char *filename,
+ GFileCreateFlags flags,
+ GCancellable *cancellable,
+ GError **error)
{
GLocalFileOutputStream *stream;
int mode;
}
GFileOutputStream *
-_g_local_file_output_stream_append (const char *filename,
- GFileCreateFlags flags,
- GCancellable *cancellable,
- GError **error)
+_g_local_file_output_stream_append (const char *filename,
+ GFileCreateFlags flags,
+ GCancellable *cancellable,
+ GError **error)
{
GLocalFileOutputStream *stream;
int mode;
}
static int
-handle_overwrite_open (const char *filename,
- const char *etag,
- gboolean create_backup,
- char **temp_filename,
- GCancellable *cancellable,
- GError **error)
+handle_overwrite_open (const char *filename,
+ const char *etag,
+ gboolean create_backup,
+ char **temp_filename,
+ GCancellable *cancellable,
+ GError **error)
{
int fd = -1;
struct stat original_stat;
}
static GFile *
-g_local_vfs_get_file_for_path (GVfs *vfs,
- const char *path)
+g_local_vfs_get_file_for_path (GVfs *vfs,
+ const char *path)
{
return _g_local_file_new (path);
}
static GFile *
-g_local_vfs_get_file_for_uri (GVfs *vfs,
- const char *uri)
+g_local_vfs_get_file_for_uri (GVfs *vfs,
+ const char *uri)
{
char *path;
GFile *file;
static GFile *
g_local_vfs_parse_name (GVfs *vfs,
- const char *parse_name)
+ const char *parse_name)
{
GFile *file;
char *filename;
**/
void
g_memory_input_stream_set_free_data (GMemoryInputStream *stream,
- gboolean free_data)
+ gboolean free_data)
{
g_return_if_fail (G_IS_MEMORY_INPUT_STREAM (stream));
* Returns: new #GInputStream read from @data of @len bytes.
**/
GInputStream *
-g_memory_input_stream_from_data (const void *data, gssize len)
+g_memory_input_stream_from_data (const void *data,
+ gssize len)
{
GInputStream *stream;
GMemoryInputStream *memory_stream;
}
static gssize
-g_memory_input_stream_read (GInputStream *stream,
- void *buffer,
- gsize count,
- GCancellable *cancellable,
- GError **error)
+g_memory_input_stream_read (GInputStream *stream,
+ void *buffer,
+ gsize count,
+ GCancellable *cancellable,
+ GError **error)
{
GMemoryInputStream *memory_stream;
GMemoryInputStreamPrivate * priv;
}
static gssize
-g_memory_input_stream_skip (GInputStream *stream,
- gsize count,
- GCancellable *cancellable,
- GError **error)
+g_memory_input_stream_skip (GInputStream *stream,
+ gsize count,
+ GCancellable *cancellable,
+ GError **error)
{
GMemoryInputStream *memory_stream;
GMemoryInputStreamPrivate *priv;
}
static gboolean
-g_memory_input_stream_close (GInputStream *stream,
- GCancellable *cancellable,
- GError **error)
+g_memory_input_stream_close (GInputStream *stream,
+ GCancellable *cancellable,
+ GError **error)
{
return TRUE;
}
static void
-g_memory_input_stream_read_async (GInputStream *stream,
- void *buffer,
- gsize count,
- int io_priority,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data)
+g_memory_input_stream_read_async (GInputStream *stream,
+ void *buffer,
+ gsize count,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
{
GSimpleAsyncResult *simple;
gssize nread;
}
static gssize
-g_memory_input_stream_read_finish (GInputStream *stream,
- GAsyncResult *result,
- GError **error)
+g_memory_input_stream_read_finish (GInputStream *stream,
+ GAsyncResult *result,
+ GError **error)
{
GSimpleAsyncResult *simple;
gssize nread;
}
static void
-g_memory_input_stream_skip_async (GInputStream *stream,
- gsize count,
- int io_priority,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data)
+g_memory_input_stream_skip_async (GInputStream *stream,
+ gsize count,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
{
GSimpleAsyncResult *simple;
gssize nskipped;
nskipped = g_memory_input_stream_skip (stream, count, cancellable, NULL);
simple = g_simple_async_result_new (G_OBJECT (stream),
- callback,
- user_data,
- g_memory_input_stream_skip_async);
+ callback,
+ user_data,
+ g_memory_input_stream_skip_async);
g_simple_async_result_set_op_res_gssize (simple, nskipped);
g_simple_async_result_complete_in_idle (simple);
g_object_unref (simple);
}
static gssize
-g_memory_input_stream_skip_finish (GInputStream *stream,
- GAsyncResult *result,
- GError **error)
+g_memory_input_stream_skip_finish (GInputStream *stream,
+ GAsyncResult *result,
+ GError **error)
{
GSimpleAsyncResult *simple;
gssize nskipped;
}
static void
-g_memory_input_stream_close_async (GInputStream *stream,
- int io_priority,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data)
+g_memory_input_stream_close_async (GInputStream *stream,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
{
GSimpleAsyncResult *simple;
}
static gboolean
-g_memory_input_stream_close_finish (GInputStream *stream,
- GAsyncResult *result,
- GError **error)
+g_memory_input_stream_close_finish (GInputStream *stream,
+ GAsyncResult *result,
+ GError **error)
{
return TRUE;
}
}
static gboolean
-g_memory_input_stream_seek (GSeekable *seekable,
- goffset offset,
- GSeekType type,
- GCancellable *cancellable,
- GError **error)
+g_memory_input_stream_seek (GSeekable *seekable,
+ goffset offset,
+ GSeekType type,
+ GCancellable *cancellable,
+ GError **error)
{
GMemoryInputStream *memory_stream;
GMemoryInputStreamPrivate * priv;
memory_stream = G_MEMORY_INPUT_STREAM (seekable);
priv = memory_stream->priv;
- switch (type) {
-
+ switch (type)
+ {
case G_SEEK_CUR:
absolute = priv->pos + offset;
break;
"Invalid GSeekType supplied");
return FALSE;
- }
+ }
if (absolute < 0 || absolute > priv->len)
{
}
static gboolean
-g_memory_input_stream_truncate (GSeekable *seekable,
- goffset offset,
- GCancellable *cancellable,
- GError **error)
+g_memory_input_stream_truncate (GSeekable *seekable,
+ goffset offset,
+ GCancellable *cancellable,
+ GError **error)
{
g_set_error (error,
G_IO_ERROR,
#define __G_MEMORY_INPUT_STREAM_C__
#include "gioaliasdef.c"
-
-/* vim: ts=2 sw=2 et */
{
GOutputStream *stream;
- if (data == NULL) {
+ if (data == NULL)
stream = g_object_new (G_TYPE_MEMORY_OUTPUT_STREAM, NULL);
- } else {
+ else
stream = g_object_new (G_TYPE_MEMORY_OUTPUT_STREAM,
"data", data,
NULL);
- }
return stream;
}
**/
void
g_memory_output_stream_set_free_data (GMemoryOutputStream *ostream,
- gboolean free_data)
+ gboolean free_data)
{
GMemoryOutputStreamPrivate *priv;
priv->max_size = max_size;
if (priv->max_size > 0 &&
- priv->max_size < priv->data->len) {
+ priv->max_size < priv->data->len)
+ {
- g_byte_array_set_size (priv->data, priv->max_size);
+ g_byte_array_set_size (priv->data, priv->max_size);
- if (priv->pos > priv->max_size) {
- priv->pos = priv->max_size;
+ if (priv->pos > priv->max_size)
+ priv->pos = priv->max_size;
}
- }
g_object_notify (G_OBJECT (ostream), "size-limit");
}
static void
-g_memory_output_stream_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
+g_memory_output_stream_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
GMemoryOutputStream *ostream;
GMemoryOutputStreamPrivate *priv;
{
case PROP_DATA:
- if (priv->data && priv->free_data) {
+ if (priv->data && priv->free_data)
g_byte_array_free (priv->data, TRUE);
- }
data = g_value_get_pointer (value);
- if (data == NULL) {
- data = g_byte_array_new ();
- priv->free_data = TRUE;
- } else {
+ if (data == NULL)
+ {
+ data = g_byte_array_new ();
+ priv->free_data = TRUE;
+ }
+ else
priv->free_data = FALSE;
- }
priv->data = data;
priv->pos = 0;
priv = stream->priv;
- if (! priv->max_size) {
+ if (!priv->max_size)
return TRUE;
- }
-
- if (priv->max_size < size || size > G_MAXUINT) {
- g_set_error (error,
- G_IO_ERROR,
- G_IO_ERROR_FAILED,
- "Reached maximum data array limit");
+ if (priv->max_size < size || size > G_MAXUINT)
+ {
+ g_set_error (error,
+ G_IO_ERROR,
+ G_IO_ERROR_FAILED,
+ "Reached maximum data array limit");
- return FALSE;
- }
+ return FALSE;
+ }
return TRUE;
}
if (size > old_len && priv->pos > old_len)
memset (priv->data->data + priv->pos, 0, size - old_len);
-
return priv->data->len - priv->pos;
}
static gssize
-g_memory_output_stream_write (GOutputStream *stream,
- const void *buffer,
- gsize count,
- GCancellable *cancellable,
- GError **error)
+g_memory_output_stream_write (GOutputStream *stream,
+ const void *buffer,
+ gsize count,
+ GCancellable *cancellable,
+ GError **error)
{
GMemoryOutputStream *ostream;
GMemoryOutputStreamPrivate *priv;
new_size = priv->pos + count;
if (priv->max_size > 0)
- {
- new_size = MIN (new_size, priv->max_size);
- }
+ new_size = MIN (new_size, priv->max_size);
n = array_resize (ostream, new_size, error);
return -1;
}
else if (n < 0)
- {
- return -1;
- }
+ return -1;
}
dest = priv->data->data + priv->pos;
}
static void
-g_memory_output_stream_write_async (GOutputStream *stream,
- const void *buffer,
- gsize count,
- int io_priority,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer data)
+g_memory_output_stream_write_async (GOutputStream *stream,
+ const void *buffer,
+ gsize count,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer data)
{
GSimpleAsyncResult *simple;
gssize nwritten;
g_simple_async_result_set_op_res_gssize (simple, nwritten);
g_simple_async_result_complete_in_idle (simple);
g_object_unref (simple);
-
}
static gssize
-g_memory_output_stream_write_finish (GOutputStream *stream,
- GAsyncResult *result,
- GError **error)
+g_memory_output_stream_write_finish (GOutputStream *stream,
+ GAsyncResult *result,
+ GError **error)
{
GSimpleAsyncResult *simple;
gssize nwritten;
}
static void
-g_memory_output_stream_close_async (GOutputStream *stream,
- int io_priority,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer data)
+g_memory_output_stream_close_async (GOutputStream *stream,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer data)
{
GSimpleAsyncResult *simple;
g_simple_async_result_complete_in_idle (simple);
g_object_unref (simple);
-
}
static gboolean
-g_memory_output_stream_close_finish (GOutputStream *stream,
- GAsyncResult *result,
- GError **error)
+g_memory_output_stream_close_finish (GOutputStream *stream,
+ GAsyncResult *result,
+ GError **error)
{
GSimpleAsyncResult *simple;
g_assert (g_simple_async_result_get_source_tag (simple) ==
g_memory_output_stream_close_async);
-
return TRUE;
}
static goffset
-g_memory_output_stream_tell (GSeekable *seekable)
+g_memory_output_stream_tell (GSeekable *seekable)
{
GMemoryOutputStream *stream;
GMemoryOutputStreamPrivate *priv;
}
static gboolean
-g_memory_output_stream_seek (GSeekable *seekable,
- goffset offset,
- GSeekType type,
- GCancellable *cancellable,
- GError **error)
+g_memory_output_stream_seek (GSeekable *seekable,
+ goffset offset,
+ GSeekType type,
+ GCancellable *cancellable,
+ GError **error)
{
GMemoryOutputStream *stream;
GMemoryOutputStreamPrivate *priv;
stream = G_MEMORY_OUTPUT_STREAM (seekable);
priv = stream->priv;
- switch (type) {
-
+ switch (type)
+ {
case G_SEEK_CUR:
absolute = priv->pos + offset;
break;
"Invalid GSeekType supplied");
return FALSE;
- }
+ }
- if (absolute < 0) {
- g_set_error (error,
- G_IO_ERROR,
- G_IO_ERROR_INVALID_ARGUMENT,
- "Invalid seek request");
- return FALSE;
- }
+ if (absolute < 0)
+ {
+ g_set_error (error,
+ G_IO_ERROR,
+ G_IO_ERROR_INVALID_ARGUMENT,
+ "Invalid seek request");
+ return FALSE;
+ }
- if (! array_check_boundary (stream, absolute, error))
+ if (!array_check_boundary (stream, absolute, error))
return FALSE;
priv->pos = absolute;
}
static gboolean
-g_memory_output_stream_truncate (GSeekable *seekable,
- goffset offset,
- GCancellable *cancellable,
- GError **error)
+g_memory_output_stream_truncate (GSeekable *seekable,
+ goffset offset,
+ GCancellable *cancellable,
+ GError **error)
{
GMemoryOutputStream *ostream;
GMemoryOutputStreamPrivate *priv;
priv = ostream->priv;
if (array_resize (ostream, offset, error) < 0)
- return FALSE;
+ return FALSE;
return TRUE;
}
#define __G_MEMORY_OUTPUT_STREAM_C__
#include "gioaliasdef.c"
-
-/* vim: ts=2 sw=2 et */
**/
void
g_mount_operation_set_choice (GMountOperation *op,
- int choice)
+ int choice)
{
g_return_if_fail (G_IS_MOUNT_OPERATION (op));
op->priv->choice = choice;
* Return value: Number of bytes written, or -1 on error
**/
gssize
-g_output_stream_write (GOutputStream *stream,
- const void *buffer,
- gsize count,
- GCancellable *cancellable,
- GError **error)
+g_output_stream_write (GOutputStream *stream,
+ const void *buffer,
+ gsize count,
+ GCancellable *cancellable,
+ GError **error)
{
GOutputStreamClass *class;
gssize res;
* @stream: a #GOutputStream.
* @buffer: the buffer containing the data to write.
* @count: the number of bytes to write
- * @bytes_written: location to store the number of bytes that was written to the stream
+ * @bytes_written: location to store the number of bytes that was
+ * written to the stream
* @cancellable: optional #GCancellable object, %NULL to ignore.
* @error: location to store the error occuring, or %NULL to ignore
*
* Return value: %TRUE on success, %FALSE if there was an error
**/
gboolean
-g_output_stream_write_all (GOutputStream *stream,
- const void *buffer,
- gsize count,
- gsize *bytes_written,
- GCancellable *cancellable,
- GError **error)
+g_output_stream_write_all (GOutputStream *stream,
+ const void *buffer,
+ gsize count,
+ gsize *bytes_written,
+ GCancellable *cancellable,
+ GError **error)
{
gsize _bytes_written;
gssize res;
if (bytes_written)
*bytes_written = _bytes_written;
+
return TRUE;
}
* @cancellable: optional cancellable object
* @error: location to store the error occuring, or %NULL to ignore
*
- * Flushed any outstanding buffers in the stream. Will block during the operation.
- * Closing the stream will implicitly cause a flush.
+ * Flushed any outstanding buffers in the stream. Will block during
+ * the operation. Closing the stream will implicitly cause a flush.
*
* This function is optional for inherited classes.
*
* Return value: %TRUE on success, %FALSE on error
**/
gboolean
-g_output_stream_flush (GOutputStream *stream,
- GCancellable *cancellable,
- GError **error)
+g_output_stream_flush (GOutputStream *stream,
+ GCancellable *cancellable,
+ GError **error)
{
GOutputStreamClass *class;
gboolean res;
* Returns: a #gssize containig the size of the data spliced.
**/
gssize
-g_output_stream_splice (GOutputStream *stream,
- GInputStream *source,
- GOutputStreamSpliceFlags flags,
- GCancellable *cancellable,
- GError **error)
+g_output_stream_splice (GOutputStream *stream,
+ GInputStream *source,
+ GOutputStreamSpliceFlags flags,
+ GCancellable *cancellable,
+ GError **error)
{
GOutputStreamClass *class;
gboolean res;
}
static gssize
-g_output_stream_real_splice (GOutputStream *stream,
- GInputStream *source,
- GOutputStreamSpliceFlags flags,
- GCancellable *cancellable,
- GError **error)
+g_output_stream_real_splice (GOutputStream *stream,
+ GInputStream *source,
+ GOutputStreamSpliceFlags flags,
+ GCancellable *cancellable,
+ GError **error)
{
gssize n_read, n_written;
gssize bytes_copied;
}
static void
-async_ready_callback_wrapper (GObject *source_object,
- GAsyncResult *res,
- gpointer user_data)
+async_ready_callback_wrapper (GObject *source_object,
+ GAsyncResult *res,
+ gpointer user_data)
{
GOutputStream *stream = G_OUTPUT_STREAM (source_object);
}
static void
-async_ready_close_callback_wrapper (GObject *source_object,
- GAsyncResult *res,
- gpointer user_data)
+async_ready_close_callback_wrapper (GObject *source_object,
+ GAsyncResult *res,
+ gpointer user_data)
{
GOutputStream *stream = G_OUTPUT_STREAM (source_object);
* @stream: A #GOutputStream.
* @buffer: the buffer containing the data to write.
* @count: the number of bytes to write
- * @io_priority: the io priority of the request. the io priority of the request
+ * @io_priority: the io priority of the request.
* @cancellable: optional #GCancellable object, %NULL to ignore.
* @callback: callback to call when the request is satisfied
* @user_data: the data to pass to callback function
*
- * Request an asynchronous write of @count bytes from @buffer into the stream.
- * When the operation is finished @callback will be called, giving the results.
+ * Request an asynchronous write of @count bytes from @buffer into
+ * the stream. When the operation is finished @callback will be called,
+ * giving the results.
*
- * During an async request no other sync and async calls are allowed, and will
- * result in %G_IO_ERROR_PENDING errors.
+ * During an async request no other sync and async calls are allowed,
+ * and will result in %G_IO_ERROR_PENDING errors.
*
- * A value of @count larger than %G_MAXSSIZE will cause a %G_IO_ERROR_INVALID_ARGUMENT error.
+ * A value of @count larger than %G_MAXSSIZE will cause a
+ * %G_IO_ERROR_INVALID_ARGUMENT error.
*
* On success, the number of bytes written will be passed to the
- * @callback. It is not an error if this is not the same as the requested size, as it
- * can happen e.g. on a partial i/o error, but generally we try to write
- * as many bytes as requested.
+ * @callback. It is not an error if this is not the same as the
+ * requested size, as it can happen e.g. on a partial I/O error,
+ * but generally we try to write as many bytes as requested.
*
- * Any outstanding i/o request with higher priority (lower numerical value) will
- * be executed before an outstanding request with lower priority. Default
- * priority is %G_PRIORITY_DEFAULT.
+ * Any outstanding I/O request with higher priority (lower numerical
+ * value) will be executed before an outstanding request with lower
+ * priority. Default priority is %G_PRIORITY_DEFAULT.
*
- * The asyncronous methods have a default fallback that uses threads to implement
- * asynchronicity, so they are optional for inheriting classes. However, if you
- * override one you must override all.
+ * The asyncronous methods have a default fallback that uses threads
+ * to implement asynchronicity, so they are optional for inheriting
+ * classes. However, if you override one you must override all.
*
- * For the synchronous, blocking version of this function, see g_output_stream_write().
+ * For the synchronous, blocking version of this function, see
+ * g_output_stream_write().
**/
void
g_output_stream_write_async (GOutputStream *stream,
* Returns: a #gssize containing the number of bytes written to the stream.
**/
gssize
-g_output_stream_write_finish (GOutputStream *stream,
- GAsyncResult *result,
- GError **error)
+g_output_stream_write_finish (GOutputStream *stream,
+ GAsyncResult *result,
+ GError **error)
{
GSimpleAsyncResult *simple;
GOutputStreamClass *class;
} SpliceUserData;
static void
-async_ready_splice_callback_wrapper (GObject *source_object,
- GAsyncResult *res,
- gpointer _data)
+async_ready_splice_callback_wrapper (GObject *source_object,
+ GAsyncResult *res,
+ gpointer _data)
{
GOutputStream *stream = G_OUTPUT_STREAM (source_object);
SpliceUserData *data = _data;
*
**/
void
-g_output_stream_splice_async (GOutputStream *stream,
- GInputStream *source,
- GOutputStreamSpliceFlags flags,
- int io_priority,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data)
+g_output_stream_splice_async (GOutputStream *stream,
+ GInputStream *source,
+ GOutputStreamSpliceFlags flags,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
{
GOutputStreamClass *class;
SpliceUserData *data;
* Returns: a #gssize of the number of bytes spliced.
**/
gssize
-g_output_stream_splice_finish (GOutputStream *stream,
- GAsyncResult *result,
- GError **error)
+g_output_stream_splice_finish (GOutputStream *stream,
+ GAsyncResult *result,
+ GError **error)
{
GSimpleAsyncResult *simple;
GOutputStreamClass *class;
**/
void
g_output_stream_flush_async (GOutputStream *stream,
- int io_priority,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data)
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
{
GOutputStreamClass *class;
GSimpleAsyncResult *simple;
* Returns: %TRUE if flush operation suceeded, %FALSE otherwise.
**/
gboolean
-g_output_stream_flush_finish (GOutputStream *stream,
- GAsyncResult *result,
- GError **error)
+g_output_stream_flush_finish (GOutputStream *stream,
+ GAsyncResult *result,
+ GError **error)
{
GSimpleAsyncResult *simple;
GOutputStreamClass *klass;
* @user_data: the data to pass to callback function
* @cancellable: optional cancellable object
*
- * Requests an asynchronous close of the stream, releasing resources related to it.
- * When the operation is finished @callback will be called, giving the results.
+ * Requests an asynchronous close of the stream, releasing resources
+ * related to it. When the operation is finished @callback will be
+ * called, giving the results.
*
* For behaviour details see g_output_stream_close().
*
- * The asyncronous methods have a default fallback that uses threads to implement
- * asynchronicity, so they are optional for inheriting classes. However, if you
- * override one you must override all.
+ * The asyncronous methods have a default fallback that uses threads
+ * to implement asynchronicity, so they are optional for inheriting
+ * classes. However, if you override one you must override all.
**/
void
-g_output_stream_close_async (GOutputStream *stream,
- int io_priority,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data)
+g_output_stream_close_async (GOutputStream *stream,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
{
GOutputStreamClass *class;
GSimpleAsyncResult *simple;
* Returns: %TRUE if stream was successfully closed, %FALSE otherwise.
**/
gboolean
-g_output_stream_close_finish (GOutputStream *stream,
- GAsyncResult *result,
- GError **error)
+g_output_stream_close_finish (GOutputStream *stream,
+ GAsyncResult *result,
+ GError **error)
{
GSimpleAsyncResult *simple;
GOutputStreamClass *class;
* Sets the @stream as having pending actions if @pending is %TRUE.
**/
void
-g_output_stream_set_pending (GOutputStream *stream,
- gboolean pending)
+g_output_stream_set_pending (GOutputStream *stream,
+ gboolean pending)
{
g_return_if_fail (G_IS_OUTPUT_STREAM (stream));
static void
write_async_thread (GSimpleAsyncResult *res,
- GObject *object,
- GCancellable *cancellable)
+ GObject *object,
+ GCancellable *cancellable)
{
WriteData *op;
GOutputStreamClass *class;
static void
g_output_stream_real_write_async (GOutputStream *stream,
- const void *buffer,
- gsize count,
- int io_priority,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data)
+ const void *buffer,
+ gsize count,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
{
GSimpleAsyncResult *res;
WriteData *op;
}
static gssize
-g_output_stream_real_write_finish (GOutputStream *stream,
- GAsyncResult *result,
- GError **error)
+g_output_stream_real_write_finish (GOutputStream *stream,
+ GAsyncResult *result,
+ GError **error)
{
GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (result);
WriteData *op;
static void
splice_async_thread (GSimpleAsyncResult *result,
- GObject *object,
- GCancellable *cancellable)
+ GObject *object,
+ GCancellable *cancellable)
{
SpliceData *op;
GOutputStreamClass *class;
}
static void
-g_output_stream_real_splice_async (GOutputStream *stream,
- GInputStream *source,
- GOutputStreamSpliceFlags flags,
- int io_priority,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data)
+g_output_stream_real_splice_async (GOutputStream *stream,
+ GInputStream *source,
+ GOutputStreamSpliceFlags flags,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
{
GSimpleAsyncResult *res;
SpliceData *op;
}
static gssize
-g_output_stream_real_splice_finish (GOutputStream *stream,
- GAsyncResult *result,
- GError **error)
+g_output_stream_real_splice_finish (GOutputStream *stream,
+ GAsyncResult *result,
+ GError **error)
{
GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (result);
SpliceData *op;
}
-
static void
flush_async_thread (GSimpleAsyncResult *res,
- GObject *object,
- GCancellable *cancellable)
+ GObject *object,
+ GCancellable *cancellable)
{
GOutputStreamClass *class;
gboolean result;
static void
g_output_stream_real_flush_async (GOutputStream *stream,
- int io_priority,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data)
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
{
GSimpleAsyncResult *res;
}
static gboolean
-g_output_stream_real_flush_finish (GOutputStream *stream,
- GAsyncResult *result,
- GError **error)
+g_output_stream_real_flush_finish (GOutputStream *stream,
+ GAsyncResult *result,
+ GError **error)
{
return TRUE;
}
static void
close_async_thread (GSimpleAsyncResult *res,
- GObject *object,
- GCancellable *cancellable)
+ GObject *object,
+ GCancellable *cancellable)
{
GOutputStreamClass *class;
GError *error = NULL;
}
static void
-g_output_stream_real_close_async (GOutputStream *stream,
- int io_priority,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data)
+g_output_stream_real_close_async (GOutputStream *stream,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
{
GSimpleAsyncResult *res;
}
static gboolean
-g_output_stream_real_close_finish (GOutputStream *stream,
- GAsyncResult *result,
- GError **error)
+g_output_stream_real_close_finish (GOutputStream *stream,
+ GAsyncResult *result,
+ GError **error)
{
GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (result);
g_assert (g_simple_async_result_get_source_tag (simple) == g_output_stream_real_close_async);
}
static int
-safe_strcmp (const char *a, const char *b)
+safe_strcmp (const char *a,
+ const char *b)
{
if (a == NULL && b == NULL)
return 0;
}
static void
-got_new_info (GObject *source_object,
- GAsyncResult *res,
- gpointer user_data)
+got_new_info (GObject *source_object,
+ GAsyncResult *res,
+ gpointer user_data)
{
GPollFileMonitor* poll_monitor = user_data;
GFileInfo *info;
}
static void
-got_initial_info (GObject *source_object,
- GAsyncResult *res,
- gpointer user_data)
+got_initial_info (GObject *source_object,
+ GAsyncResult *res,
+ gpointer user_data)
{
GPollFileMonitor* poll_monitor = user_data;
GFileInfo *info;
{
static GType seekable_type = 0;
- if (! seekable_type)
+ if (!seekable_type)
{
static const GTypeInfo seekable_info =
{
* was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
*
* Returns: %TRUE if successful. If an error
- * has occured, this function will return %FALSE and set @error
- * appropriately if present.
+ * has occured, this function will return %FALSE and set @error
+ * appropriately if present.
**/
gboolean
g_seekable_seek (GSeekable *seekable,
* partial result will be returned, without an error.
*
* Returns: %TRUE if successful. If an error
- * has occured, this function will return %FALSE and set @error
- * appropriately if present.
+ * has occured, this function will return %FALSE and set @error
+ * appropriately if present.
**/
gboolean
g_seekable_truncate (GSeekable *seekable,
* asynchronous functions and their finishing functions are used together
* correctly.
*
- * To create a new #GSimpleAsyncResult, call g_simple_async_result_new(). If
- * the result needs to be created for a #GError, use
- * g_simple_async_result_new_from_error(). If a #GError is not available (e.g.
- * the asynchronous operation's doesn't take a #GError argument), but the result
- * still needs to be created for an error condition, use
+ * To create a new #GSimpleAsyncResult, call g_simple_async_result_new().
+ * If the result needs to be created for a #GError, use
+ * g_simple_async_result_new_from_error(). If a #GError is not available
+ * (e.g. the asynchronous operation's doesn't take a #GError argument),
+ * but the result still needs to be created for an error condition, use
* g_simple_async_result_new_error() (or g_simple_async_result_set_error_va()
* if your application or binding requires passing a variable argument list
* directly), and the error can then be propegated through the use of
* g_simple_async_result_propagate_error().
*
- * An asynchronous operation can be made to ignore a cancellation event by calling
- * g_simple_async_result_set_handle_cancellation() with a #GSimpleAsyncResult
- * for the operation and %FALSE.
+ * An asynchronous operation can be made to ignore a cancellation event by
+ * calling g_simple_async_result_set_handle_cancellation() with a
+ * #GSimpleAsyncResult for the operation and %FALSE.
*
- * GSimpleAsyncResult can integrate into GLib's Main Event Loop <!-- TODO: Crosslink -->,
- * or it can use #GThread<!-- -->s if available. g_simple_async_result_complete()
- * will finish an I/O task directly within the main event loop.
- * g_simple_async_result_complete_in_idle() will integrate the I/O task into the
- * main event loop as an idle function and g_simple_async_result_run_in_thread()
- * will run the job in a separate thread.
+ * GSimpleAsyncResult can integrate into GLib's Main Event Loop
+ * <!-- TODO: Crosslink -->, or it can use #GThread<!-- -->s if available.
+ * g_simple_async_result_complete() will finish an I/O task directly within
+ * the main event loop. g_simple_async_result_complete_in_idle() will
+ * integrate the I/O task into the main event loop as an idle function and
+ * g_simple_async_result_run_in_thread() will run the job in a separate
+ * thread.
*
* To set the results of an asynchronous function,
* g_simple_async_result_set_op_res_gpointer(),
* Returns: a #GSimpleAsyncResult.
**/
GSimpleAsyncResult *
-g_simple_async_result_new (GObject *source_object,
- GAsyncReadyCallback callback,
- gpointer user_data,
- gpointer source_tag)
+g_simple_async_result_new (GObject *source_object,
+ GAsyncReadyCallback callback,
+ gpointer user_data,
+ gpointer source_tag)
{
GSimpleAsyncResult *simple;
* Returns: a #GSimpleAsyncResult.
**/
GSimpleAsyncResult *
-g_simple_async_result_new_from_error (GObject *source_object,
- GAsyncReadyCallback callback,
- gpointer user_data,
- GError *error)
+g_simple_async_result_new_from_error (GObject *source_object,
+ GAsyncReadyCallback callback,
+ gpointer user_data,
+ GError *error)
{
GSimpleAsyncResult *simple;
* @domain: a #GQuark.
* @code: an error code.
* @format: a string with format characters.
- * @Varargs: a list of values to insert into @format.
+ * @...: a list of values to insert into @format.
*
* Creates a new #GSimpleAsyncResult with a set error.
*
* Returns: a #GSimpleAsyncResult.
**/
GSimpleAsyncResult *
-g_simple_async_result_new_error (GObject *source_object,
- GAsyncReadyCallback callback,
- gpointer user_data,
- GQuark domain,
- gint code,
- const char *format,
- ...)
+g_simple_async_result_new_error (GObject *source_object,
+ GAsyncReadyCallback callback,
+ gpointer user_data,
+ GQuark domain,
+ gint code,
+ const char *format,
+ ...)
{
GSimpleAsyncResult *simple;
va_list args;
**/
void
g_simple_async_result_set_handle_cancellation (GSimpleAsyncResult *simple,
- gboolean handle_cancellation)
+ gboolean handle_cancellation)
{
g_return_if_fail (G_IS_SIMPLE_ASYNC_RESULT (simple));
simple->handle_cancellation = handle_cancellation;
* Returns: %TRUE if the error was propegated to @dest. %FALSE otherwise.
**/
gboolean
-g_simple_async_result_propagate_error (GSimpleAsyncResult *simple,
- GError **dest)
+g_simple_async_result_propagate_error (GSimpleAsyncResult *simple,
+ GError **dest)
{
g_return_val_if_fail (G_IS_SIMPLE_ASYNC_RESULT (simple), FALSE);
simple->error = NULL;
return TRUE;
}
+
return FALSE;
}
* Sets the operation result within the asynchronous result to a pointer.
**/
void
-g_simple_async_result_set_op_res_gpointer (GSimpleAsyncResult *simple,
- gpointer op_res,
- GDestroyNotify destroy_op_res)
+g_simple_async_result_set_op_res_gpointer (GSimpleAsyncResult *simple,
+ gpointer op_res,
+ GDestroyNotify destroy_op_res)
{
g_return_if_fail (G_IS_SIMPLE_ASYNC_RESULT (simple));
* Returns: a pointer from the result.
**/
gpointer
-g_simple_async_result_get_op_res_gpointer (GSimpleAsyncResult *simple)
+g_simple_async_result_get_op_res_gpointer (GSimpleAsyncResult *simple)
{
g_return_val_if_fail (G_IS_SIMPLE_ASYNC_RESULT (simple), NULL);
return simple->op_res.v_pointer;
* @simple: a #GSimpleAsyncResult.
* @op_res: a #gssize.
*
- * Sets the operation result within the asynchronous result to the given @op_res.
+ * Sets the operation result within the asynchronous result to
+ * the given @op_res.
**/
void
-g_simple_async_result_set_op_res_gssize (GSimpleAsyncResult *simple,
- gssize op_res)
+g_simple_async_result_set_op_res_gssize (GSimpleAsyncResult *simple,
+ gssize op_res)
{
g_return_if_fail (G_IS_SIMPLE_ASYNC_RESULT (simple));
simple->op_res.v_ssize = op_res;
* Returns: a gssize returned from the asynchronous function.
**/
gssize
-g_simple_async_result_get_op_res_gssize (GSimpleAsyncResult *simple)
+g_simple_async_result_get_op_res_gssize (GSimpleAsyncResult *simple)
{
g_return_val_if_fail (G_IS_SIMPLE_ASYNC_RESULT (simple), 0);
return simple->op_res.v_ssize;
* @op_res: a #gboolean.
*
* Sets the operation result to a boolean within the asynchronous result.
- *
**/
void
-g_simple_async_result_set_op_res_gboolean (GSimpleAsyncResult *simple,
- gboolean op_res)
+g_simple_async_result_set_op_res_gboolean (GSimpleAsyncResult *simple,
+ gboolean op_res)
{
g_return_if_fail (G_IS_SIMPLE_ASYNC_RESULT (simple));
simple->op_res.v_boolean = !!op_res;
*
* Gets the operation result boolean from within the asynchronous result.
*
- * Returns: %TRUE if the operation's result was %TRUE, %FALSE if the operation's
- * result was %FALSE.
+ * Returns: %TRUE if the operation's result was %TRUE, %FALSE
+ * if the operation's result was %FALSE.
**/
gboolean
-g_simple_async_result_get_op_res_gboolean (GSimpleAsyncResult *simple)
+g_simple_async_result_get_op_res_gboolean (GSimpleAsyncResult *simple)
{
g_return_val_if_fail (G_IS_SIMPLE_ASYNC_RESULT (simple), FALSE);
return simple->op_res.v_boolean;
**/
void
g_simple_async_result_set_from_error (GSimpleAsyncResult *simple,
- GError *error)
+ GError *error)
{
g_return_if_fail (G_IS_SIMPLE_ASYNC_RESULT (simple));
g_return_if_fail (error != NULL);
}
static GError*
-_g_error_new_valist (GQuark domain,
- gint code,
- const char *format,
- va_list args)
+_g_error_new_valist (GQuark domain,
+ gint code,
+ const char *format,
+ va_list args)
{
GError *error;
char *message;
* @format: a formatted error reporting string.
* @args: va_list of arguments.
*
- * Sets an error within the asynchronous result without a #GError. Unless
- * writing a binding, see g_simple_async_result_set_error().
+ * Sets an error within the asynchronous result without a #GError.
+ * Unless writing a binding, see g_simple_async_result_set_error().
**/
void
g_simple_async_result_set_error_va (GSimpleAsyncResult *simple,
- GQuark domain,
- gint code,
- const char *format,
- va_list args)
+ GQuark domain,
+ gint code,
+ const char *format,
+ va_list args)
{
g_return_if_fail (G_IS_SIMPLE_ASYNC_RESULT (simple));
g_return_if_fail (domain != 0);
* @domain: a #GQuark (usually #G_IO_ERROR).
* @code: an error code.
* @format: a formatted error reporting string.
- * @Varargs: a list of variables to fill in @format.
+ * @...: a list of variables to fill in @format.
*
* Sets an error within the asynchronous result without a #GError.
- *
**/
void
g_simple_async_result_set_error (GSimpleAsyncResult *simple,
- GQuark domain,
- gint code,
- const char *format,
- ...)
+ GQuark domain,
+ gint code,
+ const char *format,
+ ...)
{
va_list args;
* @simple: a #GSimpleAsyncResult.
*
* Completes an asynchronous I/O job.
- *
**/
void
g_simple_async_result_complete (GSimpleAsyncResult *simple)
*
* Completes an asynchronous function in the main event loop using
* an idle function.
- *
**/
void
g_simple_async_result_complete_in_idle (GSimpleAsyncResult *simple)
} RunInThreadData;
static void
-run_in_thread (GIOJob *job,
- GCancellable *c,
- gpointer _data)
+run_in_thread (GIOJob *job,
+ GCancellable *c,
+ gpointer _data)
{
RunInThreadData *data = _data;
GSimpleAsyncResult *simple = data->simple;
if (simple->handle_cancellation &&
g_cancellable_is_cancelled (c))
- {
- g_simple_async_result_set_error (simple,
- G_IO_ERROR,
- G_IO_ERROR_CANCELLED,
- _("Operation was cancelled"));
- }
+ g_simple_async_result_set_error (simple,
+ G_IO_ERROR,
+ G_IO_ERROR_CANCELLED,
+ _("Operation was cancelled"));
else
- {
- data->func (simple,
- simple->source_object,
- c);
- }
+ data->func (simple,
+ simple->source_object,
+ c);
g_simple_async_result_complete_in_idle (data->simple);
g_object_unref (data->simple);
* @cancellable: optional #GCancellable object, %NULL to ignore.
*
* Runs the asynchronous job in a separated thread.
- *
**/
void
-g_simple_async_result_run_in_thread (GSimpleAsyncResult *simple,
- GSimpleAsyncThreadFunc func,
- int io_priority,
- GCancellable *cancellable)
+g_simple_async_result_run_in_thread (GSimpleAsyncResult *simple,
+ GSimpleAsyncThreadFunc func,
+ int io_priority,
+ GCancellable *cancellable)
{
RunInThreadData *data;
* @domain: a #GQuark containing the error domain (usually #G_IO_ERROR).
* @code: a specific error code.
* @format: a formatted error reporting string.
- * @Varargs: a list of variables to fill in @format.
+ * @...: a list of variables to fill in @format.
*
* Reports an error in an idle function.
- *
**/
void
-g_simple_async_report_error_in_idle (GObject *object,
- GAsyncReadyCallback callback,
- gpointer user_data,
- GQuark domain,
- gint code,
- const char *format,
- ...)
+g_simple_async_report_error_in_idle (GObject *object,
+ GAsyncReadyCallback callback,
+ gpointer user_data,
+ GQuark domain,
+ gint code,
+ const char *format,
+ ...)
{
GSimpleAsyncResult *simple;
va_list args;
* not provide actual pixmaps for icons, just the icon names.
**/
-static void g_themed_icon_icon_iface_init (GIconIface *iface);
+static void g_themed_icon_icon_iface_init (GIconIface *iface);
struct _GThemedIcon
{
* Returns: a new #GThemedIcon.
**/
GIcon *
-g_themed_icon_new_from_names (char **iconnames, int len)
+g_themed_icon_new_from_names (char **iconnames,
+ int len)
{
GThemedIcon *themed;
int i;
static gboolean
g_themed_icon_equal (GIcon *icon1,
- GIcon *icon2)
+ GIcon *icon2)
{
GThemedIcon *themed1 = G_THEMED_ICON (icon1);
GThemedIcon *themed2 = G_THEMED_ICON (icon2);
}
static void
-child_volume_mounted (GVolumeMonitor *child_monitor,
- GVolume *child_volume,
- GUnionVolumeMonitor *union_monitor)
+child_volume_mounted (GVolumeMonitor *child_monitor,
+ GVolume *child_volume,
+ GUnionVolumeMonitor *union_monitor)
{
g_signal_emit_by_name (union_monitor,
"volume_mounted",
}
static void
-child_volume_pre_unmount (GVolumeMonitor *child_monitor,
- GVolume *child_volume,
- GUnionVolumeMonitor *union_monitor)
+child_volume_pre_unmount (GVolumeMonitor *child_monitor,
+ GVolume *child_volume,
+ GUnionVolumeMonitor *union_monitor)
{
g_signal_emit_by_name (union_monitor,
"volume_pre_unmount",
}
static void
-child_volume_unmounted (GVolumeMonitor *child_monitor,
- GVolume *child_volume,
- GUnionVolumeMonitor *union_monitor)
+child_volume_unmounted (GVolumeMonitor *child_monitor,
+ GVolume *child_volume,
+ GUnionVolumeMonitor *union_monitor)
{
g_signal_emit_by_name (union_monitor,
"volume_unmounted",
}
static void
-child_drive_connected (GVolumeMonitor *child_monitor,
- GDrive *child_drive,
- GUnionVolumeMonitor *union_monitor)
+child_drive_connected (GVolumeMonitor *child_monitor,
+ GDrive *child_drive,
+ GUnionVolumeMonitor *union_monitor)
{
g_signal_emit_by_name (union_monitor,
"drive_connected",
}
static void
-child_drive_disconnected (GVolumeMonitor *child_monitor,
- GDrive *child_drive,
- GUnionVolumeMonitor *union_monitor)
+child_drive_disconnected (GVolumeMonitor *child_monitor,
+ GDrive *child_drive,
+ GUnionVolumeMonitor *union_monitor)
{
g_signal_emit_by_name (union_monitor,
"drive_disconnected",
static void
g_union_volume_monitor_add_monitor (GUnionVolumeMonitor *union_monitor,
- GVolumeMonitor *volume_monitor)
+ GVolumeMonitor *volume_monitor)
{
if (g_list_find (union_monitor->monitors, volume_monitor))
return;
static void
g_union_volume_monitor_remove_monitor (GUnionVolumeMonitor *union_monitor,
- GVolumeMonitor *child_monitor)
+ GVolumeMonitor *child_monitor)
{
GList *l;
* Returns: a #GUnixDrive for the given #GUnixMountPoint.
**/
GUnixDrive *
-_g_unix_drive_new (GVolumeMonitor *volume_monitor,
- GUnixMountPoint *mountpoint)
+_g_unix_drive_new (GVolumeMonitor *volume_monitor,
+ GUnixMountPoint *mountpoint)
{
GUnixDrive *drive;
*
**/
void
-_g_unix_drive_set_volume (GUnixDrive *drive,
- GUnixVolume *volume)
+_g_unix_drive_set_volume (GUnixDrive *drive,
+ GUnixVolume *volume)
{
if (drive->volume == volume)
return;
*
**/
void
-_g_unix_drive_unset_volume (GUnixDrive *drive,
- GUnixVolume *volume)
+_g_unix_drive_unset_volume (GUnixDrive *drive,
+ GUnixVolume *volume)
{
if (drive->volume == volume)
{
}
static void
-g_unix_drive_mount (GDrive *drive,
- GMountOperation *mount_operation,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data)
+g_unix_drive_mount (GDrive *drive,
+ GMountOperation *mount_operation,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
{
/* TODO */
}
static gboolean
-g_unix_drive_mount_finish (GDrive *drive,
- GAsyncResult *result,
- GError **error)
+g_unix_drive_mount_finish (GDrive *drive,
+ GAsyncResult *result,
+ GError **error)
{
return TRUE;
}
static void
-g_unix_drive_eject (GDrive *drive,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data)
+g_unix_drive_eject (GDrive *drive,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
{
/* TODO */
}
static gboolean
-g_unix_drive_eject_finish (GDrive *drive,
- GAsyncResult *result,
- GError **error)
+g_unix_drive_eject_finish (GDrive *drive,
+ GAsyncResult *result,
+ GError **error)
{
return TRUE;
}
* Returns: a #GUnixInputStream.
**/
GInputStream *
-g_unix_input_stream_new (int fd,
+g_unix_input_stream_new (int fd,
gboolean close_fd_at_close)
{
GUnixInputStream *stream;
}
static gssize
-g_unix_input_stream_read (GInputStream *stream,
- void *buffer,
- gsize count,
- GCancellable *cancellable,
- GError **error)
+g_unix_input_stream_read (GInputStream *stream,
+ void *buffer,
+ gsize count,
+ GCancellable *cancellable,
+ GError **error)
{
GUnixInputStream *unix_stream;
gssize res;
}
static gboolean
-g_unix_input_stream_close (GInputStream *stream,
- GCancellable *cancellable,
- GError **error)
+g_unix_input_stream_close (GInputStream *stream,
+ GCancellable *cancellable,
+ GError **error)
{
GUnixInputStream *unix_stream;
int res;
/* This might block during the close. Doesn't seem to be a way to avoid it though. */
res = close (unix_stream->priv->fd);
if (res == -1)
- {
- g_set_error (error, G_IO_ERROR,
- g_io_error_from_errno (errno),
- _("Error closing unix: %s"),
- g_strerror (errno));
- }
+ g_set_error (error, G_IO_ERROR,
+ g_io_error_from_errno (errno),
+ _("Error closing unix: %s"),
+ g_strerror (errno));
break;
}
static gboolean
read_async_cb (ReadAsyncData *data,
- GIOCondition condition,
- int fd)
+ GIOCondition condition,
+ int fd)
{
GSimpleAsyncResult *simple;
GError *error = NULL;
}
static gssize
-g_unix_input_stream_read_finish (GInputStream *stream,
- GAsyncResult *result,
- GError **error)
+g_unix_input_stream_read_finish (GInputStream *stream,
+ GAsyncResult *result,
+ GError **error)
{
GSimpleAsyncResult *simple;
gssize nread;
}
static gssize
-g_unix_input_stream_skip_finish (GInputStream *stream,
- GAsyncResult *result,
- GError **error)
+g_unix_input_stream_skip_finish (GInputStream *stream,
+ GAsyncResult *result,
+ GError **error)
{
g_assert_not_reached ();
/* TODO: Not implemented */
{
res = close (unix_stream->priv->fd);
if (res == -1)
- {
- g_set_error (&error, G_IO_ERROR,
- g_io_error_from_errno (errno),
- _("Error closing unix: %s"),
- g_strerror (errno));
- }
+ g_set_error (&error, G_IO_ERROR,
+ g_io_error_from_errno (errno),
+ _("Error closing unix: %s"),
+ g_strerror (errno));
break;
}
}
static void
-g_unix_input_stream_close_async (GInputStream *stream,
- int io_priority,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data)
+g_unix_input_stream_close_async (GInputStream *stream,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
{
GSource *idle;
CloseAsyncData *data;
}
static gboolean
-g_unix_input_stream_close_finish (GInputStream *stream,
- GAsyncResult *result,
- GError **error)
+g_unix_input_stream_close_finish (GInputStream *stream,
+ GAsyncResult *result,
+ GError **error)
{
/* Failures handled in generic close_finish code */
return TRUE;
/* read one word from file */
static int
-aix_fs_getword (FILE *fd, char *word)
+aix_fs_getword (FILE *fd,
+ char *word)
{
int c;
/* read mount points properties */
static int
-aix_fs_get (FILE *fd, AixMountTableEntry *prop)
+aix_fs_get (FILE *fd,
+ AixMountTableEntry *prop)
{
static char word[PATH_MAX] = { 0 };
char value[PATH_MAX];
}
static void
-fstab_file_changed (GFileMonitor* monitor,
- GFile* file,
- GFile* other_file,
- GFileMonitorEvent event_type,
- gpointer user_data)
+fstab_file_changed (GFileMonitor *monitor,
+ GFile *file,
+ GFile *other_file,
+ GFileMonitorEvent event_type,
+ gpointer user_data)
{
GUnixMountMonitor *mount_monitor;
}
static void
-mtab_file_changed (GFileMonitor* monitor,
- GFile* file,
- GFile* other_file,
- GFileMonitorEvent event_type,
- gpointer user_data)
+mtab_file_changed (GFileMonitor *monitor,
+ GFile *file,
+ GFile *other_file,
+ GFileMonitorEvent event_type,
+ gpointer user_data)
{
GUnixMountMonitor *mount_monitor;
* or less than @mount2, respectively.
**/
gint
-g_unix_mount_compare (GUnixMount *mount1,
- GUnixMount *mount2)
+g_unix_mount_compare (GUnixMount *mount1,
+ GUnixMount *mount2)
{
int res;
* @fd will be closed when the #GOutputStream is closed.
**/
GOutputStream *
-g_unix_output_stream_new (int fd,
+g_unix_output_stream_new (int fd,
gboolean close_fd_at_close)
{
GUnixOutputStream *stream;
}
static gssize
-g_unix_output_stream_write (GOutputStream *stream,
- const void *buffer,
- gsize count,
- GCancellable *cancellable,
- GError **error)
+g_unix_output_stream_write (GOutputStream *stream,
+ const void *buffer,
+ gsize count,
+ GCancellable *cancellable,
+ GError **error)
{
GUnixOutputStream *unix_stream;
gssize res;
}
static gboolean
-g_unix_output_stream_close (GOutputStream *stream,
- GCancellable *cancellable,
- GError **error)
+g_unix_output_stream_close (GOutputStream *stream,
+ GCancellable *cancellable,
+ GError **error)
{
GUnixOutputStream *unix_stream;
int res;
static gboolean
write_async_cb (WriteAsyncData *data,
- GIOCondition condition,
- int fd)
+ GIOCondition condition,
+ int fd)
{
GSimpleAsyncResult *simple;
GError *error = NULL;
}
static void
-g_unix_output_stream_write_async (GOutputStream *stream,
- const void *buffer,
- gsize count,
- int io_priority,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data)
+g_unix_output_stream_write_async (GOutputStream *stream,
+ const void *buffer,
+ gsize count,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
{
GSource *source;
GUnixOutputStream *unix_stream;
}
static gssize
-g_unix_output_stream_write_finish (GOutputStream *stream,
- GAsyncResult *result,
- GError **error)
+g_unix_output_stream_write_finish (GOutputStream *stream,
+ GAsyncResult *result,
+ GError **error)
{
GSimpleAsyncResult *simple;
gssize nwritten;
}
static void
-g_unix_output_stream_close_async (GOutputStream *stream,
- int io_priority,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data)
+g_unix_output_stream_close_async (GOutputStream *stream,
+ int io_priority,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
{
GSource *idle;
CloseAsyncData *data;
}
static gboolean
-g_unix_output_stream_close_finish (GOutputStream *stream,
- GAsyncResult *result,
- GError **error)
+g_unix_output_stream_close_finish (GOutputStream *stream,
+ GAsyncResult *result,
+ GError **error)
{
/* Failures handled in generic close_finish code */
return TRUE;
}
if (volume_name == NULL)
- {
- /* TODO: Use volume size as name? */
- volume_name = g_strdup (_("Unknown volume"));
- }
+ /* TODO: Use volume size as name? */
+ volume_name = g_strdup (_("Unknown volume"));
volume->name = volume_name;
}
void
-_g_unix_volume_unset_drive (GUnixVolume *volume,
- GUnixDrive *drive)
+_g_unix_volume_unset_drive (GUnixVolume *volume,
+ GUnixDrive *drive)
{
if (volume->drive == drive)
{
}
static void
-g_unix_volume_unmount (GVolume *volume,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data)
+g_unix_volume_unmount (GVolume *volume,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
{
/* TODO */
}
static gboolean
-g_unix_volume_unmount_finish (GVolume *volume,
- GAsyncResult *result,
- GError **error)
+g_unix_volume_unmount_finish (GVolume *volume,
+ GAsyncResult *result,
+ GError **error)
{
return TRUE;
}
static void
mountpoints_changed (GUnixMountMonitor *mount_monitor,
- gpointer user_data)
+ gpointer user_data)
{
GUnixVolumeMonitor *unix_monitor = user_data;
static void
mounts_changed (GUnixMountMonitor *mount_monitor,
- gpointer user_data)
+ gpointer user_data)
{
GUnixVolumeMonitor *unix_monitor = user_data;
}
static void
-diff_sorted_lists (GList *list1, GList *list2, GCompareFunc compare,
- GList **added, GList **removed)
+diff_sorted_lists (GList *list1,
+ GList *list2,
+ GCompareFunc compare,
+ GList **added,
+ GList **removed)
{
int order;
**/
GUnixDrive *
_g_unix_volume_monitor_lookup_drive_for_mountpoint (GUnixVolumeMonitor *monitor,
- const char *mountpoint)
+ const char *mountpoint)
{
GList *l;
* Returns: a #GFile.
**/
GFile *
-g_vfs_get_file_for_path (GVfs *vfs,
+g_vfs_get_file_for_path (GVfs *vfs,
const char *path)
{
GVfsClass *class;
*
**/
GFile *
-g_vfs_get_file_for_uri (GVfs *vfs,
+g_vfs_get_file_for_uri (GVfs *vfs,
const char *uri)
{
GVfsClass *class;
* Returns: a #GFile for the given @parse_name.
**/
GFile *
-g_vfs_parse_name (GVfs *vfs,
+g_vfs_parse_name (GVfs *vfs,
const char *parse_name)
{
GVfsClass *class;
* @callback: a #GAsyncReadyCallback.
* @user_data: user data passed to @callback.
*
- * Unmounts a volume. This is an asynchronous operation, and is finished by calling
- * g_volume_unmount_finish() with the @volume and #GAsyncResults data returned in the
- * @callback.
- *
+ * Unmounts a volume. This is an asynchronous operation, and is
+ * finished by calling g_volume_unmount_finish() with the @volume
+ * and #GAsyncResults data returned in the @callback.
**/
void
-g_volume_unmount (GVolume *volume,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data)
+g_volume_unmount (GVolume *volume,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
{
GVolumeIface *iface;
* Returns: %TRUE if the volume was successfully unmounted. %FALSE otherwise.
**/
gboolean
-g_volume_unmount_finish (GVolume *volume,
- GAsyncResult *result,
- GError **error)
+g_volume_unmount_finish (GVolume *volume,
+ GAsyncResult *result,
+ GError **error)
{
GVolumeIface *iface;
* @callback: a #GAsyncReadyCallback.
* @user_data: user data passed to @callback.
*
- * Ejects a volume. This is an asynchronous operation, and is finished
- * by calling g_volume_eject_finish() from the @callback with the @volume and
- * #GAsyncResults returned in the callback.
- *
+ * Ejects a volume. This is an asynchronous operation, and is
+ * finished by calling g_volume_eject_finish() from the @callback
+ * with the @volume and #GAsyncResults returned in the callback.
**/
void
-g_volume_eject (GVolume *volume,
- GCancellable *cancellable,
+g_volume_eject (GVolume *volume,
+ GCancellable *cancellable,
GAsyncReadyCallback callback,
- gpointer user_data)
+ gpointer user_data)
{
GVolumeIface *iface;
* Returns: %TRUE if the volume was successfully ejected. %FALSE otherwise.
**/
gboolean
-g_volume_eject_finish (GVolume *volume,
- GAsyncResult *result,
- GError **error)
+g_volume_eject_finish (GVolume *volume,
+ GAsyncResult *result,
+ GError **error)
{
GVolumeIface *iface;
* @see_also: #GDirectoryMonitor, #GFileMonitor
*
* Monitors a mounted volume for changes.
- *
**/
G_DEFINE_TYPE (GVolumeMonitor, g_volume_monitor, G_TYPE_OBJECT);
* Returns: a #GList of mounted #GVolumes.
**/
GList *
-g_volume_monitor_get_mounted_volumes (GVolumeMonitor *volume_monitor)
+g_volume_monitor_get_mounted_volumes (GVolumeMonitor *volume_monitor)
{
GVolumeMonitorClass *class;
static gboolean
g_win32_app_info_equal (GAppInfo *appinfo1,
- GAppInfo *appinfo2)
+ GAppInfo *appinfo2)
{
GWin32AppInfo *info1 = G_WIN32_APP_INFO (appinfo1);
GWin32AppInfo *info2 = G_WIN32_APP_INFO (appinfo2);
}
static gboolean
-g_win32_app_info_launch (GAppInfo *appinfo,
- GList *files,
- GAppLaunchContext *launch_context,
- GError **error)
+g_win32_app_info_launch (GAppInfo *appinfo,
+ GList *files,
+ GAppLaunchContext *launch_context,
+ GError **error)
{
GWin32AppInfo *info = G_WIN32_APP_INFO (appinfo);
ASSOCF flags;
if (info->id_is_exename)
flags |= ASSOCF_INIT_BYEXENAME;
- if (AssocQueryKeyW(flags,
- ASSOCKEY_SHELLEXECCLASS,
- info->id,
- NULL,
- &class_key) != S_OK)
+ if (AssocQueryKeyW (flags,
+ ASSOCKEY_SHELLEXECCLASS,
+ info->id,
+ NULL,
+ &class_key) != S_OK)
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, _("Can't find application"));
return FALSE;
}
static gboolean
-g_win32_app_info_launch_uris (GAppInfo *appinfo,
- GList *uris,
- GAppLaunchContext *launch_context,
- GError **error)
+g_win32_app_info_launch_uris (GAppInfo *appinfo,
+ GList *uris,
+ GAppLaunchContext *launch_context,
+ GError **error)
{
- g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED, _("URIs not supported"));
+ g_set_error (error, G_IO_ERROR,
+ G_IO_ERROR_NOT_SUPPORTED,
+ _("URIs not supported"));
return FALSE;
}
static gboolean
-g_win32_app_info_should_show (GAppInfo *appinfo,
+g_win32_app_info_should_show (GAppInfo *appinfo,
const char *win32_env)
{
GWin32AppInfo *info = G_WIN32_APP_INFO (appinfo);
static gboolean
g_win32_app_info_set_as_default_for_type (GAppInfo *appinfo,
- const char *content_type,
- GError **error)
+ const char *content_type,
+ GError **error)
{
- g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED, _("association changes not supported on win32"));
+ g_set_error (error, G_IO_ERROR,
+ G_IO_ERROR_NOT_SUPPORTED,
+ _("association changes not supported on win32"));
return FALSE;
}
GAppInfo *
-g_app_info_create_from_commandline (const char *commandline,
- const char *application_name,
- GAppInfoCreateFlags flags,
- GError **error)
+g_app_info_create_from_commandline (const char *commandline,
+ const char *application_name,
+ GAppInfoCreateFlags flags,
+ GError **error)
{
- g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED, _("Association creation not supported on win32"));
+ g_set_error (error, G_IO_ERROR,
+ G_IO_ERROR_NOT_SUPPORTED,
+ _("Association creation not supported on win32"));
return NULL;
}
}
static void
-enumerate_open_with_list (HKEY dir_key,
+enumerate_open_with_list (HKEY dir_key,
GList **prognames)
{
DWORD index;
index = 0;
name_len = 256;
nbytes = sizeof (data) - 2;
- while (RegEnumValueW(dir_key,
- index,
- name,
- &name_len,
- 0,
- &type,
- (LPBYTE)data,
- &nbytes) == ERROR_SUCCESS)
+ while (RegEnumValueW (dir_key,
+ index,
+ name,
+ &name_len,
+ 0,
+ &type,
+ (LPBYTE)data,
+ &nbytes) == ERROR_SUCCESS)
{
data[nbytes/2] = '\0';
if (type == REG_SZ &&
index = 0;
name_len = 256;
- while (RegEnumKeyExW(dir_key,
- index,
- name,
- &name_len,
- NULL,
- NULL,
- NULL,
- NULL) == ERROR_SUCCESS)
+ while (RegEnumKeyExW (dir_key,
+ index,
+ name,
+ &name_len,
+ NULL,
+ NULL,
+ NULL,
+ NULL) == ERROR_SUCCESS)
{
*prognames = g_list_prepend (*prognames, g_memdup (name, (name_len + 1) * 2));
index++;
index = 0;
name_len = 256;
- while (RegEnumValueW(dir_key,
- index,
- name,
- &name_len,
- 0,
- &type,
- NULL,
- 0) == ERROR_SUCCESS)
+ while (RegEnumValueW (dir_key,
+ index,
+ name,
+ &name_len,
+ 0,
+ &type,
+ NULL,
+ 0) == ERROR_SUCCESS)
{
*progids = g_list_prepend (*progids, g_memdup (name, (name_len + 1) * 2));
index++;
}
static void
-enumerate_open_with_root (HKEY dir_key,
+enumerate_open_with_root (HKEY dir_key,
GList **progids,
GList **prognames)
{
}
static gboolean
-app_info_in_list (GAppInfo *info, GList *l)
+app_info_in_list (GAppInfo *info,
+ GList *list)
{
- while (l != NULL)
+ while (list != NULL)
{
- if (g_app_info_equal (info, l->data))
+ if (g_app_info_equal (info, list->data))
return TRUE;
- l = l->next;
+ list = list->next;
}
return FALSE;
}
GAppInfo *
g_app_info_get_default_for_type (const char *content_type,
- gboolean must_support_uris)
+ gboolean must_support_uris)
{
wchar_t *wtype;
wchar_t buffer[1024];
/* Verify that we have some sort of app registered for this type */
buffer_size = 1024;
- if (AssocQueryStringW(0,
- REAL_ASSOCSTR_COMMAND,
- wtype,
- NULL,
- buffer,
- &buffer_size) == S_OK)
+ if (AssocQueryStringW (0,
+ REAL_ASSOCSTR_COMMAND,
+ wtype,
+ NULL,
+ buffer,
+ &buffer_size) == S_OK)
/* Takes ownership of wtype */
return g_desktop_app_info_new_from_id (wtype, FALSE);
infos = NULL;
index = 0;
name_len = 256;
- while (RegEnumKeyExW(reg_key,
- index,
- name,
- &name_len,
- NULL,
- NULL,
- NULL,
- NULL) == ERROR_SUCCESS)
+ while (RegEnumKeyExW (reg_key,
+ index,
+ name,
+ &name_len,
+ NULL,
+ NULL,
+ NULL,
+ NULL) == ERROR_SUCCESS)
{
wchar_t *name_dup = g_memdup (name, (name_len+1)*2);
/* name_dup ownership is taken */