static void recent_backend_add_info (RecentItem *item, GFileInfo *info) { g_assert (item != NULL); g_file_info_set_name (info, item->guid); g_file_info_set_display_name (info, item->display_name); g_file_info_set_attribute_string (info, G_FILE_ATTRIBUTE_STANDARD_TARGET_URI, item->uri); g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE, FALSE); g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_EXECUTE, FALSE); g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_RENAME, FALSE); g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_TRASH, FALSE); g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_DELETE, TRUE); }
static gboolean trash_backend_query_fs_info (GVfsBackend *vfs_backend, GVfsJobQueryFsInfo *job, const char *filename, GFileInfo *info, GFileAttributeMatcher *matcher) { g_file_info_set_attribute_string (info, G_FILE_ATTRIBUTE_FILESYSTEM_TYPE, "trash"); g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_FILESYSTEM_REMOTE, FALSE); g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_FILESYSTEM_READONLY, FALSE); g_file_info_set_attribute_uint32 (info, G_FILE_ATTRIBUTE_FILESYSTEM_USE_PREVIEW, G_FILESYSTEM_PREVIEW_TYPE_IF_LOCAL); g_vfs_job_succeeded (G_VFS_JOB (job)); return TRUE; }
gboolean ostree_zlib_file_header_parse (GVariant *metadata, GFileInfo **out_file_info, GVariant **out_xattrs, GError **error) { gboolean ret = FALSE; guint64 size; guint32 uid, gid, mode, rdev; const char *symlink_target; ot_lobj GFileInfo *ret_file_info = NULL; ot_lvariant GVariant *ret_xattrs = NULL; g_variant_get (metadata, "(tuuuu&s@a(ayay))", &size, &uid, &gid, &mode, &rdev, &symlink_target, &ret_xattrs); size = GUINT64_FROM_BE (size); uid = GUINT32_FROM_BE (uid); gid = GUINT32_FROM_BE (gid); mode = GUINT32_FROM_BE (mode); rdev = GUINT32_FROM_BE (rdev); ret_file_info = g_file_info_new (); g_file_info_set_size (ret_file_info, size); g_file_info_set_attribute_uint32 (ret_file_info, "standard::type", ot_gfile_type_for_mode (mode)); g_file_info_set_attribute_boolean (ret_file_info, "standard::is-symlink", S_ISLNK (mode)); g_file_info_set_attribute_uint32 (ret_file_info, "unix::uid", uid); g_file_info_set_attribute_uint32 (ret_file_info, "unix::gid", gid); g_file_info_set_attribute_uint32 (ret_file_info, "unix::mode", mode); if (S_ISREG (mode)) { ; } else if (S_ISLNK (mode)) { g_file_info_set_attribute_byte_string (ret_file_info, "standard::symlink-target", symlink_target); } else if (S_ISCHR (mode) || S_ISBLK (mode)) { g_file_info_set_attribute_uint32 (ret_file_info, "unix::rdev", rdev); } else if (S_ISFIFO (mode)) { ; } else { g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "Corrupted archive file; invalid mode %u", mode); goto out; } ret = TRUE; ot_transfer_out_value(out_file_info, &ret_file_info); ot_transfer_out_value(out_xattrs, &ret_xattrs); out: return ret; }
static gboolean try_query_fs_info (GVfsBackend *backend, GVfsJobQueryFsInfo *job, const char *filename, GFileInfo *info, GFileAttributeMatcher *matcher) { g_file_info_set_attribute_string (info, G_FILE_ATTRIBUTE_FILESYSTEM_TYPE, "http"); g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_FILESYSTEM_REMOTE, TRUE); g_vfs_job_succeeded (G_VFS_JOB (job)); return TRUE; }
static void fill_info (GFileInfo *info, GVfsAfpVolumeData *vol_data, GVfsBackendAfpBrowse *afp_backend) { GIcon *icon; GMountSpec *mount_spec; char *uri; g_file_info_set_name (info, vol_data->name); g_file_info_set_display_name (info, vol_data->name); g_file_info_set_edit_name (info, vol_data->name); g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_STANDARD_IS_VIRTUAL, TRUE); g_file_info_set_content_type (info, "inode/directory"); g_file_info_set_file_type (info, G_FILE_TYPE_MOUNTABLE); g_file_info_set_attribute_boolean (info, "afp::volume-password-protected", (vol_data->flags & 0x01)); icon = g_themed_icon_new_with_default_fallbacks ("folder-remote-afp"); g_file_info_set_icon (info, icon); g_object_unref (icon); icon = g_themed_icon_new_with_default_fallbacks ("folder-remote-symbolic"); g_file_info_set_symbolic_icon (info, icon); g_object_unref (icon); mount_spec = g_mount_spec_new ("afp-volume"); g_mount_spec_set (mount_spec, "host", g_network_address_get_hostname (G_NETWORK_ADDRESS (afp_backend->addr))); g_mount_spec_set (mount_spec, "volume", vol_data->name); g_mount_spec_set (mount_spec, "user", afp_backend->logged_in_user); if (g_mount_tracker_has_mount_spec (afp_backend->mount_tracker, mount_spec)) { g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_MOUNTABLE_CAN_MOUNT, FALSE); g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_MOUNTABLE_CAN_UNMOUNT, TRUE); } else { g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_MOUNTABLE_CAN_MOUNT, TRUE); g_file_info_set_attribute_boolean(info, G_FILE_ATTRIBUTE_MOUNTABLE_CAN_UNMOUNT, FALSE); } g_mount_spec_unref (mount_spec); uri = g_strdup_printf ("afp://%s/%s", g_network_address_get_hostname (G_NETWORK_ADDRESS (afp_backend->addr)), vol_data->name); g_file_info_set_attribute_string (info, G_FILE_ATTRIBUTE_STANDARD_TARGET_URI, uri); g_free (uri); }
static void gth_metadata_provider_comment_read (GthMetadataProvider *self, GthFileData *file_data, const char *attributes, GCancellable *cancellable) { GthComment *comment; const char *value; GPtrArray *categories; char *comment_time; comment = gth_comment_new_for_file (file_data->file, cancellable, NULL); g_file_info_set_attribute_boolean (file_data->info, "comment::no-comment-file", (comment == NULL)); if (comment == NULL) return; value = gth_comment_get_note (comment); if (value != NULL) g_file_info_set_attribute_string (file_data->info, "comment::note", value); value = gth_comment_get_caption (comment); if (value != NULL) g_file_info_set_attribute_string (file_data->info, "comment::caption", value); value = gth_comment_get_place (comment); if (value != NULL) g_file_info_set_attribute_string (file_data->info, "comment::place", value); if (gth_comment_get_rating (comment) > 0) g_file_info_set_attribute_int32 (file_data->info, "comment::rating", gth_comment_get_rating (comment)); else g_file_info_remove_attribute (file_data->info, "comment::rating"); categories = gth_comment_get_categories (comment); if (categories->len > 0) { GthStringList *list; GthMetadata *metadata; list = gth_string_list_new_from_ptr_array (categories); metadata = gth_metadata_new_for_string_list (list); g_file_info_set_attribute_object (file_data->info, "comment::categories", G_OBJECT (metadata)); g_object_unref (metadata); g_object_unref (list); } else g_file_info_remove_attribute (file_data->info, "comment::categories"); comment_time = gth_comment_get_time_as_exif_format (comment); if (comment_time != NULL) { GTimeVal time_; char *formatted; if (_g_time_val_from_exif_date (comment_time, &time_)) formatted = _g_time_val_strftime (&time_, "%x %X"); else formatted = g_strdup (comment_time); set_attribute_from_string (file_data->info, "comment::time", comment_time, formatted); g_free (formatted); g_free (comment_time); } else g_file_info_remove_attribute (file_data->info, "comment::time"); gth_comment_update_general_attributes (file_data); g_object_unref (comment); }
static void trash_backend_add_info (TrashItem *item, GFileInfo *info, gboolean is_toplevel) { if (is_toplevel) { const gchar *delete_date; GFile *original, *real; g_assert (item != NULL); original = trash_item_get_original (item); if (original) { gchar *edit_name, *path; path = g_file_get_path (original); edit_name = gvfs_file_info_populate_names_as_local (info, path); g_file_info_set_attribute_byte_string (info, G_FILE_ATTRIBUTE_TRASH_ORIG_PATH, path); g_free (edit_name); g_free (path); } real = trash_item_get_file (item); if (real) { char *uri; uri = g_file_get_uri (real); g_file_info_set_attribute_string (info, G_FILE_ATTRIBUTE_STANDARD_TARGET_URI, uri); g_free (uri); } delete_date = trash_item_get_delete_date (item); if (delete_date) g_file_info_set_attribute_string (info, G_FILE_ATTRIBUTE_TRASH_DELETION_DATE, delete_date); } g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE, FALSE); g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_EXECUTE, FALSE); g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_RENAME, FALSE); g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_TRASH, FALSE); g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_DELETE, is_toplevel); }
static gboolean recent_backend_query_info (GVfsBackend *vfs_backend, GVfsJobQueryInfo *job, const char *filename, GFileQueryInfoFlags flags, GFileInfo *info, GFileAttributeMatcher *matcher) { GVfsBackendRecent *backend = G_VFS_BACKEND_RECENT (vfs_backend); g_assert (filename[0] == '/'); if (filename[1]) { GError *error = NULL; RecentItem *item = NULL; GFile *real; real = recent_backend_get_file (backend, filename, &item, &error); if (real) { GFileInfo *real_info; real_info = g_file_query_info (real, job->attributes, flags, G_VFS_JOB (job)->cancellable, &error); g_object_unref (real); if (real_info) { g_file_info_copy_into (real_info, info); recent_backend_add_info (item, info); g_vfs_job_succeeded (G_VFS_JOB (job)); g_object_unref (real_info); return TRUE; } } g_vfs_job_failed_from_error (G_VFS_JOB (job), error); g_error_free (error); } else { GIcon *icon; g_file_info_set_file_type (info, G_FILE_TYPE_DIRECTORY); g_file_info_set_name (info, "/"); /* Translators: this is the display name of the backend */ g_file_info_set_display_name (info, _("Recent")); g_file_info_set_content_type (info, "inode/directory"); g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE, FALSE); g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_DELETE, TRUE); g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_TRASH, FALSE); icon = g_themed_icon_new ("document-open-recent"); g_file_info_set_icon (info, icon); g_object_unref (icon); icon = g_themed_icon_new ("document-open-recent-symbolic"); g_file_info_set_symbolic_icon (info, icon); g_object_unref (icon); g_vfs_job_succeeded (G_VFS_JOB (job)); } return TRUE; }
GFileInfo * gvfs_file_info_demarshal (char *data, gsize size) { guint32 num_attrs, i; GInputStream *memstream; GDataInputStream *in; GFileInfo *info; char *attr, *str, **strv; GFileAttributeType type; GFileAttributeStatus status; GObject *obj; int objtype; memstream = g_memory_input_stream_new_from_data (data, size, NULL); in = g_data_input_stream_new (memstream); g_object_unref (memstream); info = g_file_info_new (); num_attrs = g_data_input_stream_read_uint32 (in, NULL, NULL); for (i = 0; i < num_attrs; i++) { attr = read_string (in); type = g_data_input_stream_read_byte (in, NULL, NULL); status = g_data_input_stream_read_byte (in, NULL, NULL); switch (type) { case G_FILE_ATTRIBUTE_TYPE_STRING: str = read_string (in); g_file_info_set_attribute_string (info, attr, str); g_free (str); break; case G_FILE_ATTRIBUTE_TYPE_BYTE_STRING: str = read_string (in); g_file_info_set_attribute_byte_string (info, attr, str); g_free (str); break; case G_FILE_ATTRIBUTE_TYPE_STRINGV: strv = read_stringv (in); g_file_info_set_attribute_stringv (info, attr, strv); g_strfreev (strv); break; case G_FILE_ATTRIBUTE_TYPE_BOOLEAN: g_file_info_set_attribute_boolean (info, attr, g_data_input_stream_read_byte (in, NULL, NULL)); break; case G_FILE_ATTRIBUTE_TYPE_UINT32: g_file_info_set_attribute_uint32 (info, attr, g_data_input_stream_read_uint32 (in, NULL, NULL)); break; case G_FILE_ATTRIBUTE_TYPE_INT32: g_file_info_set_attribute_int32 (info, attr, g_data_input_stream_read_int32 (in, NULL, NULL)); break; case G_FILE_ATTRIBUTE_TYPE_UINT64: g_file_info_set_attribute_uint64 (info, attr, g_data_input_stream_read_uint64 (in, NULL, NULL)); break; case G_FILE_ATTRIBUTE_TYPE_INT64: g_file_info_set_attribute_int64 (info, attr, g_data_input_stream_read_int64 (in, NULL, NULL)); break; case G_FILE_ATTRIBUTE_TYPE_OBJECT: objtype = g_data_input_stream_read_byte (in, NULL, NULL); obj = NULL; if (objtype == 1) { char *icon_str; icon_str = read_string (in); obj = (GObject *)g_icon_new_for_string (icon_str, NULL); g_free (icon_str); } else { g_warning ("Unsupported GFileInfo object type %d\n", objtype); g_free (attr); goto out; } g_file_info_set_attribute_object (info, attr, obj); if (obj) g_object_unref (obj); break; case G_FILE_ATTRIBUTE_TYPE_INVALID: break; default: g_warning ("Unsupported GFileInfo attribute type %d\n", type); g_free (attr); goto out; break; } g_file_info_set_attribute_status (info, attr, status); g_free (attr); } out: g_object_unref (in); return info; }
static GFileInfo * g_resource_file_query_filesystem_info (GFile *file, const char *attributes, GCancellable *cancellable, GError **error) { GFileInfo *info; GFileAttributeMatcher *matcher; info = g_file_info_new (); matcher = g_file_attribute_matcher_new (attributes); if (g_file_attribute_matcher_matches (matcher, G_FILE_ATTRIBUTE_FILESYSTEM_TYPE)) g_file_info_set_attribute_string (info, G_FILE_ATTRIBUTE_FILESYSTEM_TYPE, "resource"); if (g_file_attribute_matcher_matches (matcher, G_FILE_ATTRIBUTE_FILESYSTEM_READONLY)) g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_FILESYSTEM_READONLY, TRUE); g_file_attribute_matcher_unref (matcher); return info; }
void ss__gth_catalog_write_metadata (GthCatalog *catalog, GthFileData *file_data) { if (g_value_hash_is_set (catalog->attributes, "slideshow::personalize")) { g_file_info_set_attribute_boolean (file_data->info, "slideshow::personalize", g_value_hash_get_boolean (catalog->attributes, "slideshow::personalize")); g_file_info_set_attribute_status (file_data->info, "slideshow::personalize", G_FILE_ATTRIBUTE_STATUS_SET); } if (g_value_hash_is_set (catalog->attributes, "slideshow::automatic")) { g_file_info_set_attribute_boolean (file_data->info, "slideshow::automatic", g_value_hash_get_boolean (catalog->attributes, "slideshow::automatic")); g_file_info_set_attribute_status (file_data->info, "slideshow::automatic", G_FILE_ATTRIBUTE_STATUS_SET); } if (g_value_hash_is_set (catalog->attributes, "slideshow::wrap-around")) { g_file_info_set_attribute_boolean (file_data->info, "slideshow::wrap-around", g_value_hash_get_boolean (catalog->attributes, "slideshow::wrap-around")); g_file_info_set_attribute_status (file_data->info, "slideshow::wrap-around", G_FILE_ATTRIBUTE_STATUS_SET); } if (g_value_hash_is_set (catalog->attributes, "slideshow::random-order")) { g_file_info_set_attribute_boolean (file_data->info, "slideshow::random-order", g_value_hash_get_boolean (catalog->attributes, "slideshow::random-order")); g_file_info_set_attribute_status (file_data->info, "slideshow::random-order", G_FILE_ATTRIBUTE_STATUS_SET); } if (g_value_hash_is_set (catalog->attributes, "slideshow::delay")) { g_file_info_set_attribute_int32 (file_data->info, "slideshow::delay", g_value_hash_get_int (catalog->attributes, "slideshow::delay")); g_file_info_set_attribute_status (file_data->info, "slideshow::delay", G_FILE_ATTRIBUTE_STATUS_SET); } if (g_value_hash_is_set (catalog->attributes, "slideshow::transition")) { g_file_info_set_attribute_string (file_data->info, "slideshow::transition", g_value_hash_get_string (catalog->attributes, "slideshow::transition")); g_file_info_set_attribute_status (file_data->info, "slideshow::transition", G_FILE_ATTRIBUTE_STATUS_SET); } if (g_value_hash_is_set (catalog->attributes, "slideshow::playlist")) { g_file_info_set_attribute_stringv (file_data->info, "slideshow::playlist", g_value_hash_get_stringv (catalog->attributes, "slideshow::playlist")); g_file_info_set_attribute_status (file_data->info, "slideshow::playlist", G_FILE_ATTRIBUTE_STATUS_SET); } }
/* Function implementations */ static void fl_parser_start_node_cb (void *user_data, const char *node_name, const char **attr) { ParserData *data; GFileInfo *info; data = (ParserData *) user_data; data->depth++; d(g_print ("%d: %s\n", data->depth, node_name)); if (data->depth > 2) { g_set_error (data->error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT, "Don't expect node '%s' as child of 'file', 'folder' or 'parent-folder'", node_name); return; } else if (data->depth == 1) { if (strcmp (node_name, "folder-listing") != 0) { g_set_error (data->error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT, "Expected 'folder-listing', got '%s'", node_name); return; } return; } if (strcmp (node_name, "parent-folder") == 0) { /* Just ignore parent-folder items */ return; } info = g_file_info_new (); if (strcmp (node_name, "file") == 0) { g_file_info_set_file_type (info, G_FILE_TYPE_REGULAR); } else if (strcmp (node_name, "folder") == 0) { GIcon *icon; g_file_info_set_file_type (info, G_FILE_TYPE_DIRECTORY); g_file_info_set_content_type (info, "inode/directory"); icon = g_themed_icon_new ("folder"); g_file_info_set_icon (info, icon); g_object_unref (icon); icon = g_themed_icon_new ("folder-symbolic"); g_file_info_set_symbolic_icon (info, icon); g_object_unref (icon); } else { g_set_error (data->error, G_MARKUP_ERROR, G_MARKUP_ERROR_UNKNOWN_ELEMENT, "Unknown element '%s'", node_name); return; } if (!fl_parser_fill_file_info (info, attr)) { d(g_print ("Failed to fill GnomeVFSFileInfo from node '%s'\n", node_name)); g_object_unref (info); return; } if (g_file_info_get_content_type (info) == NULL) { char *mime_type; mime_type = g_content_type_guess (g_file_info_get_name (info), NULL, 0, NULL); g_file_info_set_content_type (info, mime_type); g_free (mime_type); } if (g_file_info_get_content_type (info) == NULL) { g_file_info_set_content_type (info, "application/octet-stream"); } if (g_file_info_get_file_type (info) == G_FILE_TYPE_REGULAR) { GIcon *icon; const char *content_type; content_type = g_file_info_get_content_type (info); icon = g_content_type_get_icon (content_type); if (icon != NULL) { if (G_IS_THEMED_ICON (icon)) g_themed_icon_append_name (G_THEMED_ICON (icon), "text-x-generic"); g_file_info_set_icon (info, icon); g_object_unref (icon); } icon = g_content_type_get_symbolic_icon (content_type); if (icon != NULL) { if (G_IS_THEMED_ICON (icon)) g_themed_icon_append_name (G_THEMED_ICON (icon), "text-x-generic-symbolic"); g_file_info_set_symbolic_icon (info, icon); g_object_unref (icon); } } /* Permissions on folders in OBEX has different semantics than POSIX. * In POSIX, if a folder is not writable, it means that it's content * can't be removed, whereas in OBEX, it just means that the folder * itself can't be removed. Therefore we must set all folders to RWD and * handle the error when it happens. */ if (g_file_info_get_file_type (info) == G_FILE_TYPE_DIRECTORY) { g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_READ, TRUE); g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE, TRUE); } data->elements = g_list_prepend (data->elements, info); }
static gboolean fl_parser_fill_file_info (GFileInfo *info, const char **attr) { gint i; for (i = 0; attr[i]; ++i) { const gchar *name; const gchar *value; name = attr[i]; value = attr[++i]; if (strcmp (name, "name") == 0) { char *display_name; /* Apparently someone decided it was a good idea * to send name="" mem-type="MMC" */ if (!value || strcmp (value, "") == 0) { return FALSE; } g_file_info_set_name (info, value); display_name = g_filename_display_name (value); g_file_info_set_display_name (info, display_name); d(g_print ("Name: '%s'\n", display_name)); g_free (display_name); } else if (strcmp (name, "size") == 0) { g_file_info_set_size (info, strtoll (value, NULL, 10)); d(g_print ("Size: '%"G_GINT64_FORMAT"'\n", g_file_info_get_size (info))); } else if (strcmp (name, "modified") == 0) { GTimeVal time; if (g_time_val_from_iso8601 (value, &time) == FALSE) continue; g_file_info_set_modification_time (info, &time); d(g_print ("Modified: '%s' = '%d'\n", value, (int)time.tv_sec)); } else if (strcmp (name, "created") == 0) { GTimeVal time; if (g_time_val_from_iso8601 (value, &time) == FALSE) continue; g_file_info_set_attribute_uint64 (info, G_FILE_ATTRIBUTE_TIME_CREATED, time.tv_sec); g_file_info_set_attribute_uint32 (info, G_FILE_ATTRIBUTE_TIME_CREATED_USEC, time.tv_usec); d(g_print ("Created: '%s' = '%d'\n", value, (int)time.tv_sec)); } else if (strcmp (name, "accessed") == 0) { GTimeVal time; if (g_time_val_from_iso8601 (value, &time) == FALSE) continue; g_file_info_set_attribute_uint64 (info, G_FILE_ATTRIBUTE_TIME_ACCESS, time.tv_sec); g_file_info_set_attribute_uint32 (info, G_FILE_ATTRIBUTE_TIME_ACCESS_USEC, time.tv_usec); d(g_print ("Accessed: '%s' = '%d'\n", value, (int)time.tv_sec)); } else if (strcmp (name, "user-perm") == 0) { /* The permissions don't map well to unix semantics, * since the user is most likely not the same on both * sides. We map the user permissions to "other" on the * local side. D is treated as write, otherwise files * can't be deleted through the module, even if it * should be possible. */ if (strstr (value, "R")) { g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_READ, TRUE); } if (strstr (value, "W") || strstr (value, "D")) { g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE, TRUE); } } else if (strcmp (name, "group-perm") == 0) { /* Ignore for now */ d(g_print ("Group permissions: '%s'\n", value)); } else if (strcmp (name, "other-perm") == 0) { /* Ignore for now */ d(g_print ("Other permissions: '%s'\n", value)); } else if (strcmp (name, "owner") == 0) { /* Ignore for now */ d(g_print ("Owner: '%s'\n", value)); } else if (strcmp (name, "group") == 0) { /* Ignore for now */ d(g_print ("Group: '%s'\n", value)); } else if (strcmp (name, "type") == 0) { g_file_info_set_content_type (info, value); d(g_print ("Mime-Type: '%s'\n", value)); } else if (strcmp (name, "xml:lang") == 0) { d(g_print ("Lang: '%s'\n", value)); } else if (strcmp (name, "mem-type") == 0) { guint device; if (value == NULL || value[0] == '\0') continue; device = om_mem_type_id_from_string (value); g_file_info_set_attribute_uint32 (info, G_FILE_ATTRIBUTE_UNIX_RDEV, device); d(g_print ("Mem-Type: '%s' (%d)\n", value, device)); } else { d(g_print ("Unknown Attribute: %s = %s\n", name, value)); } } if (g_file_info_get_name (info) == NULL) { /* Required attribute */ /* Set error */ return FALSE; } return TRUE; }