[seahorse] Port SeahorseValidity to Vala.



commit 653fdbccaaa6424f40d87759063b4fa6f3c390b6
Author: Niels De Graef <nielsdegraef gmail com>
Date:   Mon Oct 2 08:15:02 2017 +0200

    Port SeahorseValidity to Vala.

 common/Makefile.am                       |    3 +-
 common/config.vapi                       |   13 -------
 common/validity.vala                     |   55 ++++++++++++++++++++++++++++++
 libseahorse/Makefile.am                  |    1 -
 libseahorse/seahorse-key-manager-store.c |    1 -
 libseahorse/seahorse-validity.c          |   55 ------------------------------
 libseahorse/seahorse-validity.h          |   41 ----------------------
 pgp/seahorse-gpgme.c                     |    2 -
 pgp/seahorse-gpgme.h                     |    2 +-
 pgp/seahorse-pgp-key.c                   |    2 -
 pgp/seahorse-pgp-key.h                   |    3 +-
 pgp/seahorse-pgp-signature.h             |    2 +-
 pgp/seahorse-pgp-uid.h                   |    3 +-
 pgp/seahorse-signer.c                    |    3 +-
 po/POTFILES.in                           |    2 +-
 15 files changed, 66 insertions(+), 122 deletions(-)
---
diff --git a/common/Makefile.am b/common/Makefile.am
index 70b165a..a2cc1e1 100644
--- a/common/Makefile.am
+++ b/common/Makefile.am
@@ -16,6 +16,7 @@ common_VALA = \
        common/registry.vala \
        common/types.vala \
        common/util.vala \
+       common/validity.vala \
        common/viewable.vala \
        $(NULL)
 
@@ -37,7 +38,7 @@ libcommon_a_CFLAGS = \
 if WITH_VALAC
 $(common_HEADER): $(common_VALA) common/config.vapi
        $(V_VALAC) $(VALAC) $(VALA_FLAGS) -C --use-header --header=$(common_HEADER) \
-               --vapidir=$(abs_srcdir)/common --pkg gtk+-3.0 --pkg gcr-3 \
+               --vapidir=$(abs_srcdir)/common --pkg gtk+-3.0 --pkg gcr-3 --pkg gcr-ui-3 \
                --vapi=common.vapi --directory=$(builddir)/common --basedir=$(dir $<) $^
 endif
 
diff --git a/common/config.vapi b/common/config.vapi
index 54e7b8b..d14caf7 100644
--- a/common/config.vapi
+++ b/common/config.vapi
@@ -59,19 +59,6 @@ public class Object : GLib.Object {
        public Object();
 }
 
-[CCode (cheader_filename = "libseahorse/seahorse-validity.h", cname = "SeahorseValidity", cprefix = 
"SEAHORSE_VALIDITY_", has_type_id = false)]
-public enum Validity {
-       REVOKED,
-       DISABLED,
-       NEVER,
-       UNKNOWN,
-       MARGINAL,
-       FULL,
-       ULTIMATE;
-
-       public string? get_string();
-}
-
 [CCode (cheader_filename = "libseahorse/seahorse-progress.h")]
 namespace Progress {
        public void show(GLib.Cancellable? cancellable, string title, bool delayed);
diff --git a/common/validity.vala b/common/validity.vala
new file mode 100644
index 0000000..83ff345
--- /dev/null
+++ b/common/validity.vala
@@ -0,0 +1,55 @@
+/*
+ * Seahorse
+ *
+ * Copyright (C) 2003 Jacob Perkins
+ * Copyright (C) 2017 Niels De Graef
+ *
+ * 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, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
+
+// [CCode (cname = "SeahorseValidity", cprefix = "SEAHORSE_VALIDITY_", has_type_id = false)]
+public enum Seahorse.Validity {
+    REVOKED   = -3,
+    DISABLED  = -2,
+    NEVER     = -1,
+    UNKNOWN   =  0,
+    MARGINAL  =  1,
+    FULL      =  5,
+    ULTIMATE  =  10;
+
+    /**
+     * @return A string describing the validity.
+     */
+    public string? get_string () {
+        switch (this) {
+            case Seahorse.Validity.UNKNOWN:
+                return C_("Validity", "Unknown");
+            case Seahorse.Validity.NEVER:
+                return C_("Validity", "Never");
+            case Seahorse.Validity.MARGINAL:
+                return C_("Validity", "Marginal");
+            case Seahorse.Validity.FULL:
+                return C_("Validity", "Full");
+            case Seahorse.Validity.ULTIMATE:
+                return C_("Validity", "Ultimate");
+            case Seahorse.Validity.DISABLED:
+                return C_("Validity", "Disabled");
+            case Seahorse.Validity.REVOKED:
+                return C_("Validity", "Revoked");
+            default:
+                return null;
+        }
+    }
+}
diff --git a/libseahorse/Makefile.am b/libseahorse/Makefile.am
index aac76d1..3ff8e9b 100644
--- a/libseahorse/Makefile.am
+++ b/libseahorse/Makefile.am
@@ -48,7 +48,6 @@ libseahorse_a_SOURCES = \
        libseahorse/seahorse-search-provider.c libseahorse/seahorse-search-provider.h \
        libseahorse/seahorse-servers.c libseahorse/seahorse-servers.h \
        libseahorse/seahorse-util.c libseahorse/seahorse-util.h \
