mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-24 14:36:13 +01:00
Make GUnixMountEntry and GUnixMountPoint boxed types
And unskip some functions using them. https://bugzilla.gnome.org/show_bug.cgi?id=668962
This commit is contained in:
parent
7890573f6e
commit
625936343d
@ -1537,6 +1537,7 @@ GUnixMountEntry
|
||||
GUnixMountMonitor
|
||||
g_unix_mount_free
|
||||
g_unix_mount_compare
|
||||
g_unix_mount_copy
|
||||
g_unix_mount_get_mount_path
|
||||
g_unix_mount_get_device_path
|
||||
g_unix_mount_get_fs_type
|
||||
@ -1549,6 +1550,7 @@ g_unix_mount_guess_can_eject
|
||||
g_unix_mount_guess_should_display
|
||||
g_unix_mount_point_free
|
||||
g_unix_mount_point_compare
|
||||
g_unix_mount_point_copy
|
||||
g_unix_mount_point_get_mount_path
|
||||
g_unix_mount_point_get_device_path
|
||||
g_unix_mount_point_get_fs_type
|
||||
@ -1576,8 +1578,12 @@ G_IS_UNIX_MOUNT_MONITOR
|
||||
G_TYPE_UNIX_MOUNT_MONITOR
|
||||
G_UNIX_MOUNT_MONITOR_CLASS
|
||||
G_IS_UNIX_MOUNT_MONITOR_CLASS
|
||||
G_TYPE_UNIX_MOUNT_ENTRY
|
||||
G_TYPE_UNIX_MOUNT_POINT
|
||||
<SUBSECTION Private>
|
||||
g_unix_mount_monitor_get_type
|
||||
g_unix_mount_entry_get_type
|
||||
g_unix_mount_point_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
|
@ -144,7 +144,9 @@ g_unix_credentials_message_get_type
|
||||
g_unix_fd_list_get_type
|
||||
g_unix_fd_message_get_type
|
||||
g_unix_input_stream_get_type
|
||||
g_unix_mount_entry_get_type
|
||||
g_unix_mount_monitor_get_type
|
||||
g_unix_mount_point_get_type
|
||||
g_unix_output_stream_get_type
|
||||
g_unix_socket_address_get_type
|
||||
g_vfs_get_type
|
||||
|
@ -130,6 +130,9 @@ struct _GUnixMountEntry {
|
||||
gboolean is_system_internal;
|
||||
};
|
||||
|
||||
G_DEFINE_BOXED_TYPE (GUnixMountEntry, g_unix_mount_entry,
|
||||
g_unix_mount_copy, g_unix_mount_free)
|
||||
|
||||
struct _GUnixMountPoint {
|
||||
char *mount_path;
|
||||
char *device_path;
|
||||
@ -140,6 +143,9 @@ struct _GUnixMountPoint {
|
||||
gboolean is_loopback;
|
||||
};
|
||||
|
||||
G_DEFINE_BOXED_TYPE (GUnixMountPoint, g_unix_mount_point,
|
||||
g_unix_mount_point_copy, g_unix_mount_point_free)
|
||||
|
||||
static GList *_g_get_unix_mounts (void);
|
||||
static GList *_g_get_unix_mount_points (void);
|
||||
|
||||
@ -1389,7 +1395,7 @@ get_mount_points_timestamp (void)
|
||||
}
|
||||
|
||||
/**
|
||||
* g_unix_mounts_get: (skip)
|
||||
* g_unix_mounts_get:
|
||||
* @time_read: (out) (optional): guint64 to contain a timestamp, or %NULL
|
||||
*
|
||||
* Gets a #GList of #GUnixMountEntry containing the unix mounts.
|
||||
@ -1410,8 +1416,8 @@ g_unix_mounts_get (guint64 *time_read)
|
||||
}
|
||||
|
||||
/**
|
||||
* g_unix_mount_at: (skip)
|
||||
* @mount_path: path for a possible unix mount.
|
||||
* g_unix_mount_at:
|
||||
* @mount_path: (type filename): path for a possible unix mount.
|
||||
* @time_read: (out) (optional): guint64 to contain a timestamp.
|
||||
*
|
||||
* Gets a #GUnixMountEntry for a given mount path. If @time_read
|
||||
@ -1445,8 +1451,8 @@ g_unix_mount_at (const char *mount_path,
|
||||
}
|
||||
|
||||
/**
|
||||
* g_unix_mount_for: (skip)
|
||||
* @file_path: file path on some unix mount.
|
||||
* g_unix_mount_for:
|
||||
* @file_path: (type filename): file path on some unix mount.
|
||||
* @time_read: (out) (optional): guint64 to contain a timestamp.
|
||||
*
|
||||
* Gets a #GUnixMountEntry for a given file path. If @time_read
|
||||
@ -1482,7 +1488,7 @@ g_unix_mount_for (const char *file_path,
|
||||
}
|
||||
|
||||
/**
|
||||
* g_unix_mount_points_get: (skip)
|
||||
* g_unix_mount_points_get:
|
||||
* @time_read: (out) (optional): guint64 to contain a timestamp.
|
||||
*
|
||||
* Gets a #GList of #GUnixMountPoint containing the unix mount points.
|
||||
@ -1864,6 +1870,33 @@ g_unix_mount_free (GUnixMountEntry *mount_entry)
|
||||
g_free (mount_entry);
|
||||
}
|
||||
|
||||
/**
|
||||
* g_unix_mount_copy:
|
||||
* @mount_entry: a #GUnixMountEntry.
|
||||
*
|
||||
* Makes a copy of @mount_entry.
|
||||
*
|
||||
* Returns: (transfer full): a new #GUnixMountEntry
|
||||
*
|
||||
* Since: 2.54
|
||||
*/
|
||||
GUnixMountEntry *
|
||||
g_unix_mount_copy (GUnixMountEntry *mount_entry)
|
||||
{
|
||||
GUnixMountEntry *copy;
|
||||
|
||||
g_return_val_if_fail (mount_entry != NULL, NULL);
|
||||
|
||||
copy = g_new0 (GUnixMountEntry, 1);
|
||||
copy->mount_path = g_strdup (mount_entry->mount_path);
|
||||
copy->device_path = g_strdup (mount_entry->device_path);
|
||||
copy->filesystem_type = g_strdup (mount_entry->filesystem_type);
|
||||
copy->is_read_only = mount_entry->is_read_only;
|
||||
copy->is_system_internal = mount_entry->is_system_internal;
|
||||
|
||||
return copy;
|
||||
}
|
||||
|
||||
/**
|
||||
* g_unix_mount_point_free:
|
||||
* @mount_point: unix mount point to free.
|
||||
@ -1882,6 +1915,35 @@ g_unix_mount_point_free (GUnixMountPoint *mount_point)
|
||||
g_free (mount_point);
|
||||
}
|
||||
|
||||
/**
|
||||
* g_unix_mount_point_copy:
|
||||
* @mount_point: a #GUnixMountPoint.
|
||||
*
|
||||
* Makes a copy of @mount_point.
|
||||
*
|
||||
* Returns: (transfer full): a new #GUnixMountPoint
|
||||
*
|
||||
* Since: 2.54
|
||||
*/
|
||||
GUnixMountPoint*
|
||||
g_unix_mount_point_copy (GUnixMountPoint *mount_point)
|
||||
{
|
||||
GUnixMountPoint *copy;
|
||||
|
||||
g_return_val_if_fail (mount_point != NULL, NULL);
|
||||
|
||||
copy = g_new0 (GUnixMountPoint, 1);
|
||||
copy->mount_path = g_strdup (mount_point->mount_path);
|
||||
copy->device_path = g_strdup (mount_point->device_path);
|
||||
copy->filesystem_type = g_strdup (mount_point->filesystem_type);
|
||||
copy->options = g_strdup (mount_point->options);
|
||||
copy->is_read_only = mount_point->is_read_only;
|
||||
copy->is_user_mountable = mount_point->is_user_mountable;
|
||||
copy->is_loopback = mount_point->is_loopback;
|
||||
|
||||
return copy;
|
||||
}
|
||||
|
||||
/**
|
||||
* g_unix_mount_compare:
|
||||
* @mount1: first #GUnixMountEntry to compare.
|
||||
|
@ -33,6 +33,10 @@ G_BEGIN_DECLS
|
||||
**/
|
||||
typedef struct _GUnixMountEntry GUnixMountEntry;
|
||||
|
||||
#define G_TYPE_UNIX_MOUNT_ENTRY (g_unix_mount_entry_get_type ())
|
||||
GLIB_AVAILABLE_IN_2_54
|
||||
GType g_unix_mount_entry_get_type (void) G_GNUC_CONST;
|
||||
|
||||
/**
|
||||
* GUnixMountPoint:
|
||||
*
|
||||
@ -41,6 +45,10 @@ typedef struct _GUnixMountEntry GUnixMountEntry;
|
||||
**/
|
||||
typedef struct _GUnixMountPoint GUnixMountPoint;
|
||||
|
||||
#define G_TYPE_UNIX_MOUNT_POINT (g_unix_mount_point_get_type ())
|
||||
GLIB_AVAILABLE_IN_2_54
|
||||
GType g_unix_mount_point_get_type (void) G_GNUC_CONST;
|
||||
|
||||
/**
|
||||
* GUnixMountMonitor:
|
||||
*
|
||||
@ -58,8 +66,12 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(GUnixMountMonitor, g_object_unref)
|
||||
|
||||
GLIB_AVAILABLE_IN_ALL
|
||||
void g_unix_mount_free (GUnixMountEntry *mount_entry);
|
||||
GLIB_AVAILABLE_IN_2_54
|
||||
GUnixMountEntry *g_unix_mount_copy (GUnixMountEntry *mount_entry);
|
||||
GLIB_AVAILABLE_IN_ALL
|
||||
void g_unix_mount_point_free (GUnixMountPoint *mount_point);
|
||||
GLIB_AVAILABLE_IN_2_54
|
||||
GUnixMountPoint *g_unix_mount_point_copy (GUnixMountPoint *mount_point);
|
||||
GLIB_AVAILABLE_IN_ALL
|
||||
gint g_unix_mount_compare (GUnixMountEntry *mount1,
|
||||
GUnixMountEntry *mount2);
|
||||
|
Loading…
Reference in New Issue
Block a user