[gnome-remote-desktop] settings: Move Secret schemas into a separate file



commit 596f34a4ca1db085d673a2e5303bd99f5c92387d
Author: Jonas Ådahl <jadahl gmail com>
Date:   Fri Jan 21 17:11:49 2022 +0100

    settings: Move Secret schemas into a separate file
    
    They'll be used by a command line utility, so let the settings reading
    and writing share the same Secret schema definition.

 src/grd-schemas.c  | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 src/grd-schemas.h  | 35 +++++++++++++++++++++++++++++++++++
 src/grd-settings.c | 32 ++------------------------------
 src/grd-settings.h |  5 -----
 src/meson.build    |  2 ++
 5 files changed, 93 insertions(+), 35 deletions(-)
---
diff --git a/src/grd-schemas.c b/src/grd-schemas.c
new file mode 100644
index 00000000..7c154cde
--- /dev/null
+++ b/src/grd-schemas.c
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2018-2022 Red Hat Inc.
+ * Copyright (C) 2020 Pascal Nowack
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ *
+ */
+
+#include "config.h"
+
+#include "grd-schemas.h"
+
+const SecretSchema *
+grd_rdp_credentials_get_schema (void)
+{
+  static const SecretSchema grd_rdp_credentials_schema = {
+    .name = "org.gnome.RemoteDesktop.RdpCredentials",
+    .flags = SECRET_SCHEMA_NONE,
+    .attributes = {
+      { "credentials", SECRET_SCHEMA_ATTRIBUTE_STRING },
+      { "NULL", 0 },
+    },
+  };
+
+  return &grd_rdp_credentials_schema;
+}
+
+const SecretSchema *
+grd_vnc_password_get_schema (void)
+{
+  static const SecretSchema grd_vnc_password_schema = {
+    .name = "org.gnome.RemoteDesktop.VncPassword",
+    .flags = SECRET_SCHEMA_NONE,
+    .attributes = {
+      { "password", SECRET_SCHEMA_ATTRIBUTE_STRING },
+      { "NULL", 0 },
+    },
+  };
+
+  return &grd_vnc_password_schema;
+}
diff --git a/src/grd-schemas.h b/src/grd-schemas.h
new file mode 100644
index 00000000..413a247c
--- /dev/null
+++ b/src/grd-schemas.h
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2018-2022 Red Hat Inc.
+ * Copyright (C) 2020 Pascal Nowack
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ *
+ */
+
+#ifndef GRD_SCHEMAS_H
+#define GRD_SCHEMAS_H
+
+#include <libsecret/secret.h>
+
+const SecretSchema * grd_rdp_credentials_get_schema (void);
+
+const SecretSchema * grd_vnc_password_get_schema (void);
+
+#define GRD_RDP_CREDENTIALS_SCHEMA (grd_rdp_credentials_get_schema ())
+
+#define GRD_VNC_PASSWORD_SCHEMA (grd_vnc_password_get_schema ())
+
+#endif /* GRD_SCHEMA_H */
diff --git a/src/grd-settings.c b/src/grd-settings.c
index 6d0d157f..0d23f70f 100644
--- a/src/grd-settings.c
+++ b/src/grd-settings.c
@@ -25,6 +25,8 @@
 #include <gio/gio.h>
 #include <string.h>
 
+#include "grd-schemas.h"
+
 #define GRD_RDP_SCHEMA_ID "org.gnome.desktop.remote-desktop.rdp"
 #define GRD_VNC_SCHEMA_ID "org.gnome.desktop.remote-desktop.vnc"
 #define GRD_RDP_SERVER_PORT 3389
@@ -68,36 +70,6 @@ struct _GrdSettings
 
 G_DEFINE_TYPE (GrdSettings, grd_settings, G_TYPE_OBJECT)
 
-const SecretSchema *
-grd_rdp_credentials_get_schema (void)
-{
-  static const SecretSchema grd_rdp_credentials_schema = {
-    .name = "org.gnome.RemoteDesktop.RdpCredentials",
-    .flags = SECRET_SCHEMA_NONE,
-    .attributes = {
-      { "credentials", SECRET_SCHEMA_ATTRIBUTE_STRING },
-      { "NULL", 0 },
-    },
-  };
-
-  return &grd_rdp_credentials_schema;
-}
-
-const SecretSchema *
-grd_vnc_password_get_schema (void)
-{
-  static const SecretSchema grd_vnc_password_schema = {
-    .name = "org.gnome.RemoteDesktop.VncPassword",
-    .flags = SECRET_SCHEMA_NONE,
-    .attributes = {
-      { "password", SECRET_SCHEMA_ATTRIBUTE_STRING },
-      { "NULL", 0 },
-    },
-  };
-
-  return &grd_vnc_password_schema;
-}
-
 int
 grd_settings_get_rdp_port (GrdSettings *settings)
 {
diff --git a/src/grd-settings.h b/src/grd-settings.h
index 528167fa..4ba70cbc 100644
--- a/src/grd-settings.h
+++ b/src/grd-settings.h
@@ -30,11 +30,6 @@
 G_DECLARE_FINAL_TYPE (GrdSettings, grd_settings,
                       GRD, SETTINGS, GObject)
 
-const SecretSchema * cc_grd_rdp_credentials_get_schema (void);
-const SecretSchema * cc_grd_vnc_password_get_schema (void);
-#define GRD_RDP_CREDENTIALS_SCHEMA grd_rdp_credentials_get_schema ()
-#define GRD_VNC_PASSWORD_SCHEMA grd_vnc_password_get_schema ()
-
 int grd_settings_get_rdp_port (GrdSettings *settings);
 
 int grd_settings_get_vnc_port (GrdSettings *settings);
diff --git a/src/meson.build b/src/meson.build
index f8699eaf..03e039dd 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -32,6 +32,8 @@ daemon_sources = files([
   'grd-prompt.h',
   'grd-session.c',
   'grd-session.h',
+  'grd-schemas.c',
+  'grd-schemas.h',
   'grd-settings.c',
   'grd-settings.h',
   'grd-stream.c',


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]