[tracker-miners/sam/test-removable-devices: 1/4] WIP: mock volume monitor
- From: Sam Thursfield <sthursfield src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker-miners/sam/test-removable-devices: 1/4] WIP: mock volume monitor
- Date: Tue, 17 Aug 2021 17:31:58 +0000 (UTC)
commit 913e2028647ac1cd83ef99be795943e28207f70c
Author: Sam Thursfield <sam afuera me uk>
Date: Tue Aug 17 17:28:51 2021 +0200
WIP: mock volume monitor
.../miner-removable-media/meson.build | 3 ++
.../miner-removable-media/test-volume-monitor.c | 34 ++++++++++++++++++++++
.../miner-removable-media/test-volume-monitor.h | 9 ++++++
3 files changed, 46 insertions(+)
---
diff --git a/tests/functional-tests/miner-removable-media/meson.build
b/tests/functional-tests/miner-removable-media/meson.build
new file mode 100644
index 000000000..d037d240d
--- /dev/null
+++ b/tests/functional-tests/miner-removable-media/meson.build
@@ -0,0 +1,3 @@
+shared_module('mockvolumemonitor',
+ 'test-volume-monitor.c', 'test-volume-monitor.h',
+ dependencies: [gio])
diff --git a/tests/functional-tests/miner-removable-media/test-volume-monitor.c
b/tests/functional-tests/miner-removable-media/test-volume-monitor.c
new file mode 100644
index 000000000..2cd752929
--- /dev/null
+++ b/tests/functional-tests/miner-removable-media/test-volume-monitor.c
@@ -0,0 +1,34 @@
+#include "test-volume-monitor.h"
+
+struct _TestVolumeMonitor {
+ GNativeVolumeMonitor parent;
+};
+
+G_DEFINE_TYPE (TestVolumeMonitor, test_volume_monitor, G_TYPE_NATIVE_VOLUME_MONITOR);
+
+static gboolean is_supported (void) {
+ g_debug (__func__);
+ return TRUE;
+}
+
+static void test_volume_monitor_init (TestVolumeMonitor *self) {
+}
+
+static void test_volume_monitor_class_init (TestVolumeMonitorClass *klass) {
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+ GVolumeMonitorClass *monitor_class = G_VOLUME_MONITOR_CLASS (klass);
+
+ monitor_class->is_supported = is_supported;
+}
+
+void g_io_module_load (GIOModule *module) {
+ g_debug (__func__);
+
+ g_type_module_use (G_TYPE_MODULE (module));
+ g_io_extension_point_implement (
+ G_NATIVE_VOLUME_MONITOR_EXTENSION_POINT_NAME,
+ TEST_TYPE_VOLUME_MONITOR, "mockvolumemonitor", 0);
+}
+
+void g_io_module_unload (GIOModule *module) {
+}
diff --git a/tests/functional-tests/miner-removable-media/test-volume-monitor.h
b/tests/functional-tests/miner-removable-media/test-volume-monitor.h
new file mode 100644
index 000000000..9882f8e96
--- /dev/null
+++ b/tests/functional-tests/miner-removable-media/test-volume-monitor.h
@@ -0,0 +1,9 @@
+#ifndef __TEST_VOLUME_MONITOR_H__
+#define __TEST_VOLUME_MONITOR_H__
+
+#include <gio/gio.h>
+
+#define TEST_TYPE_VOLUME_MONITOR test_volume_monitor_get_type()
+G_DECLARE_FINAL_TYPE (TestVolumeMonitor, test_volume_monitor, TEST, VOLUME_MONITOR, GNativeVolumeMonitor)
+
+#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]