[rs-commit] r32 - in /redwax-signtext/trunk/src/linux: ./ AUTHORS COPYING ChangeLog INSTALL Makefile.am NEWS README config.h.in configure.ac crypto.c crypto.h main.c message.c message.h po/ po/Makefile.in.in po/POTFILES.in signtext.c signtext.h
rs-commit at redwax.eu
rs-commit at redwax.eu
Sat Sep 3 13:56:02 CEST 2022
Author: minfrin at redwax.eu
Date: Sat Sep 3 13:56:01 2022
New Revision: 32
Log:
Initial add of the linux redwax-signtext-native.
Added:
redwax-signtext/trunk/src/linux/ (with props)
redwax-signtext/trunk/src/linux/AUTHORS
redwax-signtext/trunk/src/linux/COPYING
redwax-signtext/trunk/src/linux/ChangeLog
redwax-signtext/trunk/src/linux/INSTALL (with props)
redwax-signtext/trunk/src/linux/Makefile.am
redwax-signtext/trunk/src/linux/NEWS
redwax-signtext/trunk/src/linux/README
redwax-signtext/trunk/src/linux/config.h.in
redwax-signtext/trunk/src/linux/configure.ac
redwax-signtext/trunk/src/linux/crypto.c
redwax-signtext/trunk/src/linux/crypto.h
redwax-signtext/trunk/src/linux/main.c
redwax-signtext/trunk/src/linux/message.c
redwax-signtext/trunk/src/linux/message.h
redwax-signtext/trunk/src/linux/po/ (with props)
redwax-signtext/trunk/src/linux/po/Makefile.in.in (with props)
redwax-signtext/trunk/src/linux/po/POTFILES.in
redwax-signtext/trunk/src/linux/signtext.c
redwax-signtext/trunk/src/linux/signtext.h
Propchange: redwax-signtext/trunk/src/linux/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Sep 3 13:56:01 2022
@@ -0,0 +1,24 @@
+.deps
+aclocal.m4
+compile
+config.guess
+config.log
+config.h
+config.sub
+configure
+depcomp
+install-sh
+libtool
+ltmain.sh
+Makefile
+Makefile.in
+missing
+redwax-signtext-native
+.project
+.cproject
+*.slo
+*.spec
+config.status
+autom4te.cache
+stamp-h1
+
Added: redwax-signtext/trunk/src/linux/AUTHORS
==============================================================================
--- redwax-signtext/trunk/src/linux/AUTHORS (added)
+++ redwax-signtext/trunk/src/linux/AUTHORS Sat Sep 3 13:56:01 2022
@@ -0,0 +1,26 @@
+(C) 2017-2020 Stichting The Commons Conservancy
+
+In order to clarify the intellectual property license granted with
+Contributions from any person or entity, the Redwax project
+must have a Contributor License Agreement ("CLA") with those that
+contribute to it (or, for bulk contributions a grant document).
+
+The Individual Contributor License Agreement ("Agreement") V2.0 (iCLA)
+can be found at https://redwax.eu/licenses/icla.txt.
+
+This file contains a list of persons or entities that RedWax has
+such an agreement. When contributing directly to Redwax you well
+be asked to add your details to this file in your very first commit
+to confirm and document your acceptance of the terms of the iCAL.
+
+This code predates the foundation of the RedWax project and was
+originally written by Graham Leggett <minfrin at redwax.eu> and
+donated August 2019 to the Redwax project (through an IP assignment
+declaration to the Stichting The Commons Conservancy).
+
+Contributor:
+
+2017-09-23 Graham Leggett <minfrin at redwax.eu>
+2019-11-29 Dirk-Willem van Gulik <dirkx at redwax.eu>
+
+
Added: redwax-signtext/trunk/src/linux/COPYING
==============================================================================
--- redwax-signtext/trunk/src/linux/COPYING (added)
+++ redwax-signtext/trunk/src/linux/COPYING Sat Sep 3 13:56:01 2022
@@ -0,0 +1,178 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+
Added: redwax-signtext/trunk/src/linux/ChangeLog
==============================================================================
(empty)
Added: redwax-signtext/trunk/src/linux/INSTALL
==============================================================================
--- redwax-signtext/trunk/src/linux/INSTALL (added)
+++ redwax-signtext/trunk/src/linux/INSTALL Sat Sep 3 13:56:01 2022
@@ -0,0 +1 @@
+link /usr/share/automake-1.16/INSTALL
Propchange: redwax-signtext/trunk/src/linux/INSTALL
------------------------------------------------------------------------------
svn:special = *
Added: redwax-signtext/trunk/src/linux/Makefile.am
==============================================================================
--- redwax-signtext/trunk/src/linux/Makefile.am (added)
+++ redwax-signtext/trunk/src/linux/Makefile.am Sat Sep 3 13:56:01 2022
@@ -0,0 +1,33 @@
+
+bin_PROGRAMS = redwax-signtext-native
+
+redwax_signtext_native_SOURCES = signtext.h signtext.c crypto.h crypto.c main.c message.c message.h
+
+redwax_signtext_native_CPPFLAGS = \
+ -I$(top_srcdir) \
+ -DG_LOG_DOMAIN=\"RedwaxSignText\" \
+ -DDATADIR=\""$(pkgdatadir)"\" \
+ -DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
+ $(DISABLE_DEPRECATED) \
+ $(AM_CPPFLAGS)
+
+redwax_signtext_native_CFLAGS = \
+ $(GTK3_CFLAGS) \
+ $(GTK4_CFLAGS) \
+ $(JSON_GLIB_CFLAGS) \
+ $(GCK1_CFLAGS) \
+ $(GCR3_CFLAGS) \
+ $(WARN_CFLAGS) \
+ $(AM_CFLAGS)
+
+redwax_signtext_native_LDFLAGS = \
+ $(AM_LDFLAGS)
+
+redwax_signtext_native_LDADD = \
+ $(GTK3_LIBS) \
+ $(GTK4_LIBS) \
+ $(JSON_GLIB_LIBS) \
+ $(GCK1_LIBS) \
+ $(GCR3_LIBS) \
+ $(INTLLIBS)
+
Added: redwax-signtext/trunk/src/linux/NEWS
==============================================================================
(empty)
Added: redwax-signtext/trunk/src/linux/README
==============================================================================
(empty)
Added: redwax-signtext/trunk/src/linux/config.h.in
==============================================================================
--- redwax-signtext/trunk/src/linux/config.h.in (added)
+++ redwax-signtext/trunk/src/linux/config.h.in Sat Sep 3 13:56:01 2022
@@ -0,0 +1,70 @@
+/* config.h.in. Generated from configure.ac by autoheader. */
+
+/* Define to the gettext package name. */
+#undef GETTEXT_PACKAGE
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#undef HAVE_DLFCN_H
+
+/* Define to 1 if you have the `gtk_box_append' function. */
+#undef HAVE_GTK_BOX_APPEND
+
+/* Define to 1 if you have the `gtk_window_set_child' function. */
+#undef HAVE_GTK_WINDOW_SET_CHILD
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define to the sub-directory where libtool stores uninstalled libraries. */
+#undef LT_OBJDIR
+
+/* Name of package */
+#undef PACKAGE
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the home page for this package. */
+#undef PACKAGE_URL
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Version number of package */
+#undef VERSION
Added: redwax-signtext/trunk/src/linux/configure.ac
==============================================================================
--- redwax-signtext/trunk/src/linux/configure.ac (added)
+++ redwax-signtext/trunk/src/linux/configure.ac Sat Sep 3 13:56:01 2022
@@ -0,0 +1,33 @@
+
+AC_INIT([redwax-signtext], [0.9.0], [rst at redwax.eu])
+AM_INIT_AUTOMAKE([1.10 foreign dist-bzip2 no-dist-gzip])
+LT_PREREQ([2.2.6])
+LT_INIT
+
+AC_PROG_CC
+
+PKG_CHECK_MODULES([GTK3],
+ [gtk+-3.0 >= 3])
+#PKG_CHECK_MODULES([GTK4],
+# [gtk4 >= 4.4])
+
+PKG_CHECK_MODULES([JSON_GLIB],
+ [json-glib-1.0 >= 1.4.2])
+
+PKG_CHECK_MODULES([GCK1],
+ [gck-1 >= 3])
+
+PKG_CHECK_MODULES([GCR3],
+ [gcr-3 >= 3])
+
+AC_CHECK_FUNCS([gtk_box_append gtk_window_set_child])
+
+IT_PROG_INTLTOOL([0.40.0])
+
+AC_SUBST([GETTEXT_PACKAGE], [redwax-signtext])
+AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], "$GETTEXT_PACKAGE", [Define to the gettext package name.])
+
+AC_CONFIG_HEADERS([config.h])
+AC_CONFIG_FILES([Makefile po/Makefile.in])
+AC_OUTPUT
+
Added: redwax-signtext/trunk/src/linux/crypto.c
==============================================================================
--- redwax-signtext/trunk/src/linux/crypto.c (added)
+++ redwax-signtext/trunk/src/linux/crypto.c Sat Sep 3 13:56:01 2022
@@ -0,0 +1,184 @@
+/* Licensed to Stichting The Commons Conservancy (TCC) under one or more
+ * contributor license agreements. See the AUTHORS file distributed with
+ * this work for additional information regarding copyright ownership.
+ * TCC licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+
+#include "crypto.h"
+
+#if 0
+static void
+crypto_slot_done (GObject *source_object,
+ GAsyncResult *res,
+ gpointer user_data)
+{
+ SignTextData *signtext = user_data;
+ GckSession *session;
+ GError *gerror = NULL;
+
+ g_printerr("crypto_init_done\n");
+
+// session = gck_slot_open_session_async(res, &gerror);
+
+ if (!session) {
+ goto fatal;
+ }
+ else {
+
+// signtext->slots = gck_modules_get_slots(signtext->modules, FALSE);
+
+ }
+
+ if (gerror) {
+fatal:
+
+ GtkWidget* dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL,
+ GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
+ "%s", ("Redwax SignText - Error"));
+ gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+ ("Error: %s"),
+ gerror->message);
+
+ g_error_free (gerror);
+
+ gtk_widget_show (dialog);
+
+ }
+}
+
+static void
+crypto_slot_init (gpointer data, gpointer user_data)
+{
+ GckSlot *slot = data;
+ SignTextData *signtext = user_data;
+
+ g_printerr("crypto_slot_init\n");
+
+// gck_slot_open_session_async(slot, GCK_SESSION_READ_ONLY, signtext->cancellable, (GAsyncReadyCallback)crypto_slot_done, signtext);
+
+
+}
+#endif
+
+static void
+crypto_certs_done (GObject *source_object,
+ GAsyncResult *res,
+ gpointer user_data)
+{
+ SignTextData *signtext = user_data;
+ GList *incoming, *current, *l;
+ GError *gerror = NULL;
+
+ g_printerr("crypto_certs_done\n");
+
+ current = gcr_collection_get_objects(signtext->certificates);
+
+ incoming = gck_enumerator_next_finish(GCK_ENUMERATOR(source_object), res, &gerror);
+
+ for (l = current; l; l = g_list_next (l)) {
+ if (!g_list_find(incoming, l->data)) {
+ gcr_simple_collection_remove(GCR_SIMPLE_COLLECTION(signtext->certificates), l->data);
+ g_object_unref(l->data);
+ }
+ }
+
+ for (l = incoming; l; l = g_list_next (l)) {
+ if (!g_list_find(current, l->data)) {
+ g_object_ref(l->data);
+ gcr_simple_collection_add(GCR_SIMPLE_COLLECTION(signtext->certificates), l->data);
+ }
+ }
+
+ gck_list_unref_free(incoming);
+
+}
+
+static void
+crypto_init_done (GObject *source_object,
+ GAsyncResult *res,
+ gpointer user_data)
+{
+ SignTextData *signtext = user_data;
+ GError *gerror = NULL;
+
+ g_printerr("crypto_init_done\n");
+
+ signtext->modules = gck_modules_initialize_registered_finish(res, &gerror);
+
+ if (!g_list_length(signtext->modules)) {
+ gerror = g_error_new(RST_CORE_ERROR, RST_CORE_ERROR_NO_MODULES, "No PKCS11 modules are available on this system. Text cannot be signed.");
+ goto fatal;
+ }
+ else {
+
+ /*
+ * The minumum you must request to get a certificate back that will display in a dropdown
+ * is CKA_VALUE, CKA_CLASS, CKA_CERTIFICATE_TYPE. Any less than that and you get nothing.
+ *
+ * CKA_CERTIFICATE_CATEGORY tells us if the certificate is a user certificate, or an
+ * intermediate/root.
+ */
+ static const gulong CERTIFICATE_ATTRS[] = {CKA_VALUE, CKA_ID, CKA_LABEL, CKA_CLASS, CKA_CERTIFICATE_TYPE, CKA_CERTIFICATE_CATEGORY, CKA_MODIFIABLE};
+
+ GckEnumerator *cenum;
+
+ GckBuilder builder = GCK_BUILDER_INIT;
+
+ /*
+ * Search for all certificates on a token (ie not in a session).
+ */
+ gck_builder_add_boolean (&builder, CKA_TOKEN, TRUE);
+ gck_builder_add_ulong(&builder, CKA_CLASS, CKO_CERTIFICATE);
+
+ cenum = gck_modules_enumerate_objects(signtext->modules, gck_builder_end (&builder), GCK_SESSION_READ_ONLY);
+
+ gck_enumerator_set_object_type_full(cenum, GCR_TYPE_PKCS11_CERTIFICATE, CERTIFICATE_ATTRS, G_N_ELEMENTS (CERTIFICATE_ATTRS));
+
+ gck_enumerator_next_async(cenum, -1, signtext->cancellable, crypto_certs_done, signtext);
+
+// signtext->slots = gck_modules_get_slots(signtext->modules, FALSE);
+
+// g_list_foreach(signtext->slots, crypto_slot_init, signtext);
+
+// gck_slots_enumerate_objects(signtext->slots, gck_builder_end (&builder), GCK_SESSION_READ_ONLY);
+ }
+
+ if (gerror) {
+fatal:
+
+ GtkWidget* dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL,
+ GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
+ "%s", ("Redwax SignText - Error"));
+ gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+ ("Error: %s"),
+ gerror->message);
+
+ g_error_free (gerror);
+
+ gtk_widget_show (dialog);
+
+ }
+}
+
+
+void
+crypto_start(SignTextData *signtext)
+{
+ g_printerr("crypto_start\n");
+
+ gck_modules_initialize_registered_async(signtext->cancellable, (GAsyncReadyCallback)crypto_init_done, signtext);
+}
+
+
Added: redwax-signtext/trunk/src/linux/crypto.h
==============================================================================
--- redwax-signtext/trunk/src/linux/crypto.h (added)
+++ redwax-signtext/trunk/src/linux/crypto.h Sat Sep 3 13:56:01 2022
@@ -0,0 +1,30 @@
+/* Licensed to Stichting The Commons Conservancy (TCC) under one or more
+ * contributor license agreements. See the AUTHORS file distributed with
+ * this work for additional information regarding copyright ownership.
+ * TCC licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include <gtk/gtk.h>
+
+#include "signtext.h"
+
+#ifndef CRYPTO_H
+#define CRYPTO_H
+
+void
+crypto_start(SignTextData *signtext);
+
+#endif
+
+
Added: redwax-signtext/trunk/src/linux/main.c
==============================================================================
--- redwax-signtext/trunk/src/linux/main.c (added)
+++ redwax-signtext/trunk/src/linux/main.c Sat Sep 3 13:56:01 2022
@@ -0,0 +1,135 @@
+/* Licensed to Stichting The Commons Conservancy (TCC) under one or more
+ * contributor license agreements. See the AUTHORS file distributed with
+ * this work for additional information regarding copyright ownership.
+ * TCC licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+
+#include <gtk/gtk.h>
+#include <gio/gunixinputstream.h>
+#include <gio/gunixoutputstream.h>
+#include <json-glib/json-glib.h>
+
+#include "signtext.h"
+#include "crypto.h"
+#include "message.h"
+
+/*
+ * The activate signal is fired at the end of the command line handler. At this
+ * point we set ourselves up with our windows, and we trigger the first task to
+ * read a single message from stdin.
+ */
+static void
+activate (GtkApplication *app,
+ gpointer user_data)
+{
+ SignTextData *signtext = user_data;
+
+ g_printerr ("activate\n");
+
+ signtext->cancellable = g_cancellable_new();
+
+ signtext->certificates = gcr_simple_collection_new();
+
+ signtext->stack = GTK_STACK(gtk_stack_new ());
+ gtk_widget_show (GTK_WIDGET(signtext->stack));
+
+ signtext->switcher = GTK_STACK_SWITCHER(gtk_stack_switcher_new ());
+ gtk_stack_switcher_set_stack (signtext->switcher, signtext->stack);
+ gtk_widget_show (GTK_WIDGET(signtext->switcher));
+
+ signtext->box = GTK_BOX(gtk_box_new(GTK_ORIENTATION_VERTICAL, 6));
+#ifdef HAVE_GTK_BOX_APPEND
+ gtk_box_append (signtext->box, GTK_WIDGET(signtext->switcher));
+ gtk_box_append (signtext->box, GTK_WIDGET(signtext->stack));
+#else
+ gtk_box_pack_start (signtext->box, GTK_WIDGET(signtext->switcher), FALSE, FALSE, 0);
+ gtk_box_pack_start (signtext->box, GTK_WIDGET(signtext->stack), TRUE, TRUE, 0);
+#endif
+ gtk_widget_show (GTK_WIDGET(signtext->box));
+
+ signtext->window = gtk_application_window_new (app);
+ gtk_window_set_title (GTK_WINDOW (signtext->window), "Redwax SignText");
+// gtk_window_set_default_size (GTK_WINDOW (signtext->window), 200, 200);
+#ifdef HAVE_GTK_WINDOW_SET_CHILD
+ gtk_window_set_child (GTK_WINDOW(signtext->window), GTK_WIDGET(signtext->box));
+#else
+ gtk_container_add(GTK_CONTAINER(signtext->window), GTK_WIDGET(signtext->box));
+#endif
+
+// gtk_widget_show (GTK_WIDGET(signtext->window));
+ gtk_widget_show_all(GTK_WIDGET(signtext->window));
+
+ /* go fetch our smartcards */
+ crypto_start(signtext);
+
+ /* go fetch our first instruction from stdin */
+ message_receive(signtext);
+
+}
+
+/*
+ * The command line signal is fired first, and we process the command line options
+ * ourselves because we're not a typical app that opens files.
+ */
+static gint
+command_line (
+ GApplication *app,
+ GApplicationCommandLine* cmdline,
+ gpointer user_data
+)
+{
+ gchar **argv;
+ gint argc;
+ gint i;
+
+ g_printerr ("command_line\n");
+
+// g_application_hold(app);
+
+ argv = g_application_command_line_get_arguments (cmdline, &argc);
+
+ for (i = 0; i < argc; i++) {
+ g_printerr ("argument %d: %s\n", i, argv[i]);
+ }
+
+ g_strfreev (argv);
+
+// g_application_command_line_set_exit_status (cmdline, 0);
+
+ /* fire off the activation */
+ g_application_activate(app);
+
+ return 0;
+}
+
+int main (int argc, char **argv)
+{
+ GtkApplication *app;
+ int status;
+
+ SignTextData *signtext = g_new (SignTextData, 1);
+
+ app = gtk_application_new("eu.redwax.signtext", G_APPLICATION_NON_UNIQUE | G_APPLICATION_HANDLES_COMMAND_LINE);
+
+ g_signal_connect(app, "activate", G_CALLBACK (activate), signtext);
+ g_signal_connect(app, "command-line", G_CALLBACK (command_line), signtext);
+ status = g_application_run(G_APPLICATION (app), argc, argv);
+ g_object_unref(app);
+
+ g_free(signtext);
+
+ return status;
+}
+
Added: redwax-signtext/trunk/src/linux/message.c
==============================================================================
--- redwax-signtext/trunk/src/linux/message.c (added)
+++ redwax-signtext/trunk/src/linux/message.c Sat Sep 3 13:56:01 2022
@@ -0,0 +1,403 @@
+/* Licensed to Stichting The Commons Conservancy (TCC) under one or more
+ * contributor license agreements. See the AUTHORS file distributed with
+ * this work for additional information regarding copyright ownership.
+ * TCC licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include <gtk/gtk.h>
+#include <gtk/gtkdialog.h>
+#include <gio/gunixinputstream.h>
+#include <gio/gunixoutputstream.h>
+#include <json-glib/json-glib.h>
+
+#include "signtext.h"
+#include "message.h"
+#include "config.h"
+
+/*
+ * After receiving a parsed JSON message read from stdin, we end up here in the main UI
+ * thread.
+ *
+ * Parse the message, and create or update the UI pages in the stacks for each message we
+ * receive.
+ */
+static void
+message_receive_done (GObject *source_object,
+ GAsyncResult *res,
+ gpointer user_data)
+{
+ SignTextData *signtext = user_data;
+ SignTextInstance *instance;
+ GError *gerror = NULL;
+ JsonParser *parser = NULL;
+
+ g_printerr("message_receive_done\n");
+
+ parser = g_task_propagate_pointer (G_TASK (res), &gerror);
+
+ if (parser) {
+
+ GUri *uri;
+ JsonObject *message;
+ JsonNode *request;
+ const gchar *url, *uuid;
+ gint64 id;
+
+ /* parse the message */
+ JsonNode *root = json_parser_get_root (parser);
+ json_node_seal(root);
+
+ message = json_node_get_object(root);
+ if (!message) {
+ gerror = g_error_new(RST_CORE_ERROR, RST_CORE_ERROR_MISSING_ROOT, "JSON payload was empty.");
+ goto fatal;
+ }
+
+ url = json_object_get_string_member(message, "url");
+ if (!url) {
+ gerror = g_error_new(RST_CORE_ERROR, RST_CORE_ERROR_MISSING_URL, "JSON payload has missing 'url'.");
+ goto fatal;
+ }
+
+ uri = g_uri_parse(url, G_URI_FLAGS_NONE, &gerror);
+ if (!uri) {
+ gerror = g_error_new(RST_CORE_ERROR, RST_CORE_ERROR_URL_INVALID, "JSON payload has invalid 'url'.");
+ goto fatal;
+ }
+
+ uuid = json_object_get_string_member(message, "uuid");
+ if (!uuid) {
+ gerror = g_error_new(RST_CORE_ERROR, RST_CORE_ERROR_MISSING_UUID, "JSON payload has missing 'uuid'.");
+ goto fatal;
+ }
+
+ id = json_object_get_int_member(message, "id");
+ if (!id) {
+ gerror = g_error_new(RST_CORE_ERROR, RST_CORE_ERROR_MISSING_ID, "JSON payload has missing/invalid/zero 'id'.");
+ goto fatal;
+ }
+
+ request = json_object_get_member(message, "request");
+ if (!request) {
+ gerror = g_error_new(RST_CORE_ERROR, RST_CORE_ERROR_MISSING_REQUEST, "JSON payload has missing 'request'.");
+ goto fatal;
+ }
+
+ instance = g_object_get_data(G_OBJECT (signtext->stack), uuid);
+
+ if (instance) {
+
+ }
+ else {
+ instance = signtext_instance_new(id, uuid, uri);
+
+ instance->box = GTK_BOX(gtk_box_new(GTK_ORIENTATION_VERTICAL, 6));
+
+ g_object_set_data_full(G_OBJECT (signtext->stack), instance->uuid, instance, (GDestroyNotify)signtext_instance_free);
+ }
+
+ /*
+ * Process request.
+ *
+ * A string request is a data payload, append it to existing text buffer and
+ * send back an ACK.
+ */
+ if (json_node_get_value_type(request) == G_TYPE_STRING) {
+
+ JsonBuilder *builder;
+
+ GtkTextIter end;
+
+ gtk_text_buffer_get_end_iter(instance->buffer, &end);
+ gtk_text_buffer_insert(instance->buffer, &end, json_node_get_string(request), -1);
+
+ /*
+ * A response with a value of TRUE means ACK, send us the next bit of data.
+ */
+ builder = json_builder_new_immutable();
+ json_builder_begin_object(builder);
+ json_builder_set_member_name(builder, "uuid");
+ json_builder_add_string_value(builder, uuid);
+ json_builder_set_member_name(builder, "id");
+ json_builder_add_int_value(builder, id);
+ json_builder_set_member_name(builder, "response");
+ json_builder_add_boolean_value(builder, TRUE);
+ json_builder_end_object(builder);
+
+ root = json_builder_get_root(builder);
+
+ message_send(signtext, root);
+
+ }
+
+ /*
+ * An object request means the data is done and we're ready to let the end user
+ * see the UI.
+ *
+ * Make the UI visible.
+ */
+ else if (json_node_get_node_type(request) == JSON_NODE_OBJECT) {
+
+ instance->selector = gcr_combo_selector_new(signtext->certificates);
+
+ //gcr_filter_collection_new_with_callback();
+
+#ifdef HAVE_GTK_BOX_APPEND
+ gtk_box_append (instance->box, GTK_WIDGET(instance->textview));
+ gtk_box_append (instance->box, GTK_WIDGET(instance->selector));
+#else
+ gtk_box_pack_start (instance->box, GTK_WIDGET(instance->textview), TRUE, TRUE, 0);
+ gtk_box_pack_start (instance->box, GTK_WIDGET(instance->selector), FALSE, FALSE, 0);
+#endif
+
+ gtk_stack_add_titled(signtext->stack, GTK_WIDGET (instance->box), instance->uuid, g_uri_get_host(instance->uri));
+
+ gtk_widget_show_all (GTK_WIDGET(instance->box));
+
+ }
+
+ /*
+ * Anything else is an error.
+ */
+ else {
+ gerror = g_error_new(RST_CORE_ERROR, RST_CORE_ERROR_REQUEST_NOT_RECOGNISED, "JSON payload 'request' is not recognised.");
+ goto fatal;
+ }
+
+ g_object_unref(parser);
+
+ }
+
+ if (gerror) {
+fatal:
+
+ GtkWidget* dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL,
+ GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
+ "%s", ("Redwax SignText - Error"));
+ gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+ ("Error: %s"),
+ gerror->message);
+
+ g_error_free (gerror);
+
+ gtk_widget_show (dialog);
+
+ }
+
+}
+
+static void
+message_receive_do (GTask *task,
+ gpointer source_obj,
+ gpointer task_data,
+ GCancellable *cancellable)
+{
+ JsonParser *parser = NULL;
+ GError *gerror = NULL;
+ gchar *buf = NULL;
+ GInputStream *stream = NULL;
+
+ guint32 size;
+ gsize count;
+
+ g_printerr("message_receive_do\n");
+
+ stream = g_unix_input_stream_new (STDIN_FILENO, FALSE);
+
+ if (!g_input_stream_read_all(stream, (gchar *)(&size), sizeof(size), &count, cancellable, &gerror)) {
+
+ g_printerr("message_receive_do: read size failed\n");
+ goto done;
+ }
+
+ buf = g_malloc(size);
+
+ if (!buf) {
+
+ g_printerr("message_receive_do: allocation failed\n");
+ goto done;
+ }
+
+ if (!g_input_stream_read_all(stream, buf, size, &count, cancellable, &gerror)) {
+
+ g_printerr("message_receive_do: read message failed\n");
+ goto done;
+ }
+
+ parser = json_parser_new();
+
+ if (!json_parser_load_from_data(parser, buf, size, &gerror)) {
+
+ //g_main_loop_quit()
+
+ g_printerr("message_receive_do: parse json failed\n");
+
+ // handle error
+ goto done;
+ }
+
+ g_printerr("Payload received: %.*s\n", (int)size, buf);
+
+ g_task_return_pointer(task, g_object_ref(parser), g_object_unref);
+
+done:
+ if (buf) {
+ g_free(buf);
+ }
+ if (parser) {
+ g_object_unref(parser);
+ }
+ if (stream) {
+ g_object_unref(stream);
+ }
+
+ if (gerror) {
+ g_task_return_error (task, gerror);
+ }
+
+ return;
+}
+
+/*
+ * In the main UI thread, we want to receive a single JSON message on stdin.
+ *
+ * Spawn a GTask to make this happen in a seperate thread, and return immediately. We
+ * will eventually do the work in message_receive_do() in a sub-thread, and then we will
+ * eventually process the result in message_receive_done() in the UI thread, at which
+ * point we will update our UI and if necessary, handle any errors.
+ */
+void
+message_receive(SignTextData *signtext)
+{
+ GTask *task = g_task_new (signtext->window, signtext->cancellable, message_receive_done, signtext);
+ g_task_run_in_thread (task, message_receive_do);
+ g_object_unref (task);
+}
+
+static void
+message_send_done (GObject *source_object,
+ GAsyncResult *res,
+ gpointer user_data)
+{
+ SignTextData *signtext = user_data;
+ GError *gerror = NULL;
+
+ g_printerr("message_send_done\n");
+
+ g_task_propagate_boolean (G_TASK (res), &gerror);
+
+ if (gerror) {
+
+ GtkWidget* dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL,
+ GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
+ "%s", ("Redwax SignText - Error"));
+ gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+ ("Error: %s"),
+ gerror->message);
+
+ g_error_free (gerror);
+
+ gtk_widget_show (dialog);
+
+ }
+ else {
+
+ message_receive(signtext);
+ }
+}
+
+static void
+message_send_do (GTask *task,
+ gpointer source_obj,
+ gpointer task_data,
+ GCancellable *cancellable)
+{
+ JsonNode *root = task_data;
+ JsonGenerator *generator = NULL;
+ GError *gerror = NULL;
+ gchar *buf = NULL;
+ GOutputStream *stream = NULL;
+
+ guint32 size;
+ gsize count;
+
+ g_printerr("message_send_do\n");
+
+ generator = json_generator_new();
+
+ json_generator_set_root(generator, root);
+
+ stream = g_unix_output_stream_new (STDOUT_FILENO, FALSE);
+
+ buf = json_generator_to_data(generator, &count);
+ size = count;
+
+ if (!g_output_stream_write_all(stream, (gchar *)(&size), sizeof(size), &count, cancellable, &gerror)) {
+
+ g_printerr("message_send_do: write message size failed\n");
+ goto done;
+ }
+
+ if (!g_output_stream_write_all(stream, buf, size, &count, cancellable, &gerror)) {
+
+ g_printerr("message_send_do: write message content failed\n");
+ goto done;
+ }
+
+ g_printerr("Payload sent: %.*s\n", (int)size, buf);
+
+done:
+ if (buf) {
+ g_free(buf);
+ }
+ if (generator) {
+ g_object_unref(generator);
+ }
+ if (stream) {
+ g_object_unref(stream);
+ }
+
+ if (gerror) {
+ g_task_return_error (task, gerror);
+ }
+ else {
+ g_task_return_boolean(task, TRUE);
+ }
+
+ g_printerr("message_send_do complete\n");
+
+ return;
+}
+
+/*
+ * In the main UI thread, we want to send a single JSON message on stdout.
+ *
+ * Spawn a GTask to make this happen in a separate thread, and return immediately. We
+ * will eventually do the work of sending the message in message_send_do() in a
+ * sub-thread, and then we will eventually receive either success or an error in the
+ * main thread in message_send_done().
+ *
+ * At this point the loop is completed by repeating the request to receive the next
+ * single JSON message on stdin.
+ */
+void
+message_send(SignTextData *signtext, JsonNode *root)
+{
+ GTask *task = g_task_new (signtext->window, signtext->cancellable, message_send_done, signtext);
+ g_task_set_task_data (task, root, (GDestroyNotify)json_node_free);
+ g_task_run_in_thread (task, message_send_do);
+ g_object_unref (task);
+}
+
+
Added: redwax-signtext/trunk/src/linux/message.h
==============================================================================
--- redwax-signtext/trunk/src/linux/message.h (added)
+++ redwax-signtext/trunk/src/linux/message.h Sat Sep 3 13:56:01 2022
@@ -0,0 +1,32 @@
+/* Licensed to Stichting The Commons Conservancy (TCC) under one or more
+ * contributor license agreements. See the AUTHORS file distributed with
+ * this work for additional information regarding copyright ownership.
+ * TCC licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include <gtk/gtk.h>
+
+#include "signtext.h"
+
+#ifndef MESSAGE_H
+#define MESSAGE_H
+
+void
+message_receive(SignTextData *signtext);
+
+void
+message_send(SignTextData *signtext, JsonNode *root);
+
+#endif
+
Propchange: redwax-signtext/trunk/src/linux/po/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Sep 3 13:56:01 2022
@@ -0,0 +1,4 @@
+Makefile
+Makefile.in
+POTFILES
+stamp-it
Added: redwax-signtext/trunk/src/linux/po/Makefile.in.in
==============================================================================
--- redwax-signtext/trunk/src/linux/po/Makefile.in.in (added)
+++ redwax-signtext/trunk/src/linux/po/Makefile.in.in Sat Sep 3 13:56:01 2022
@@ -0,0 +1 @@
+link /usr/share/intltool/Makefile.in.in
Propchange: redwax-signtext/trunk/src/linux/po/Makefile.in.in
------------------------------------------------------------------------------
svn:special = *
Added: redwax-signtext/trunk/src/linux/po/POTFILES.in
==============================================================================
--- redwax-signtext/trunk/src/linux/po/POTFILES.in (added)
+++ redwax-signtext/trunk/src/linux/po/POTFILES.in Sat Sep 3 13:56:01 2022
@@ -0,0 +1,3 @@
+main.c
+message.c
+
Added: redwax-signtext/trunk/src/linux/signtext.c
==============================================================================
--- redwax-signtext/trunk/src/linux/signtext.c (added)
+++ redwax-signtext/trunk/src/linux/signtext.c Sat Sep 3 13:56:01 2022
@@ -0,0 +1,71 @@
+/* Licensed to Stichting The Commons Conservancy (TCC) under one or more
+ * contributor license agreements. See the AUTHORS file distributed with
+ * this work for additional information regarding copyright ownership.
+ * TCC licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+
+
+#include "signtext.h"
+
+GQuark rst_core_error_quark (void) {
+ static GQuark quark;
+ if (!quark) {
+ quark = g_quark_from_static_string ("rst-core-error-quark");
+ }
+ return quark;
+}
+
+void signtext_data_free(SignTextData *data)
+{
+ if (data) {
+ if (data->certificates) g_object_unref(data->certificates);
+ if (data->slots) gck_list_unref_free(data->slots);
+ if (data->modules) gck_list_unref_free(data->modules);
+ }
+ g_free(data);
+}
+
+SignTextInstance *signtext_instance_new(gint64 id, const gchar *uuid, GUri *uri)
+{
+ SignTextInstance *instance = g_new (SignTextInstance, 1);
+
+ g_uri_ref(uri);
+
+ instance->id = id;
+ instance->uuid = g_strdup(uuid);
+ instance->uri = uri;
+
+ instance->buffer = gtk_text_buffer_new (gtk_text_tag_table_new ());
+
+ instance->textview = GTK_TEXT_VIEW (gtk_text_view_new_with_buffer(instance->buffer));
+
+ gtk_text_view_set_editable(instance->textview, FALSE);
+ gtk_text_view_set_cursor_visible(instance->textview, FALSE);
+ gtk_text_view_set_wrap_mode(instance->textview, GTK_WRAP_WORD_CHAR);
+
+ return instance;
+}
+
+void signtext_instance_free(SignTextInstance *instance)
+{
+ if (instance) {
+ if (instance->uuid) g_free(instance->uuid);
+ if (instance->uri) g_uri_unref(instance->uri);
+ if (instance->textview) g_object_unref(instance->textview);
+ if (instance->buffer) g_object_unref(instance->buffer);
+ }
+ g_free(instance);
+}
+
Added: redwax-signtext/trunk/src/linux/signtext.h
==============================================================================
--- redwax-signtext/trunk/src/linux/signtext.h (added)
+++ redwax-signtext/trunk/src/linux/signtext.h Sat Sep 3 13:56:01 2022
@@ -0,0 +1,73 @@
+/* Licensed to Stichting The Commons Conservancy (TCC) under one or more
+ * contributor license agreements. See the AUTHORS file distributed with
+ * this work for additional information regarding copyright ownership.
+ * TCC licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+
+#include <gtk/gtk.h>
+
+#define GCR_API_SUBJECT_TO_CHANGE
+#include <gcr/gcr-base.h>
+#include <ui/gcr-ui.h>
+
+#ifndef SIGNTEXT_H
+#define SIGNTEXT_H
+
+GQuark rst_core_error_quark (void);
+
+#define RST_CORE_ERROR rst_core_error_quark ()
+
+typedef enum
+{
+ RST_CORE_ERROR_FAILED = 1,
+ RST_CORE_ERROR_MISSING_ROOT,
+ RST_CORE_ERROR_MISSING_ID,
+ RST_CORE_ERROR_MISSING_UUID,
+ RST_CORE_ERROR_MISSING_TITLE,
+ RST_CORE_ERROR_MISSING_URL,
+ RST_CORE_ERROR_URL_INVALID,
+ RST_CORE_ERROR_MISSING_REQUEST,
+ RST_CORE_ERROR_MISSING_CONTENT_TYPE,
+ RST_CORE_ERROR_REQUEST_NOT_RECOGNISED,
+ RST_CORE_ERROR_NO_MODULES,
+} SignTextCoreError;
+
+typedef struct SignTextData {
+ GtkWidget *window;
+ GCancellable *cancellable;
+ GtkBox *box;
+ GtkStackSwitcher *switcher;
+ GtkStack *stack;
+ GList *modules;
+ GList *slots;
+ GcrCollection *certificates;
+} SignTextData;
+
+typedef struct SignTextInstance {
+ GUri *uri;
+ gchar *uuid;
+ gint64 id;
+
+ GtkBox *box;
+ GtkTextBuffer *buffer;
+ GtkTextView *textview;
+ GcrComboSelector *selector;
+} SignTextInstance;
+
+SignTextInstance *signtext_instance_new(gint64 id, const gchar *uuid, GUri *uri);
+void signtext_instance_free(SignTextInstance *instance);
+
+#endif
+
More information about the rs-commit
mailing list