-       libseahorse/seahorse-validity.c libseahorse/seahorse-validity.h \
        libseahorse/seahorse-widget.c libseahorse/seahorse-widget.h \
        $(dbus_shell_search_provider_built_sources) \
        $(MARSHAL_SRCS) \
diff --git a/libseahorse/seahorse-key-manager-store.c b/libseahorse/seahorse-key-manager-store.c
index 34a0837..2905baa 100644
--- a/libseahorse/seahorse-key-manager-store.c
+++ b/libseahorse/seahorse-key-manager-store.c
@@ -26,7 +26,6 @@
 
 #include "seahorse-key-manager-store.h"
 #include "seahorse-prefs.h"
-#include "seahorse-validity.h"
 #include "seahorse-util.h"
 
 #include "seahorse-common.h"
diff --git a/pgp/seahorse-gpgme.c b/pgp/seahorse-gpgme.c
index 52d2428..5467f13 100644
--- a/pgp/seahorse-gpgme.c
+++ b/pgp/seahorse-gpgme.c
@@ -26,8 +26,6 @@
 
 #include "seahorse-gpgme.h"
 
-#include "seahorse-common.h"
-
 #include "libseahorse/seahorse-util.h"
 
 #include <glib/gi18n.h>
diff --git a/pgp/seahorse-gpgme.h b/pgp/seahorse-gpgme.h
index 4c5cec8..5fe40f6 100644
--- a/pgp/seahorse-gpgme.h
+++ b/pgp/seahorse-gpgme.h
@@ -27,7 +27,7 @@
 
 #include <gpgme.h>
 
-#include "libseahorse/seahorse-validity.h"
+#include "seahorse-common.h"
 
 typedef struct _SeahorseKeyTypeTable *SeahorseKeyTypeTable;
 
diff --git a/pgp/seahorse-pgp-key.c b/pgp/seahorse-pgp-key.c
index 160dc90..2b5b03f 100644
--- a/pgp/seahorse-pgp-key.c
+++ b/pgp/seahorse-pgp-key.c
@@ -24,8 +24,6 @@
 #include "seahorse-pgp-uid.h"
 #include "seahorse-pgp-subkey.h"
 
-#include "seahorse-common.h"
-
 #include "libseahorse/seahorse-object-list.h"
 #include "libseahorse/seahorse-util.h"
 
diff --git a/pgp/seahorse-pgp-key.h b/pgp/seahorse-pgp-key.h
index edb2e13..0f2b85d 100644
--- a/pgp/seahorse-pgp-key.h
+++ b/pgp/seahorse-pgp-key.h
@@ -22,8 +22,9 @@
 
 #include <glib-object.h>
 
+#include "seahorse-common.h"
+
 #include "libseahorse/seahorse-object.h"
-#include "libseahorse/seahorse-validity.h"
 
 enum {
     SKEY_PGPSIG_TRUSTED = 0x0001,
diff --git a/pgp/seahorse-pgp-signature.h b/pgp/seahorse-pgp-signature.h
index a4d2f2f..26c20f5 100644
--- a/pgp/seahorse-pgp-signature.h
+++ b/pgp/seahorse-pgp-signature.h
@@ -22,7 +22,7 @@
 
 #include <glib-object.h>
 
-#include "libseahorse/seahorse-validity.h"
+#include "seahorse-common.h"
 
 #define SEAHORSE_TYPE_PGP_SIGNATURE            (seahorse_pgp_signature_get_type ())
 
diff --git a/pgp/seahorse-pgp-uid.h b/pgp/seahorse-pgp-uid.h
index 48c9182..90c699c 100644
--- a/pgp/seahorse-pgp-uid.h
+++ b/pgp/seahorse-pgp-uid.h
@@ -22,8 +22,9 @@
 
 #include <glib-object.h>
 
+#include "seahorse-common.h"
+
 #include "libseahorse/seahorse-object.h"
-#include "libseahorse/seahorse-validity.h"
 
 #include "seahorse-pgp-key.h"
 
diff --git a/pgp/seahorse-signer.c b/pgp/seahorse-signer.c
index b6d25e5..a4d1ab7 100755
--- a/pgp/seahorse-signer.c
+++ b/pgp/seahorse-signer.c
@@ -26,9 +26,10 @@
 #include "seahorse-pgp-key.h"
 #include "seahorse-pgp-keysets.h"
 
+#include "seahorse-common.h"
+
 #include "libseahorse/seahorse-progress.h"
 #include "libseahorse/seahorse-widget.h"
-#include "libseahorse/seahorse-validity.h"
 #include "libseahorse/seahorse-util.h"
 
 #include <glib/gi18n.h>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index c084bf0..fc1b29d 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -3,6 +3,7 @@
 common/catalog.vala
 common/exportable.vala
 common/util.vala
+common/validity.vala
 data/seahorse.appdata.xml.in
 data/seahorse.desktop.in.in
 gkr/gkr-backend.vala
@@ -28,7 +29,6 @@ libseahorse/seahorse-prefs.ui
 libseahorse/seahorse-progress.ui
 libseahorse/seahorse-search-provider.c
 libseahorse/seahorse-util.c
-libseahorse/seahorse-validity.c
 libseahorse/seahorse-widget.c
 pgp/seahorse-add-subkey.ui
 pgp/seahorse-add-uid.ui


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