[glib] Make GUnixMountEntry and GUnixMountPoint boxed types
- From: Christoph Reiter <creiter src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] Make GUnixMountEntry and GUnixMountPoint boxed types
- Date: Tue, 28 Mar 2017 16:07:10 +0000 (UTC)
commit 625936343d9009ad54d1de6d9084a017c0bf689b
Author: Christoph Reiter <reiter christoph gmail com>
Date: Thu Mar 23 12:46:56 2017 +0100
Make GUnixMountEntry and GUnixMountPoint boxed types
And unskip some functions using them.
https://bugzilla.gnome.org/show_bug.cgi?id=668962
docs/reference/gio/gio-sections.txt | 6 +++
docs/reference/gio/gio.types | 2 +
gio/gunixmounts.c | 74 ++++++++++++++++++++++++++++++++---
gio/gunixmounts.h | 12 ++++++
4 files changed, 88 insertions(+), 6 deletions(-)
---
diff --git a/docs/reference/gio/gio-sections.txt b/docs/reference/gio/gio-sections.txt
index dddb1d8..c21d71e 100644
--- a/docs/reference/gio/gio-sections.txt
+++ b/docs/reference/gio/gio-sections.txt
@@ -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>
diff --git a/docs/reference/gio/gio.types b/docs/reference/gio/gio.types
index fdb7a8d..8ab7d91 100644
--- a/docs/reference/gio/gio.types
+++ b/docs/reference/gio/gio.types
@@ -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
diff --git a/gio/gunixmounts.c b/gio/gunixmounts.c
index 0c73a56..b2e720b 100644
--- a/gio/gunixmounts.c
+++ b/gio/gunixmounts.c
@@ -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.
@@ -1865,6 +1871,33 @@ g_unix_mount_free (GUnixMountEntry *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.
*
@@ -1883,6 +1916,35 @@ g_unix_mount_point_free (GUnixMountPoint *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.
* @mount2: second #GUnixMountEntry to compare.
diff --git a/gio/gunixmounts.h b/gio/gunixmounts.h
index 90b9f03..bce464a 100644
--- a/gio/gunixmounts.h
+++ b/gio/gunixmounts.h
@@ -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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]