[gnome-flashback] backends: add gf_verify_monitor_spec
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-flashback] backends: add gf_verify_monitor_spec
- Date: Thu, 21 Sep 2017 00:08:14 +0000 (UTC)
commit 41cfccef578a3d60bdaacd984d69ea1e9ce7b116
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Wed Sep 20 17:54:48 2017 +0300
backends: add gf_verify_monitor_spec
backends/gf-monitor-spec-private.h | 15 +++++++++------
backends/gf-monitor-spec.c | 21 +++++++++++++++++++++
2 files changed, 30 insertions(+), 6 deletions(-)
---
diff --git a/backends/gf-monitor-spec-private.h b/backends/gf-monitor-spec-private.h
index 5c02a43..7dd1dd4 100644
--- a/backends/gf-monitor-spec-private.h
+++ b/backends/gf-monitor-spec-private.h
@@ -34,15 +34,18 @@ struct _GfMonitorSpec
gchar *serial;
};
-GfMonitorSpec *gf_monitor_spec_clone (GfMonitorSpec *spec);
+GfMonitorSpec *gf_monitor_spec_clone (GfMonitorSpec *spec);
-gboolean gf_monitor_spec_equals (GfMonitorSpec *spec,
- GfMonitorSpec *other_spec);
+gboolean gf_monitor_spec_equals (GfMonitorSpec *spec,
+ GfMonitorSpec *other_spec);
-gint gf_monitor_spec_compare (GfMonitorSpec *spec_a,
- GfMonitorSpec *spec_b);
+gint gf_monitor_spec_compare (GfMonitorSpec *spec_a,
+ GfMonitorSpec *spec_b);
-void gf_monitor_spec_free (GfMonitorSpec *spec);
+void gf_monitor_spec_free (GfMonitorSpec *spec);
+
+gboolean gf_verify_monitor_spec (GfMonitorSpec *spec,
+ GError **error);
G_END_DECLS
diff --git a/backends/gf-monitor-spec.c b/backends/gf-monitor-spec.c
index 33be477..41e3f51 100644
--- a/backends/gf-monitor-spec.c
+++ b/backends/gf-monitor-spec.c
@@ -21,6 +21,7 @@
#include "config.h"
+#include <gio/gio.h>
#include <string.h>
#include "gf-monitor-spec-private.h"
@@ -80,3 +81,23 @@ gf_monitor_spec_free (GfMonitorSpec *spec)
g_free (spec->serial);
g_free (spec);
}
+
+gboolean
+gf_verify_monitor_spec (GfMonitorSpec *spec,
+ GError **error)
+{
+ if (spec->connector &&
+ spec->vendor &&
+ spec->product &&
+ spec->serial)
+ {
+ return TRUE;
+ }
+ else
+ {
+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+ "Monitor spec incomplete");
+
+ return FALSE;
+ }
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]