mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 03:16:17 +01:00
More coding style fixes
svn path=/trunk/; revision=5999
This commit is contained in:
parent
f3be1cf2d1
commit
a2ca589703
@ -1,3 +1,7 @@
|
||||
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,
|
||||
|
@ -458,13 +458,11 @@ g_buffered_output_stream_flush (GOutputStream *stream,
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@ -486,17 +484,9 @@ g_buffered_output_stream_close (GOutputStream *stream,
|
||||
|
||||
/* 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;
|
||||
}
|
||||
@ -545,11 +535,7 @@ flush_buffer_thread (GSimpleAsyncResult *result,
|
||||
/* 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)
|
||||
{
|
||||
@ -558,18 +544,9 @@ flush_buffer_thread (GSimpleAsyncResult *result,
|
||||
* 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)
|
||||
|
@ -1184,23 +1184,24 @@ g_desktop_app_info_set_as_default_for_extension (GAppInfo *appinfo,
|
||||
|
||||
mimetype = g_strdup_printf ("application/x-extension-%s", extension);
|
||||
|
||||
if (!g_file_test (filename, G_FILE_TEST_EXISTS)) {
|
||||
char *contents;
|
||||
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);
|
||||
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);
|
||||
g_file_set_contents (filename, contents, -1, NULL);
|
||||
g_free (contents);
|
||||
|
||||
run_update_command ("update-mime-database", "mime");
|
||||
}
|
||||
run_update_command ("update-mime-database", "mime");
|
||||
}
|
||||
g_free (filename);
|
||||
|
||||
res = g_desktop_app_info_set_as_default_for_type (appinfo,
|
||||
@ -2179,14 +2180,14 @@ get_all_desktop_entries_for_mime_type (const char *base_mime_type)
|
||||
/* 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);
|
||||
|
@ -270,17 +270,18 @@ g_dummy_file_contains_file (GFile *parent,
|
||||
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
|
||||
{
|
||||
@ -310,17 +311,18 @@ g_dummy_file_get_relative_path (GFile *parent,
|
||||
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
|
||||
{
|
||||
@ -340,7 +342,7 @@ g_dummy_file_get_relative_path (GFile *parent,
|
||||
|
||||
|
||||
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);
|
||||
@ -464,30 +466,32 @@ unescape_string (const gchar *escaped_string,
|
||||
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));
|
||||
|
@ -1749,16 +1749,17 @@ matcher_add (GFileAttributeMatcher *matcher,
|
||||
* 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>
|
||||
|
@ -29,14 +29,13 @@
|
||||
|
||||
/**
|
||||
* 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().
|
||||
|
@ -32,8 +32,7 @@
|
||||
* @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,
|
||||
@ -122,7 +121,6 @@ g_loadable_icon_load (GLoadableIcon *icon,
|
||||
iface = G_LOADABLE_ICON_GET_IFACE (icon);
|
||||
|
||||
return (* iface->load) (icon, size, type, cancellable, error);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -136,7 +134,6 @@ g_loadable_icon_load (GLoadableIcon *icon,
|
||||
* 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,
|
||||
@ -152,7 +149,6 @@ g_loadable_icon_load_async (GLoadableIcon *icon,
|
||||
iface = G_LOADABLE_ICON_GET_IFACE (icon);
|
||||
|
||||
(* iface->load_async) (icon, size, cancellable, callback, user_data);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -188,7 +184,6 @@ g_loadable_icon_load_finish (GLoadableIcon *icon,
|
||||
iface = G_LOADABLE_ICON_GET_IFACE (icon);
|
||||
|
||||
return (* iface->load_finish) (icon, res, type, error);
|
||||
|
||||
}
|
||||
|
||||
/********************************************
|
||||
|
@ -62,10 +62,10 @@ g_local_directory_monitor_finalize (GObject* object)
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
@ -79,9 +79,9 @@ g_local_directory_monitor_set_property (GObject *object,
|
||||
}
|
||||
|
||||
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;
|
||||
@ -157,7 +157,7 @@ g_local_directory_monitor_init (GLocalDirectoryMonitor* local_monitor)
|
||||
|
||||
static void
|
||||
mounts_changed (GUnixMountMonitor *mount_monitor,
|
||||
gpointer user_data)
|
||||
gpointer user_data)
|
||||
{
|
||||
GLocalDirectoryMonitor *local_monitor = user_data;
|
||||
GUnixMount *mount;
|
||||
@ -190,7 +190,7 @@ mounts_changed (GUnixMountMonitor *mount_monitor,
|
||||
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;
|
||||
@ -261,7 +261,7 @@ get_default_local_directory_monitor (gpointer data)
|
||||
* 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;
|
||||
|
404
gio/glocalfile.c
404
gio/glocalfile.c
@ -284,7 +284,7 @@ g_local_file_is_native (GFile *file)
|
||||
}
|
||||
|
||||
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;
|
||||
@ -330,7 +330,7 @@ get_filename_charset (const gchar **filename_charset)
|
||||
|
||||
static gboolean
|
||||
name_is_valid_for_display (const char *string,
|
||||
gboolean is_valid_utf8)
|
||||
gboolean is_valid_utf8)
|
||||
{
|
||||
char c;
|
||||
|
||||
@ -452,7 +452,8 @@ g_local_file_equal (GFile *file1,
|
||||
}
|
||||
|
||||
static const char *
|
||||
match_prefix (const char *path, const char *prefix)
|
||||
match_prefix (const char *path,
|
||||
const char *prefix)
|
||||
{
|
||||
int prefix_len;
|
||||
|
||||
@ -492,7 +493,7 @@ g_local_file_get_relative_path (GFile *parent,
|
||||
}
|
||||
|
||||
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);
|
||||
@ -510,11 +511,11 @@ g_local_file_resolve_relative_path (GFile *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,
|
||||
@ -553,96 +554,97 @@ get_fs_type (long f_type)
|
||||
{
|
||||
|
||||
/* 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
|
||||
|
||||
@ -656,20 +658,20 @@ typedef enum {
|
||||
|
||||
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;
|
||||
@ -734,10 +736,10 @@ get_mount_info (GFileInfo *fs_info,
|
||||
}
|
||||
|
||||
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;
|
||||
@ -820,9 +822,9 @@ g_local_file_query_filesystem_info (GFile *file,
|
||||
}
|
||||
|
||||
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;
|
||||
@ -858,10 +860,10 @@ g_local_file_find_enclosing_volume (GFile *file,
|
||||
}
|
||||
|
||||
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;
|
||||
@ -950,28 +952,28 @@ g_local_file_query_info (GFile *file,
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
@ -984,11 +986,11 @@ g_local_file_set_attribute (GFile *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;
|
||||
@ -1010,9 +1012,9 @@ g_local_file_set_attributes_from_info (GFile *file,
|
||||
}
|
||||
|
||||
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;
|
||||
@ -1041,32 +1043,32 @@ g_local_file_read (GFile *file,
|
||||
}
|
||||
|
||||
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,
|
||||
@ -1075,9 +1077,9 @@ g_local_file_replace (GFile *file,
|
||||
|
||||
|
||||
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);
|
||||
|
||||
@ -1139,7 +1141,8 @@ expand_symlink (const char *link)
|
||||
}
|
||||
|
||||
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;
|
||||
@ -1209,7 +1212,8 @@ expand_all_symlinks (const char *path)
|
||||
}
|
||||
|
||||
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;
|
||||
@ -1217,20 +1221,21 @@ find_mountpoint_for (const char *file, dev_t 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 *
|
||||
@ -1247,7 +1252,8 @@ find_topdir_for (const char *file)
|
||||
}
|
||||
|
||||
static char *
|
||||
get_unique_filename (const char *basename, int id)
|
||||
get_unique_filename (const char *basename,
|
||||
int id)
|
||||
{
|
||||
const char *dot;
|
||||
|
||||
@ -1262,7 +1268,8 @@ get_unique_filename (const char *basename, int id)
|
||||
}
|
||||
|
||||
static gboolean
|
||||
path_has_prefix (const char *path, const char *prefix)
|
||||
path_has_prefix (const char *path,
|
||||
const char *prefix)
|
||||
{
|
||||
int prefix_len;
|
||||
|
||||
@ -1282,7 +1289,8 @@ path_has_prefix (const char *path, const char *prefix)
|
||||
}
|
||||
|
||||
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;
|
||||
@ -1336,9 +1344,9 @@ escape_trash_name (char *name)
|
||||
}
|
||||
|
||||
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;
|
||||
@ -1575,9 +1583,9 @@ g_local_file_trash (GFile *file,
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
@ -1602,10 +1610,10 @@ g_local_file_make_directory (GFile *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);
|
||||
@ -1635,13 +1643,13 @@ g_local_file_make_symbolic_link (GFile *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");
|
||||
@ -1649,13 +1657,13 @@ g_local_file_copy (GFile *source,
|
||||
}
|
||||
|
||||
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);
|
||||
@ -1770,18 +1778,18 @@ g_local_file_move (GFile *source,
|
||||
|
||||
|
||||
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);
|
||||
|
@ -102,7 +102,7 @@ g_local_file_enumerator_init (GLocalFileEnumerator *local)
|
||||
|
||||
static void
|
||||
convert_file_to_io_error (GError **error,
|
||||
GError *file_error)
|
||||
GError *file_error)
|
||||
{
|
||||
int new_code;
|
||||
|
||||
@ -111,21 +111,23 @@ convert_file_to_io_error (GError **error,
|
||||
|
||||
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,
|
||||
@ -133,11 +135,11 @@ convert_file_to_io_error (GError **error,
|
||||
}
|
||||
|
||||
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;
|
||||
@ -145,11 +147,12 @@ _g_local_file_enumerator_new (const char *filename,
|
||||
|
||||
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);
|
||||
|
||||
@ -162,9 +165,9 @@ _g_local_file_enumerator_new (const char *filename,
|
||||
}
|
||||
|
||||
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;
|
||||
@ -212,7 +215,7 @@ g_local_file_enumerator_next_file (GFileEnumerator *enumerator,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
g_local_file_enumerator_close (GFileEnumerator *enumerator,
|
||||
g_local_file_enumerator_close (GFileEnumerator *enumerator,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
|
@ -149,10 +149,10 @@ read_link (const gchar *full_name)
|
||||
|
||||
/* 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;
|
||||
@ -202,7 +202,8 @@ name_is_valid (const char *str)
|
||||
}
|
||||
|
||||
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;
|
||||
@ -248,7 +249,9 @@ hex_escape_string (const char *str, gboolean *free_return)
|
||||
}
|
||||
|
||||
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;
|
||||
@ -292,10 +295,10 @@ hex_unescape_string (const char *str, int *out_len, gboolean *free_return)
|
||||
}
|
||||
|
||||
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;
|
||||
@ -310,10 +313,10 @@ escape_xattr (GFileInfo *info,
|
||||
|
||||
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;
|
||||
@ -365,11 +368,11 @@ get_one_xattr (const char *path,
|
||||
#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;
|
||||
@ -480,8 +483,8 @@ get_xattrs (const char *path,
|
||||
|
||||
#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)
|
||||
{
|
||||
@ -525,9 +528,9 @@ get_one_xattr_from_fd (int fd,
|
||||
#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
|
||||
@ -633,10 +636,10 @@ get_xattrs_from_fd (int fd,
|
||||
|
||||
#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;
|
||||
@ -680,7 +683,6 @@ set_xattr (char *filename,
|
||||
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
|
||||
@ -714,9 +716,9 @@ set_xattr (char *filename,
|
||||
|
||||
|
||||
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;
|
||||
@ -750,10 +752,10 @@ _g_local_file_info_get_parent_info (const char *dir,
|
||||
|
||||
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))
|
||||
@ -807,7 +809,8 @@ get_access_rights (GFileAttributeMatcher *attribute_matcher,
|
||||
}
|
||||
|
||||
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;
|
||||
@ -1098,13 +1101,13 @@ get_groupname_from_gid (gid_t gid)
|
||||
}
|
||||
|
||||
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)))
|
||||
@ -1161,7 +1164,8 @@ get_content_type (const char *basename,
|
||||
}
|
||||
|
||||
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;
|
||||
@ -1169,10 +1173,11 @@ thumb_digest_to_ascii (unsigned char digest[16], const char *suffix)
|
||||
|
||||
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;
|
||||
|
||||
@ -1184,7 +1189,7 @@ thumb_digest_to_ascii (unsigned char digest[16], const char *suffix)
|
||||
|
||||
static void
|
||||
get_thumbnail_attributes (const char *path,
|
||||
GFileInfo *info)
|
||||
GFileInfo *info)
|
||||
{
|
||||
char *uri;
|
||||
unsigned char digest[16];
|
||||
@ -1215,12 +1220,12 @@ get_thumbnail_attributes (const char *path,
|
||||
|
||||
|
||||
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;
|
||||
@ -1452,8 +1457,8 @@ _g_local_file_info_get (const char *basename,
|
||||
}
|
||||
|
||||
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;
|
||||
@ -1502,9 +1507,9 @@ _g_local_file_info_get_from_fd (int fd,
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
@ -1519,9 +1524,9 @@ get_uint32 (const GFileAttributeValue *value,
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
@ -1537,9 +1542,9 @@ get_uint64 (const GFileAttributeValue *value,
|
||||
|
||||
#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)
|
||||
{
|
||||
@ -1555,9 +1560,9 @@ get_byte_string (const GFileAttributeValue *value,
|
||||
#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;
|
||||
|
||||
@ -1577,11 +1582,11 @@ set_unix_mode (char *filename,
|
||||
|
||||
#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;
|
||||
@ -1625,9 +1630,9 @@ set_unix_uid_gid (char *filename,
|
||||
|
||||
#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;
|
||||
@ -1682,7 +1687,9 @@ set_symlink (char *filename,
|
||||
#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;
|
||||
|
||||
@ -1700,12 +1707,12 @@ lazy_stat (char *filename, struct stat *statbuf, gboolean *called_stat)
|
||||
|
||||
#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;
|
||||
@ -1782,12 +1789,12 @@ set_mtime_atime (char *filename,
|
||||
#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);
|
||||
@ -1828,11 +1835,11 @@ _g_local_file_info_set_attribute (char *filename,
|
||||
}
|
||||
|
||||
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;
|
||||
@ -1989,7 +1996,8 @@ thumb_md5 (const char *string, unsigned char digest[16])
|
||||
* 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 {
|
||||
@ -2024,8 +2032,8 @@ thumb_md5_init (struct ThumbMD5Context *ctx)
|
||||
*/
|
||||
static void
|
||||
thumb_md5_update (struct ThumbMD5Context *ctx,
|
||||
unsigned char const *buf,
|
||||
unsigned len)
|
||||
unsigned char const *buf,
|
||||
unsigned len)
|
||||
{
|
||||
guint32 t;
|
||||
|
||||
@ -2075,7 +2083,8 @@ thumb_md5_update (struct ThumbMD5Context *ctx,
|
||||
* 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;
|
||||
@ -2134,7 +2143,8 @@ thumb_md5_final (unsigned char digest[16], struct ThumbMD5Context *ctx)
|
||||
* 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;
|
||||
|
||||
|
@ -125,11 +125,11 @@ _g_local_file_input_stream_new (int fd)
|
||||
}
|
||||
|
||||
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;
|
||||
@ -160,10 +160,10 @@ g_local_file_input_stream_read (GInputStream *stream,
|
||||
}
|
||||
|
||||
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;
|
||||
@ -197,9 +197,9 @@ g_local_file_input_stream_skip (GInputStream *stream,
|
||||
}
|
||||
|
||||
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;
|
||||
@ -213,12 +213,10 @@ g_local_file_input_stream_close (GInputStream *stream,
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
@ -277,11 +275,11 @@ seek_type_to_lseek (GSeekType type)
|
||||
}
|
||||
|
||||
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;
|
||||
@ -303,10 +301,10 @@ g_local_file_input_stream_seek (GFileInputStream *stream,
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
|
@ -43,10 +43,10 @@ g_local_file_monitor_init (GLocalFileMonitor* local_monitor)
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
@ -60,8 +60,8 @@ g_local_file_monitor_set_property (GObject *object,
|
||||
}
|
||||
|
||||
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;
|
||||
@ -126,7 +126,7 @@ g_local_file_monitor_class_init (GLocalFileMonitorClass* klass)
|
||||
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;
|
||||
@ -198,8 +198,8 @@ get_default_local_file_monitor (gpointer data)
|
||||
* 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;
|
||||
|
@ -128,11 +128,11 @@ g_local_file_output_stream_init (GLocalFileOutputStream *stream)
|
||||
}
|
||||
|
||||
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;
|
||||
@ -162,9 +162,9 @@ g_local_file_output_stream_write (GOutputStream *stream,
|
||||
}
|
||||
|
||||
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;
|
||||
@ -259,7 +259,7 @@ g_local_file_output_stream_close (GOutputStream *stream,
|
||||
}
|
||||
|
||||
static char *
|
||||
g_local_file_output_stream_get_etag (GFileOutputStream *stream)
|
||||
g_local_file_output_stream_get_etag (GFileOutputStream *stream)
|
||||
{
|
||||
GLocalFileOutputStream *file;
|
||||
|
||||
@ -319,11 +319,11 @@ seek_type_to_lseek (GSeekType type)
|
||||
}
|
||||
|
||||
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;
|
||||
@ -345,17 +345,17 @@ g_local_file_output_stream_seek (GFileOutputStream *stream,
|
||||
}
|
||||
|
||||
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;
|
||||
@ -363,7 +363,7 @@ g_local_file_output_stream_truncate (GFileOutputStream *stream,
|
||||
file = G_LOCAL_FILE_OUTPUT_STREAM (stream);
|
||||
|
||||
restart:
|
||||
res = ftruncate(file->priv->fd, size);
|
||||
res = ftruncate (file->priv->fd, size);
|
||||
|
||||
if (res == -1)
|
||||
{
|
||||
@ -386,10 +386,10 @@ g_local_file_output_stream_truncate (GFileOutputStream *stream,
|
||||
|
||||
|
||||
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;
|
||||
|
||||
@ -404,10 +404,10 @@ g_local_file_output_stream_query_info (GFileOutputStream *stream,
|
||||
}
|
||||
|
||||
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;
|
||||
@ -447,10 +447,10 @@ _g_local_file_output_stream_create (const char *filename,
|
||||
}
|
||||
|
||||
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;
|
||||
@ -560,12 +560,12 @@ copy_file_data (gint sfd,
|
||||
}
|
||||
|
||||
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;
|
||||
|
@ -69,15 +69,15 @@ _g_local_vfs_new (void)
|
||||
}
|
||||
|
||||
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;
|
||||
@ -104,7 +104,7 @@ g_local_vfs_get_supported_uri_schemes (GVfs *vfs)
|
||||
|
||||
static GFile *
|
||||
g_local_vfs_parse_name (GVfs *vfs,
|
||||
const char *parse_name)
|
||||
const char *parse_name)
|
||||
{
|
||||
GFile *file;
|
||||
char *filename;
|
||||
|
@ -171,7 +171,7 @@ g_memory_input_stream_init (GMemoryInputStream *stream)
|
||||
**/
|
||||
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));
|
||||
|
||||
@ -186,7 +186,8 @@ g_memory_input_stream_set_free_data (GMemoryInputStream *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;
|
||||
@ -206,11 +207,11 @@ g_memory_input_stream_from_data (const void *data, gssize len)
|
||||
}
|
||||
|
||||
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;
|
||||
@ -254,10 +255,10 @@ g_memory_input_stream_get_data_size (GMemoryInputStream *stream)
|
||||
}
|
||||
|
||||
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;
|
||||
@ -274,21 +275,21 @@ g_memory_input_stream_skip (GInputStream *stream,
|
||||
}
|
||||
|
||||
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;
|
||||
@ -304,9 +305,9 @@ g_memory_input_stream_read_async (GInputStream *stream,
|
||||
}
|
||||
|
||||
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;
|
||||
@ -319,30 +320,30 @@ g_memory_input_stream_read_finish (GInputStream *stream,
|
||||
}
|
||||
|
||||
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;
|
||||
@ -355,11 +356,11 @@ g_memory_input_stream_skip_finish (GInputStream *stream,
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
@ -372,9 +373,9 @@ g_memory_input_stream_close_async (GInputStream *stream,
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
@ -398,11 +399,11 @@ gboolean g_memory_input_stream_can_seek (GSeekable *seekable)
|
||||
}
|
||||
|
||||
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;
|
||||
@ -411,8 +412,8 @@ g_memory_input_stream_seek (GSeekable *seekable,
|
||||
memory_stream = G_MEMORY_INPUT_STREAM (seekable);
|
||||
priv = memory_stream->priv;
|
||||
|
||||
switch (type) {
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case G_SEEK_CUR:
|
||||
absolute = priv->pos + offset;
|
||||
break;
|
||||
@ -432,7 +433,7 @@ g_memory_input_stream_seek (GSeekable *seekable,
|
||||
"Invalid GSeekType supplied");
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (absolute < 0 || absolute > priv->len)
|
||||
{
|
||||
@ -455,10 +456,10 @@ g_memory_input_stream_can_truncate (GSeekable *seekable)
|
||||
}
|
||||
|
||||
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,
|
||||
@ -469,5 +470,3 @@ g_memory_input_stream_truncate (GSeekable *seekable,
|
||||
|
||||
#define __G_MEMORY_INPUT_STREAM_C__
|
||||
#include "gioaliasdef.c"
|
||||
|
||||
/* vim: ts=2 sw=2 et */
|
||||
|
@ -227,13 +227,12 @@ g_memory_output_stream_new (GByteArray *data)
|
||||
{
|
||||
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;
|
||||
}
|
||||
@ -246,7 +245,7 @@ g_memory_output_stream_new (GByteArray *data)
|
||||
**/
|
||||
void
|
||||
g_memory_output_stream_set_free_data (GMemoryOutputStream *ostream,
|
||||
gboolean free_data)
|
||||
gboolean free_data)
|
||||
{
|
||||
GMemoryOutputStreamPrivate *priv;
|
||||
|
||||
@ -276,23 +275,23 @@ g_memory_output_stream_set_max_size (GMemoryOutputStream *ostream,
|
||||
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;
|
||||
@ -306,18 +305,18 @@ g_memory_output_stream_set_property (GObject *object,
|
||||
{
|
||||
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;
|
||||
@ -395,19 +394,18 @@ array_check_boundary (GMemoryOutputStream *stream,
|
||||
|
||||
priv = stream->priv;
|
||||
|
||||
if (! priv->max_size) {
|
||||
if (!priv->max_size)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (priv->max_size < size || size > G_MAXUINT) {
|
||||
if (priv->max_size < size || size > G_MAXUINT)
|
||||
{
|
||||
g_set_error (error,
|
||||
G_IO_ERROR,
|
||||
G_IO_ERROR_FAILED,
|
||||
"Reached maximum data array limit");
|
||||
|
||||
g_set_error (error,
|
||||
G_IO_ERROR,
|
||||
G_IO_ERROR_FAILED,
|
||||
"Reached maximum data array limit");
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@ -436,16 +434,15 @@ array_resize (GMemoryOutputStream *stream,
|
||||
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;
|
||||
@ -465,9 +462,7 @@ g_memory_output_stream_write (GOutputStream *stream,
|
||||
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);
|
||||
|
||||
@ -480,9 +475,7 @@ g_memory_output_stream_write (GOutputStream *stream,
|
||||
return -1;
|
||||
}
|
||||
else if (n < 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
dest = priv->data->data + priv->pos;
|
||||
@ -507,13 +500,13 @@ g_memory_output_stream_close (GOutputStream *stream,
|
||||
}
|
||||
|
||||
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;
|
||||
@ -533,13 +526,12 @@ g_memory_output_stream_write_async (GOutputStream *stream,
|
||||
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;
|
||||
@ -554,11 +546,11 @@ g_memory_output_stream_write_finish (GOutputStream *stream,
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
@ -573,13 +565,12 @@ g_memory_output_stream_close_async (GOutputStream *stream,
|
||||
|
||||
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;
|
||||
|
||||
@ -588,12 +579,11 @@ g_memory_output_stream_close_finish (GOutputStream *stream,
|
||||
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;
|
||||
@ -611,11 +601,11 @@ g_memory_output_stream_can_seek (GSeekable *seekable)
|
||||
}
|
||||
|
||||
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;
|
||||
@ -624,8 +614,8 @@ g_memory_output_stream_seek (GSeekable *seekable,
|
||||
stream = G_MEMORY_OUTPUT_STREAM (seekable);
|
||||
priv = stream->priv;
|
||||
|
||||
switch (type) {
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case G_SEEK_CUR:
|
||||
absolute = priv->pos + offset;
|
||||
break;
|
||||
@ -645,17 +635,18 @@ g_memory_output_stream_seek (GSeekable *seekable,
|
||||
"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;
|
||||
@ -670,10 +661,10 @@ g_memory_output_stream_can_truncate (GSeekable *seekable)
|
||||
}
|
||||
|
||||
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;
|
||||
@ -682,12 +673,10 @@ g_memory_output_stream_truncate (GSeekable *seekable,
|
||||
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 */
|
||||
|
@ -390,7 +390,7 @@ g_mount_operation_get_choice (GMountOperation *op)
|
||||
**/
|
||||
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;
|
||||
|
@ -172,11 +172,11 @@ g_output_stream_init (GOutputStream *stream)
|
||||
* 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;
|
||||
@ -235,7 +235,8 @@ g_output_stream_write (GOutputStream *stream,
|
||||
* @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
|
||||
*
|
||||
@ -255,12 +256,12 @@ g_output_stream_write (GOutputStream *stream,
|
||||
* 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;
|
||||
@ -288,6 +289,7 @@ g_output_stream_write_all (GOutputStream *stream,
|
||||
|
||||
if (bytes_written)
|
||||
*bytes_written = _bytes_written;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -297,8 +299,8 @@ g_output_stream_write_all (GOutputStream *stream,
|
||||
* @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.
|
||||
*
|
||||
@ -309,9 +311,9 @@ g_output_stream_write_all (GOutputStream *stream,
|
||||
* 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;
|
||||
@ -365,11 +367,11 @@ g_output_stream_flush (GOutputStream *stream,
|
||||
* 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;
|
||||
@ -415,11 +417,11 @@ g_output_stream_splice (GOutputStream *stream,
|
||||
}
|
||||
|
||||
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;
|
||||
@ -576,9 +578,9 @@ g_output_stream_close (GOutputStream *stream,
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
@ -589,9 +591,9 @@ async_ready_callback_wrapper (GObject *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);
|
||||
|
||||
@ -607,33 +609,36 @@ async_ready_close_callback_wrapper (GObject *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,
|
||||
@ -712,9 +717,9 @@ 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;
|
||||
@ -744,9 +749,9 @@ typedef struct {
|
||||
} 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;
|
||||
@ -775,13 +780,13 @@ async_ready_splice_callback_wrapper (GObject *source_object,
|
||||
*
|
||||
**/
|
||||
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;
|
||||
@ -845,9 +850,9 @@ g_output_stream_splice_async (GOutputStream *stream,
|
||||
* 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;
|
||||
@ -879,10 +884,10 @@ g_output_stream_splice_finish (GOutputStream *stream,
|
||||
**/
|
||||
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;
|
||||
@ -941,9 +946,9 @@ g_output_stream_flush_async (GOutputStream *stream,
|
||||
* 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;
|
||||
@ -975,21 +980,22 @@ g_output_stream_flush_finish (GOutputStream *stream,
|
||||
* @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;
|
||||
@ -1037,9 +1043,9 @@ g_output_stream_close_async (GOutputStream *stream,
|
||||
* 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;
|
||||
@ -1102,8 +1108,8 @@ g_output_stream_has_pending (GOutputStream *stream)
|
||||
* 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));
|
||||
|
||||
@ -1123,8 +1129,8 @@ typedef struct {
|
||||
|
||||
static void
|
||||
write_async_thread (GSimpleAsyncResult *res,
|
||||
GObject *object,
|
||||
GCancellable *cancellable)
|
||||
GObject *object,
|
||||
GCancellable *cancellable)
|
||||
{
|
||||
WriteData *op;
|
||||
GOutputStreamClass *class;
|
||||
@ -1143,12 +1149,12 @@ write_async_thread (GSimpleAsyncResult *res,
|
||||
|
||||
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;
|
||||
@ -1164,9 +1170,9 @@ g_output_stream_real_write_async (GOutputStream *stream,
|
||||
}
|
||||
|
||||
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;
|
||||
@ -1184,8 +1190,8 @@ typedef struct {
|
||||
|
||||
static void
|
||||
splice_async_thread (GSimpleAsyncResult *result,
|
||||
GObject *object,
|
||||
GCancellable *cancellable)
|
||||
GObject *object,
|
||||
GCancellable *cancellable)
|
||||
{
|
||||
SpliceData *op;
|
||||
GOutputStreamClass *class;
|
||||
@ -1213,13 +1219,13 @@ splice_async_thread (GSimpleAsyncResult *result,
|
||||
}
|
||||
|
||||
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;
|
||||
@ -1238,9 +1244,9 @@ g_output_stream_real_splice_async (GOutputStream *stream,
|
||||
}
|
||||
|
||||
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;
|
||||
@ -1251,11 +1257,10 @@ g_output_stream_real_splice_finish (GOutputStream *stream,
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
flush_async_thread (GSimpleAsyncResult *res,
|
||||
GObject *object,
|
||||
GCancellable *cancellable)
|
||||
GObject *object,
|
||||
GCancellable *cancellable)
|
||||
{
|
||||
GOutputStreamClass *class;
|
||||
gboolean result;
|
||||
@ -1275,10 +1280,10 @@ flush_async_thread (GSimpleAsyncResult *res,
|
||||
|
||||
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;
|
||||
|
||||
@ -1289,17 +1294,17 @@ g_output_stream_real_flush_async (GOutputStream *stream,
|
||||
}
|
||||
|
||||
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;
|
||||
@ -1320,11 +1325,11 @@ close_async_thread (GSimpleAsyncResult *res,
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
@ -1337,9 +1342,9 @@ g_output_stream_real_close_async (GOutputStream *stream,
|
||||
}
|
||||
|
||||
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);
|
||||
|
@ -75,7 +75,8 @@ g_poll_file_monitor_init (GPollFileMonitor* poll_monitor)
|
||||
}
|
||||
|
||||
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;
|
||||
@ -112,9 +113,9 @@ calc_event_type (GFileInfo *last,
|
||||
}
|
||||
|
||||
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;
|
||||
@ -176,9 +177,9 @@ schedule_poll_timeout (GPollFileMonitor* poll_monitor)
|
||||
}
|
||||
|
||||
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;
|
||||
|
@ -45,7 +45,7 @@ g_seekable_get_type (void)
|
||||
{
|
||||
static GType seekable_type = 0;
|
||||
|
||||
if (! seekable_type)
|
||||
if (!seekable_type)
|
||||
{
|
||||
static const GTypeInfo seekable_info =
|
||||
{
|
||||
@ -131,8 +131,8 @@ g_seekable_can_seek (GSeekable *seekable)
|
||||
* 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,
|
||||
@ -187,8 +187,8 @@ g_seekable_can_truncate (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,
|
||||
|
@ -65,26 +65,27 @@
|
||||
* 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(),
|
||||
@ -181,10 +182,10 @@ g_simple_async_result_init (GSimpleAsyncResult *simple)
|
||||
* 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;
|
||||
|
||||
@ -211,10 +212,10 @@ g_simple_async_result_new (GObject *source_object,
|
||||
* 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;
|
||||
|
||||
@ -236,20 +237,20 @@ g_simple_async_result_new_from_error (GObject *source_object,
|
||||
* @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;
|
||||
@ -301,7 +302,7 @@ g_simple_async_result_async_result_iface_init (GAsyncResultIface *iface)
|
||||
**/
|
||||
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;
|
||||
@ -333,8 +334,8 @@ g_simple_async_result_get_source_tag (GSimpleAsyncResult *simple)
|
||||
* 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);
|
||||
|
||||
@ -344,6 +345,7 @@ g_simple_async_result_propagate_error (GSimpleAsyncResult *simple,
|
||||
simple->error = NULL;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -356,9 +358,9 @@ g_simple_async_result_propagate_error (GSimpleAsyncResult *simple,
|
||||
* 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));
|
||||
|
||||
@ -375,7 +377,7 @@ g_simple_async_result_set_op_res_gpointer (GSimpleAsyncResult *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;
|
||||
@ -386,11 +388,12 @@ g_simple_async_result_get_op_res_gpointer (GSimpleAsyncResult *simple)
|
||||
* @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;
|
||||
@ -405,7 +408,7 @@ g_simple_async_result_set_op_res_gssize (GSimpleAsyncResult *simple,
|
||||
* 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;
|
||||
@ -417,11 +420,10 @@ g_simple_async_result_get_op_res_gssize (GSimpleAsyncResult *simple)
|
||||
* @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;
|
||||
@ -433,11 +435,11 @@ g_simple_async_result_set_op_res_gboolean (GSimpleAsyncResult *simple,
|
||||
*
|
||||
* 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;
|
||||
@ -452,7 +454,7 @@ g_simple_async_result_get_op_res_gboolean (GSimpleAsyncResult *simple)
|
||||
**/
|
||||
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);
|
||||
@ -462,10 +464,10 @@ g_simple_async_result_set_from_error (GSimpleAsyncResult *simple,
|
||||
}
|
||||
|
||||
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;
|
||||
@ -486,15 +488,15 @@ _g_error_new_valist (GQuark domain,
|
||||
* @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);
|
||||
@ -510,17 +512,16 @@ g_simple_async_result_set_error_va (GSimpleAsyncResult *simple,
|
||||
* @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;
|
||||
|
||||
@ -538,7 +539,6 @@ g_simple_async_result_set_error (GSimpleAsyncResult *simple,
|
||||
* @simple: a #GSimpleAsyncResult.
|
||||
*
|
||||
* Completes an asynchronous I/O job.
|
||||
*
|
||||
**/
|
||||
void
|
||||
g_simple_async_result_complete (GSimpleAsyncResult *simple)
|
||||
@ -567,7 +567,6 @@ complete_in_idle_cb (gpointer data)
|
||||
*
|
||||
* Completes an asynchronous function in the main event loop using
|
||||
* an idle function.
|
||||
*
|
||||
**/
|
||||
void
|
||||
g_simple_async_result_complete_in_idle (GSimpleAsyncResult *simple)
|
||||
@ -593,27 +592,23 @@ typedef struct {
|
||||
} 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);
|
||||
@ -628,13 +623,12 @@ run_in_thread (GIOJob *job,
|
||||
* @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;
|
||||
|
||||
@ -655,19 +649,18 @@ g_simple_async_result_run_in_thread (GSimpleAsyncResult *simple,
|
||||
* @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;
|
||||
|
@ -37,7 +37,7 @@
|
||||
* 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
|
||||
{
|
||||
@ -114,7 +114,8 @@ g_themed_icon_new (const char *iconname)
|
||||
* 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;
|
||||
@ -168,7 +169,7 @@ g_themed_icon_hash (GIcon *icon)
|
||||
|
||||
static gboolean
|
||||
g_themed_icon_equal (GIcon *icon1,
|
||||
GIcon *icon2)
|
||||
GIcon *icon2)
|
||||
{
|
||||
GThemedIcon *themed1 = G_THEMED_ICON (icon1);
|
||||
GThemedIcon *themed2 = G_THEMED_ICON (icon2);
|
||||
|
@ -152,9 +152,9 @@ g_union_volume_monitor_class_init (GUnionVolumeMonitorClass *klass)
|
||||
}
|
||||
|
||||
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",
|
||||
@ -162,9 +162,9 @@ child_volume_mounted (GVolumeMonitor *child_monitor,
|
||||
}
|
||||
|
||||
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",
|
||||
@ -172,9 +172,9 @@ child_volume_pre_unmount (GVolumeMonitor *child_monitor,
|
||||
}
|
||||
|
||||
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",
|
||||
@ -182,9 +182,9 @@ child_volume_unmounted (GVolumeMonitor *child_monitor,
|
||||
}
|
||||
|
||||
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",
|
||||
@ -192,9 +192,9 @@ child_drive_connected (GVolumeMonitor *child_monitor,
|
||||
}
|
||||
|
||||
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",
|
||||
@ -203,7 +203,7 @@ child_drive_disconnected (GVolumeMonitor *child_monitor,
|
||||
|
||||
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;
|
||||
@ -221,7 +221,7 @@ g_union_volume_monitor_add_monitor (GUnionVolumeMonitor *union_monitor,
|
||||
|
||||
static void
|
||||
g_union_volume_monitor_remove_monitor (GUnionVolumeMonitor *union_monitor,
|
||||
GVolumeMonitor *child_monitor)
|
||||
GVolumeMonitor *child_monitor)
|
||||
{
|
||||
GList *l;
|
||||
|
||||
|
@ -126,8 +126,8 @@ type_to_icon (GUnixMountType type)
|
||||
* 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;
|
||||
|
||||
@ -170,8 +170,8 @@ _g_unix_drive_disconnected (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;
|
||||
@ -192,8 +192,8 @@ _g_unix_drive_set_volume (GUnixDrive *drive,
|
||||
*
|
||||
**/
|
||||
void
|
||||
_g_unix_drive_unset_volume (GUnixDrive *drive,
|
||||
GUnixVolume *volume)
|
||||
_g_unix_drive_unset_volume (GUnixDrive *drive,
|
||||
GUnixVolume *volume)
|
||||
{
|
||||
if (drive->volume == volume)
|
||||
{
|
||||
@ -270,37 +270,37 @@ _g_unix_drive_has_mountpoint (GUnixDrive *drive,
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -149,7 +149,7 @@ g_unix_input_stream_init (GUnixInputStream *unix_stream)
|
||||
* 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;
|
||||
@ -165,11 +165,11 @@ g_unix_input_stream_new (int fd,
|
||||
}
|
||||
|
||||
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;
|
||||
@ -225,9 +225,9 @@ g_unix_input_stream_read (GInputStream *stream,
|
||||
}
|
||||
|
||||
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;
|
||||
@ -242,12 +242,10 @@ g_unix_input_stream_close (GInputStream *stream,
|
||||
/* 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;
|
||||
}
|
||||
|
||||
@ -265,8 +263,8 @@ typedef struct {
|
||||
|
||||
static gboolean
|
||||
read_async_cb (ReadAsyncData *data,
|
||||
GIOCondition condition,
|
||||
int fd)
|
||||
GIOCondition condition,
|
||||
int fd)
|
||||
{
|
||||
GSimpleAsyncResult *simple;
|
||||
GError *error = NULL;
|
||||
@ -348,9 +346,9 @@ g_unix_input_stream_read_async (GInputStream *stream,
|
||||
}
|
||||
|
||||
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;
|
||||
@ -375,9 +373,9 @@ g_unix_input_stream_skip_async (GInputStream *stream,
|
||||
}
|
||||
|
||||
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 */
|
||||
@ -419,12 +417,10 @@ close_async_cb (CloseAsyncData *data)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
@ -450,11 +446,11 @@ close_async_cb (CloseAsyncData *data)
|
||||
}
|
||||
|
||||
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;
|
||||
@ -472,9 +468,9 @@ g_unix_input_stream_close_async (GInputStream *stream,
|
||||
}
|
||||
|
||||
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;
|
||||
|
@ -686,7 +686,8 @@ aix_fs_ignorespace (FILE *fd)
|
||||
|
||||
/* read one word from file */
|
||||
static int
|
||||
aix_fs_getword (FILE *fd, char *word)
|
||||
aix_fs_getword (FILE *fd,
|
||||
char *word)
|
||||
{
|
||||
int c;
|
||||
|
||||
@ -716,7 +717,8 @@ typedef struct {
|
||||
|
||||
/* 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];
|
||||
@ -1069,11 +1071,11 @@ g_unix_mount_monitor_class_init (GUnixMountMonitorClass *klass)
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
@ -1087,11 +1089,11 @@ fstab_file_changed (GFileMonitor* 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;
|
||||
|
||||
@ -1205,8 +1207,8 @@ strcmp_null (const char *str1,
|
||||
* or less than @mount2, respectively.
|
||||
**/
|
||||
gint
|
||||
g_unix_mount_compare (GUnixMount *mount1,
|
||||
GUnixMount *mount2)
|
||||
g_unix_mount_compare (GUnixMount *mount1,
|
||||
GUnixMount *mount2)
|
||||
{
|
||||
int res;
|
||||
|
||||
|
@ -137,7 +137,7 @@ g_unix_output_stream_init (GUnixOutputStream *unix_stream)
|
||||
* @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;
|
||||
@ -153,11 +153,11 @@ g_unix_output_stream_new (int fd,
|
||||
}
|
||||
|
||||
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;
|
||||
@ -214,9 +214,9 @@ g_unix_output_stream_write (GOutputStream *stream,
|
||||
}
|
||||
|
||||
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;
|
||||
@ -254,8 +254,8 @@ typedef struct {
|
||||
|
||||
static gboolean
|
||||
write_async_cb (WriteAsyncData *data,
|
||||
GIOCondition condition,
|
||||
int fd)
|
||||
GIOCondition condition,
|
||||
int fd)
|
||||
{
|
||||
GSimpleAsyncResult *simple;
|
||||
GError *error = NULL;
|
||||
@ -304,13 +304,13 @@ write_async_cb (WriteAsyncData *data,
|
||||
}
|
||||
|
||||
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;
|
||||
@ -337,9 +337,9 @@ g_unix_output_stream_write_async (GOutputStream *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;
|
||||
@ -409,11 +409,11 @@ close_async_cb (CloseAsyncData *data)
|
||||
}
|
||||
|
||||
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;
|
||||
@ -431,9 +431,9 @@ g_unix_output_stream_close_async (GOutputStream *stream,
|
||||
}
|
||||
|
||||
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;
|
||||
|
@ -171,10 +171,8 @@ _g_unix_volume_new (GUnixMount *mount,
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
@ -193,8 +191,8 @@ _g_unix_volume_unmounted (GUnixVolume *volume)
|
||||
}
|
||||
|
||||
void
|
||||
_g_unix_volume_unset_drive (GUnixVolume *volume,
|
||||
GUnixDrive *drive)
|
||||
_g_unix_volume_unset_drive (GUnixVolume *volume,
|
||||
GUnixDrive *drive)
|
||||
{
|
||||
if (volume->drive == drive)
|
||||
{
|
||||
@ -261,18 +259,18 @@ g_unix_volume_can_eject (GVolume *volume)
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -140,7 +140,7 @@ g_unix_volume_monitor_class_init (GUnixVolumeMonitorClass *klass)
|
||||
|
||||
static void
|
||||
mountpoints_changed (GUnixMountMonitor *mount_monitor,
|
||||
gpointer user_data)
|
||||
gpointer user_data)
|
||||
{
|
||||
GUnixVolumeMonitor *unix_monitor = user_data;
|
||||
|
||||
@ -151,7 +151,7 @@ mountpoints_changed (GUnixMountMonitor *mount_monitor,
|
||||
|
||||
static void
|
||||
mounts_changed (GUnixMountMonitor *mount_monitor,
|
||||
gpointer user_data)
|
||||
gpointer user_data)
|
||||
{
|
||||
GUnixVolumeMonitor *unix_monitor = user_data;
|
||||
|
||||
@ -195,8 +195,11 @@ _g_unix_volume_monitor_new (void)
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
@ -244,7 +247,7 @@ diff_sorted_lists (GList *list1, GList *list2, GCompareFunc compare,
|
||||
**/
|
||||
GUnixDrive *
|
||||
_g_unix_volume_monitor_lookup_drive_for_mountpoint (GUnixVolumeMonitor *monitor,
|
||||
const char *mountpoint)
|
||||
const char *mountpoint)
|
||||
{
|
||||
GList *l;
|
||||
|
||||
|
@ -81,7 +81,7 @@ g_vfs_is_active (GVfs *vfs)
|
||||
* 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;
|
||||
@ -109,7 +109,7 @@ g_vfs_get_file_for_path (GVfs *vfs,
|
||||
*
|
||||
**/
|
||||
GFile *
|
||||
g_vfs_get_file_for_uri (GVfs *vfs,
|
||||
g_vfs_get_file_for_uri (GVfs *vfs,
|
||||
const char *uri)
|
||||
{
|
||||
GVfsClass *class;
|
||||
@ -154,7 +154,7 @@ g_vfs_get_supported_uri_schemes (GVfs *vfs)
|
||||
* 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;
|
||||
|
@ -247,16 +247,15 @@ g_volume_can_eject (GVolume *volume)
|
||||
* @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;
|
||||
|
||||
@ -290,9 +289,9 @@ g_volume_unmount (GVolume *volume,
|
||||
* 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;
|
||||
|
||||
@ -317,16 +316,15 @@ g_volume_unmount_finish (GVolume *volume,
|
||||
* @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;
|
||||
|
||||
@ -360,9 +358,9 @@ g_volume_eject (GVolume *volume,
|
||||
* 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;
|
||||
|
||||
|
@ -32,7 +32,6 @@
|
||||
* @see_also: #GDirectoryMonitor, #GFileMonitor
|
||||
*
|
||||
* Monitors a mounted volume for changes.
|
||||
*
|
||||
**/
|
||||
|
||||
G_DEFINE_TYPE (GVolumeMonitor, g_volume_monitor, G_TYPE_OBJECT);
|
||||
@ -154,7 +153,7 @@ g_volume_monitor_init (GVolumeMonitor *monitor)
|
||||
* 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;
|
||||
|
||||
|
@ -183,7 +183,7 @@ g_win32_app_info_dup (GAppInfo *appinfo)
|
||||
|
||||
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);
|
||||
@ -239,10 +239,10 @@ g_win32_app_info_get_icon (GAppInfo *appinfo)
|
||||
}
|
||||
|
||||
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;
|
||||
@ -256,11 +256,11 @@ g_win32_app_info_launch (GAppInfo *appinfo,
|
||||
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;
|
||||
@ -320,17 +320,19 @@ g_win32_app_info_supports_uris (GAppInfo *appinfo)
|
||||
}
|
||||
|
||||
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);
|
||||
@ -343,20 +345,24 @@ g_win32_app_info_should_show (GAppInfo *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;
|
||||
}
|
||||
|
||||
@ -379,7 +385,7 @@ g_win32_app_info_iface_init (GAppInfoIface *iface)
|
||||
}
|
||||
|
||||
static void
|
||||
enumerate_open_with_list (HKEY dir_key,
|
||||
enumerate_open_with_list (HKEY dir_key,
|
||||
GList **prognames)
|
||||
{
|
||||
DWORD index;
|
||||
@ -393,14 +399,14 @@ enumerate_open_with_list (HKEY dir_key,
|
||||
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 &&
|
||||
@ -418,14 +424,14 @@ enumerate_open_with_list (HKEY dir_key,
|
||||
|
||||
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++;
|
||||
@ -443,14 +449,14 @@ enumerate_open_with_progids (HKEY dir_key,
|
||||
|
||||
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++;
|
||||
@ -459,7 +465,7 @@ enumerate_open_with_progids (HKEY dir_key,
|
||||
}
|
||||
|
||||
static void
|
||||
enumerate_open_with_root (HKEY dir_key,
|
||||
enumerate_open_with_root (HKEY dir_key,
|
||||
GList **progids,
|
||||
GList **prognames)
|
||||
{
|
||||
@ -481,13 +487,14 @@ enumerate_open_with_root (HKEY dir_key,
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
@ -577,7 +584,7 @@ g_app_info_get_all_for_type (const char *content_type)
|
||||
|
||||
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];
|
||||
@ -587,12 +594,12 @@ g_app_info_get_default_for_type (const char *content_type,
|
||||
|
||||
/* 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);
|
||||
|
||||
@ -624,14 +631,14 @@ g_app_info_get_all (void)
|
||||
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 */
|
||||
|
Loading…
Reference in New Issue
Block a user