diff options
author | Stef Walter <stefw@gnome.org> | 2012-10-20 14:03:38 +0200 |
---|---|---|
committer | Stef Walter <stefw@gnome.org> | 2012-10-20 20:42:38 +0200 |
commit | 64442ec0c168125102168bf514c4c881dec8119c (patch) | |
tree | 1d0e253cfd1e5089bfa4db4c3b06847d97204e0c | |
parent | 95c2736242e161295426ee3c25177bc2ad0dd042 (diff) | |
download | gcr-wip/gir-keyerror.tar.gz |
WIP vapiwip/gir-keyerror
-rw-r--r-- | .gitignore | 4 | ||||
-rw-r--r-- | configure.ac | 13 | ||||
-rw-r--r-- | gck/Gck-1.metadata | 2 | ||||
-rw-r--r-- | gck/Makefile.am | 60 | ||||
-rw-r--r-- | gcr/Gcr-3.metadata | 5 | ||||
-rw-r--r-- | gcr/GcrBase-3.metadata | 5 | ||||
-rw-r--r-- | gcr/Makefile.am | 212 | ||||
-rw-r--r-- | gcr/gcr-certificate-renderer.c | 36 | ||||
-rw-r--r-- | gcr/gcr-certificate-renderer.h | 5 | ||||
-rw-r--r-- | gcr/gcr-certificate-widget.c | 25 | ||||
-rw-r--r-- | gcr/gcr-certificate-widget.h | 19 | ||||
-rw-r--r-- | gcr/gcr-deprecated.h | 11 | ||||
-rw-r--r-- | gcr/gcr-renderer.c | 37 | ||||
-rw-r--r-- | gcr/gcr-renderer.h | 5 |
14 files changed, 305 insertions, 134 deletions
@@ -82,6 +82,8 @@ stamp-* /gck/*.pc /gck/gck-enum-types* /gck/gck-marshal.* +/gck/gck-?.deps +/gck/gck-?.vapi /gcr/*.pc /gcr/gcr-dbus-generated.* @@ -94,6 +96,8 @@ stamp-* /gcr/gcr-viewer /gcr/gcr-viewer.desktop /gcr/gcr-viewer.desktop.in +/gcr/gcr-?.deps +/gcr/gcr-?.vapi /po/Makefile.in.in /po/*.sed diff --git a/configure.ac b/configure.ac index c2af224..9fcf53a 100644 --- a/configure.ac +++ b/configure.ac @@ -86,6 +86,18 @@ AC_SUBST(GTK_CFLAGS) AC_SUBST(GTK_LIBS) # -------------------------------------------------------------------- +# Vala + +VALA_REQUIRED=0.18.0 + +VAPIGEN_CHECK($VALA_REQUIRED) + +if test "$enable_vala" != "no"; then + AC_PATH_PROG([VALAC], [valac], []) +fi +AM_CONDITIONAL(HAVE_VALAC, test "x$VALAC" != "x") + +# -------------------------------------------------------------------- # Checks for functions # @@ -377,6 +389,7 @@ echo "BUILD" echo " Debug Build: $debug_status" echo " Strict Compilation: $strict_status" echo " Introspection: $found_introspection" +echo " Vala: $enable_vala" echo " Valgrind: $valgrind_status" echo " Test Coverage: $enable_coverage" echo diff --git a/gck/Gck-1.metadata b/gck/Gck-1.metadata new file mode 100644 index 0000000..b175213 --- /dev/null +++ b/gck/Gck-1.metadata @@ -0,0 +1,2 @@ +// Metadata file for Vala API generation. +// See https://live.gnome.org/Vala/UpstreamGuide for more information diff --git a/gck/Makefile.am b/gck/Makefile.am index 2319bf7..979eac0 100644 --- a/gck/Makefile.am +++ b/gck/Makefile.am @@ -99,6 +99,23 @@ gck-enum-types.h: gck-enum-types.h.template $(HEADER_FILES) gck-enum-types.c: gck-enum-types.c.template $(HEADER_FILES) $(AM_V_GEN) $(GLIB_MKENUMS) --template $^ > $@ +EXTRA_DIST = \ + gck.pc.in \ + gck-marshal.list \ + gck.symbols \ + gck-enum-types.h.template \ + gck-enum-types.c.template \ + pkcs11-trust-assertions.h \ + pkcs11i.h + +CLEANFILES = \ + gck-$(GCK_MAJOR).pc \ + $(gir_DATA) \ + $(typelibs_DATA) \ + $(BUILT_SOURCES) \ + gck-actual.abi \ + gck-expected.abi + # ------------------------------------------------------------------ # INTROSPECTION @@ -126,6 +143,33 @@ gir_DATA = $(INTROSPECTION_GIRS) typelibsdir = $(libdir)/girepository-1.0 typelibs_DATA = $(INTROSPECTION_GIRS:.gir=.typelib) +if ENABLE_VAPIGEN +include $(VAPIGEN_MAKEFILE) + +gck-@GCK_MAJOR@.vapi: Gck-@GCK_MAJOR@.gir Gck-@GCK_MAJOR@.metadata gck-@GCK_MAJOR@.deps + +VAPIGEN_VAPIS = gck-@GCK_MAJOR@.vapi + +gck_@GCK_MAJOR@_vapi_DEPS = glib-2.0 gio-2.0 +gck_@GCK_MAJOR@_vapi_METADATADIRS = $(srcdir) +gck_@GCK_MAJOR@_vapi_FILES = Gck-@GCK_MAJOR@.gir + +VAPI_DEPS = $(VAPIGEN_VAPIS:.vapi=.deps) + +gck-$(GCK_MAJOR).deps: Makefile.am + $(AM_V_GEN) echo $(gck_@GCK_MAJOR@_vapi_DEPS) | tr ' ' '\n' > $@ + +vapidir = $(datadir)/vala/vapi +vapi_DATA = \ + $(VAPIGEN_VAPIS) \ + $(VAPI_DEPS) + +CLEANFILES += \ + $(VAPIGEN_VAPIS) \ + $(VAPI_DEPS) + +endif # ENABLE_VAPIGEN + endif # ---------------------------------------------------------------- @@ -152,19 +196,3 @@ check-local: check-symbols check-memory: make -C tests check-memory -EXTRA_DIST = \ - gck.pc.in \ - gck-marshal.list \ - gck.symbols \ - gck-enum-types.h.template \ - gck-enum-types.c.template \ - pkcs11-trust-assertions.h \ - pkcs11i.h - -CLEANFILES = \ - gck-$(GCK_MAJOR).pc \ - $(gir_DATA) \ - $(typelibs_DATA) \ - $(BUILT_SOURCES) \ - gck-actual.abi \ - gck-expected.abi diff --git a/gcr/Gcr-3.metadata b/gcr/Gcr-3.metadata new file mode 100644 index 0000000..cbecc9f --- /dev/null +++ b/gcr/Gcr-3.metadata @@ -0,0 +1,5 @@ +// Metadata file for Vala API generation. +// See https://live.gnome.org/Vala/UpstreamGuide for more information + +Certificate + .get_der_data#virtual_method name="provide_der_data"
\ No newline at end of file diff --git a/gcr/GcrBase-3.metadata b/gcr/GcrBase-3.metadata new file mode 100644 index 0000000..cbecc9f --- /dev/null +++ b/gcr/GcrBase-3.metadata @@ -0,0 +1,5 @@ +// Metadata file for Vala API generation. +// See https://live.gnome.org/Vala/UpstreamGuide for more information + +Certificate + .get_der_data#virtual_method name="provide_der_data"
\ No newline at end of file diff --git a/gcr/Makefile.am b/gcr/Makefile.am index 4671581..d3a3290 100644 --- a/gcr/Makefile.am +++ b/gcr/Makefile.am @@ -36,6 +36,7 @@ HEADER_BASE_FILES = \ gcr-secret-exchange.h \ gcr-secure-memory.h \ gcr-simple-certificate.h \ + gcr-simple-collection.h \ gcr-system-prompt.h \ gcr-system-prompter.h \ gcr-trust.h \ @@ -61,7 +62,6 @@ HEADER_UI_FILES = \ gcr-prompt-dialog.h \ gcr-renderer.h \ gcr-secure-entry-buffer.h \ - gcr-simple-collection.h \ gcr-tree-selector.h \ gcr-unlock-options-widget.h \ gcr-viewer.h \ @@ -107,97 +107,120 @@ BUILT_SOURCES = \ $(BUILT_BASE_FILES) \ $(BUILT_UI_FILES) -libgcr_base_@GCR_MAJOR@_la_SOURCES = \ - gcr-callback-output-stream.c gcr-callback-output-stream.h \ +PUBLIC_BASE_FILES = \ + gcr-base.h \ gcr-certificate.c gcr-certificate.h \ gcr-certificate-chain.c gcr-certificate-chain.h \ - gcr-certificate-extensions.c gcr-certificate-extensions.h \ gcr-certificate-request.c gcr-certificate-request.h \ gcr-collection.c gcr-collection.h \ gcr-comparable.c gcr-comparable.h \ - gcr-dbus-constants.h \ - gcr-debug.c gcr-debug.h \ gcr-filter-collection.c gcr-filter-collection.h \ gcr-fingerprint.c gcr-fingerprint.h \ + gcr-icons.c gcr-icons.h \ + gcr-importer.c gcr-importer.h \ + gcr-import-interaction.c gcr-import-interaction.h \ + gcr-library.c gcr-library.h \ + gcr-mock-prompter.c gcr-mock-prompter.h \ + gcr-parser.c gcr-parser.h \ + gcr-pkcs11-certificate.c gcr-pkcs11-certificate.h \ + gcr-prompt.c gcr-prompt.h \ + gcr-secret-exchange.c gcr-secret-exchange.h \ + gcr-secure-memory.c gcr-secure-memory.h \ + gcr-simple-certificate.c gcr-simple-certificate.h \ + gcr-simple-collection.c gcr-simple-collection.h \ + gcr-system-prompt.c gcr-system-prompt.h \ + gcr-system-prompter.c gcr-system-prompter.h \ + gcr-types.h \ + gcr-union-collection.c gcr-union-collection.h \ + gcr-unlock-options.h \ + $(NULL) + +PRIVATE_BASE_FILES = \ + gcr-callback-output-stream.c gcr-callback-output-stream.h \ + gcr-certificate-extensions.c gcr-certificate-extensions.h \ + gcr-dbus-constants.h \ + gcr-debug.c gcr-debug.h \ + gcr-deprecated-base.h \ gcr-gnupg-collection.c gcr-gnupg-collection.h \ gcr-gnupg-importer.c gcr-gnupg-importer.h \ gcr-gnupg-key.c gcr-gnupg-key.h \ gcr-gnupg-process.c gcr-gnupg-process.h \ gcr-gnupg-records.c gcr-gnupg-records.h \ gcr-gnupg-util.c gcr-gnupg-util.h \ - gcr-icons.c gcr-icons.h \ - gcr-importer.c gcr-importer.h \ - gcr-import-interaction.c gcr-import-interaction.h \ gcr-internal.h \ gcr-key-mechanisms.h gcr-key-mechanisms.c \ - gcr-library.c gcr-library.h \ gcr-memory.c \ gcr-memory-icon.c gcr-memory-icon.h \ - gcr-mock-prompter.c gcr-mock-prompter.h \ gcr-openpgp.c gcr-openpgp.h \ gcr-openssh.c gcr-openssh.h \ - gcr-parser.c gcr-parser.h \ - gcr-pkcs11-certificate.c gcr-pkcs11-certificate.h \ gcr-pkcs11-importer.c gcr-pkcs11-importer.h \ - gcr-prompt.c gcr-prompt.h \ gcr-record.c gcr-record.h \ - gcr-secret-exchange.c gcr-secret-exchange.h \ - gcr-secure-memory.c gcr-secure-memory.h \ - gcr-simple-certificate.c gcr-simple-certificate.h \ - gcr-simple-collection.c gcr-simple-collection.h \ gcr-single-collection.c gcr-single-collection.h \ gcr-subject-public-key.c gcr-subject-public-key.h \ - gcr-system-prompt.c gcr-system-prompt.h \ - gcr-system-prompter.c gcr-system-prompter.h \ gcr-trust.c gcr-trust.h \ - gcr-types.h \ - gcr-union-collection.c gcr-union-collection.h \ gcr-util.c gcr-util.h \ $(NULL) +libgcr_base_@GCR_MAJOR@_la_SOURCES = \ + $(PUBLIC_BASE_FILES) \ + $(PRIVATE_BASE_FILES) \ + $(NULL) + nodist_libgcr_base_@GCR_MAJOR@_la_SOURCES = \ $(BUILT_BASE_FILES) -libgcr_@GCR_MAJOR@_la_SOURCES = \ +PUBLIC_UI_FILES = \ + gcr.h \ + gcr-certificate-renderer.c gcr-certificate-renderer.h \ + gcr-certificate-widget.c gcr-certificate-widget.h \ + gcr-collection-model.c gcr-collection-model.h \ + gcr-column.h \ + gcr-combo-selector.c gcr-combo-selector.h \ + gcr-failure-renderer.c gcr-failure-renderer.h \ + gcr-key-renderer.c gcr-key-renderer.h \ + gcr-key-widget.c gcr-key-widget.h \ + gcr-import-button.c gcr-import-button.h \ + gcr-list-selector.c gcr-list-selector.h \ + gcr-prompt-dialog.c gcr-prompt-dialog.h \ + gcr-renderer.c gcr-renderer.h \ + gcr-secure-entry-buffer.c gcr-secure-entry-buffer.h \ + gcr-tree-selector.c gcr-tree-selector.h \ + gcr-unlock-options-widget.c gcr-unlock-options-widget.h \ + gcr-viewer.c gcr-viewer.h \ + gcr-viewer-widget.c gcr-viewer-widget.h \ + $(NULL) + +PRIVATE_UI_FILES = \ gcr-certificate-basics-widget.c gcr-certificate-basics-widget.h \ gcr-certificate-details-widget.c gcr-certificate-details-widget.h \ gcr-certificate-exporter.c gcr-certificate-exporter.h \ gcr-certificate-extensions.c gcr-certificate-extensions.h \ - gcr-certificate-renderer.c gcr-certificate-renderer.h gcr-certificate-renderer-private.h \ + gcr-certificate-renderer-private.h \ gcr-certificate-request-renderer.c gcr-certificate-request-renderer.h \ - gcr-certificate-widget.c gcr-certificate-widget.h \ - gcr-collection-model.c gcr-collection-model.h \ - gcr-combo-selector.c gcr-combo-selector.h \ gcr-debug.c gcr-debug.h \ + gcr-deprecated.h \ gcr-dialog-util.c gcr-dialog-util.h \ gcr-display-scrolled.c gcr-display-scrolled.h \ gcr-display-view.c gcr-display-view.h \ - gcr-failure-renderer.c gcr-failure-renderer.h \ gcr-gnupg-renderer.c gcr-gnupg-renderer.h \ gcr-gnupg-records.c gcr-gnupg-records.h \ - gcr-import-button.c gcr-import-button.h \ - gcr-key-renderer.c gcr-key-renderer.h \ - gcr-key-widget.c gcr-key-widget.h \ - gcr-list-selector.c gcr-list-selector.h gcr-list-selector-private.h \ + gcr-list-selector-private.h \ gcr-live-search.c gcr-live-search.h \ gcr-memory.c \ gcr-memory-icon.c gcr-memory-icon.h \ gcr-pkcs11-import-interaction.c gcr-pkcs11-import-interaction.h \ gcr-pkcs11-import-dialog.c gcr-pkcs11-import-dialog.h \ - gcr-prompt-dialog.c gcr-prompt-dialog.h \ gcr-record.c gcr-record.h \ - gcr-renderer.c gcr-renderer.h \ - gcr-secure-entry-buffer.c gcr-secure-entry-buffer.h \ gcr-subject-public-key.c gcr-subject-public-key.h \ - gcr-tree-selector.c gcr-tree-selector.h \ - gcr-unlock-options.h \ - gcr-unlock-options-widget.c gcr-unlock-options-widget.h \ gcr-unlock-renderer.c gcr-unlock-renderer.h \ - gcr-viewer.c gcr-viewer.h \ - gcr-viewer-widget.c gcr-viewer-widget.h \ gcr-viewer-window.c gcr-viewer-window.h \ $(NULL) +libgcr_@GCR_MAJOR@_la_SOURCES = \ + $(PUBLIC_UI_FILES) \ + $(PRIVATE_UI_FILES) \ + $(NULL) + nodist_libgcr_@GCR_MAJOR@_la_SOURCES = \ $(BUILT_UI_FILES) @@ -353,6 +376,36 @@ gcr_prompter_LDADD = \ $(top_builddir)/gck/libgck-@GCK_MAJOR@.la \ $(GTK_LIBS) + +EXTRA_DIST = \ + gcr.pc.in \ + gcr-base.pc.in \ + gcr-marshal.list \ + gcr-oids.list \ + gcr-mkoids \ + $(ui_DATA) \ + $(DBUS_XML_DEFINITIONS) \ + gcr-enum-types.h.template \ + gcr-enum-types.c.template \ + gcr.symbols \ + gcr-base.symbols \ + $(desktop_in_in_files) \ + $(service_in_files) \ + $(mime_DATA) + +CLEANFILES = \ + $(BUILT_SOURCES) \ + $(pkgconfig_DATA) \ + $(service_DATA) \ + $(desktop_in_files) \ + $(desktop_DATA) \ + $(gir_DATA) \ + $(typelibs_DATA) \ + gcr-actual.abi \ + gcr-actual-base.abi \ + gcr-expected.abi \ + gcr-expected-base.abi + # ------------------------------------------------------------------ # INTROSPECTION @@ -360,7 +413,7 @@ if HAVE_INTROSPECTION include $(INTROSPECTION_MAKEFILE) -INTROSPECTION_GIRS = Gcr-@GCR_MAJOR@.gir +INTROSPECTION_GIRS = Gcr-@GCR_MAJOR@.gir GcrBase-@GCR_MAJOR@.gir INTROSPECTION_SCANNER_ARGS = \ $(INTROSPECTION_FLAGS) \ --warn-all \ @@ -377,15 +430,61 @@ Gcr_@GCR_MAJOR@_gir_EXPORT_PACKAGES = gcr-@GCR_MAJOR@ Gcr_@GCR_MAJOR@_gir_INCLUDES = GLib-2.0 GObject-2.0 Gtk-3.0 Gcr_@GCR_MAJOR@_gir_LIBS = libgcr-base-@GCR_MAJOR@.la libgcr-@GCR_MAJOR@.la Gcr_@GCR_MAJOR@_gir_CFLAGS = -I$(top_srcdir) -I$(top_builddir) -DGCR_COMPILATION -DGCR_API_SUBJECT_TO_CHANGE -Gcr_@GCR_MAJOR@_gir_FILES = $(libgcr_base_@GCR_MAJOR@_la_SOURCES) $(libgcr_@GCR_MAJOR@_la_SOURCES) +Gcr_@GCR_MAJOR@_gir_FILES = $(PUBLIC_BASE_FILES) $(PUBLIC_UI_FILES) Gcr_@GCR_MAJOR@_gir_SCANNERFLAGS = --c-include "gcr.h" --c-include "gcr-base.h" +GcrBase-@GCR_MAJOR@.gir: libgcr-base-@GCR_MAJOR@.la Gcr-@GCR_MAJOR@.gir + +GcrBase_@GCR_MAJOR@_gir_PACKAGES = p11-kit-1 +GcrBase_@GCR_MAJOR@_gir_EXPORT_PACKAGES = gcr-base-@GCR_MAJOR@ +GcrBase_@GCR_MAJOR@_gir_INCLUDES = GLib-2.0 GObject-2.0 +GcrBase_@GCR_MAJOR@_gir_LIBS = libgcr-base-@GCR_MAJOR@.la +GcrBase_@GCR_MAJOR@_gir_CFLAGS = -I$(top_srcdir) -I$(top_builddir) -DGCR_COMPILATION -DGCR_API_SUBJECT_TO_CHANGE +GcrBase_@GCR_MAJOR@_gir_FILES = $(PUBLIC_BASE_FILES) +GcrBase_@GCR_MAJOR@_gir_SCANNERFLAGS = --c-include "gcr-base.h" --identifier-prefix Gcr --namespace=GcrBase + girdir = $(datadir)/gir-1.0 gir_DATA = $(INTROSPECTION_GIRS) typelibsdir = $(libdir)/girepository-1.0 typelibs_DATA = $(INTROSPECTION_GIRS:.gir=.typelib) +if ENABLE_VAPIGEN +include $(VAPIGEN_MAKEFILE) + +gcr-@GCR_MAJOR@.vapi: Gcr-@GCR_MAJOR@.gir Gcr-@GCR_MAJOR@.metadata gcr-@GCR_MAJOR@.deps +gcr-base-@GCR_MAJOR@.vapi: GcrBase-@GCR_MAJOR@.gir GcrBase-@GCR_MAJOR@.metadata gcr-base-@GCR_MAJOR@.deps + +VAPIGEN_VAPIS = gcr-@GCR_MAJOR@.vapi gcr-base-@GCR_MAJOR@.vapi + +gcr_@GCR_MAJOR@_vapi_DEPS = glib-2.0 gio-2.0 gck-@GCK_MAJOR@ gtk+-3.0 +gcr_@GCR_MAJOR@_vapi_METADATADIRS = $(srcdir) +gcr_@GCR_MAJOR@_vapi_VAPIDIRS = $(builddir) $(builddir)/../gck +gcr_@GCR_MAJOR@_vapi_FILES = Gcr-@GCR_MAJOR@.gir + +gcr_base_@GCR_MAJOR@_vapi_DEPS = glib-2.0 gio-2.0 gck-@GCK_MAJOR@ +gcr_base_@GCR_MAJOR@_vapi_METADATADIRS = $(srcdir) +gcr_base_@GCR_MAJOR@_vapi_VAPIDIRS = $(builddir) $(builddir)/../gck +gcr_base_@GCR_MAJOR@_vapi_FILES = GcrBase-@GCR_MAJOR@.gir + +VAPI_DEPS = $(VAPIGEN_VAPIS:.vapi=.deps) + +gcr-$(GCR_MAJOR).deps: Makefile.am + $(AM_V_GEN) echo $(gcr_@GCR_MAJOR@_vapi_DEPS) | tr ' ' '\n' > $@ +gcr-base-$(GCR_MAJOR).deps: Makefile.am + $(AM_V_GEN) echo $(gcr_base_@GCR_MAJOR@_vapi_DEPS) | tr ' ' '\n' > $@ + +vapidir = $(datadir)/vala/vapi +vapi_DATA = \ + $(VAPIGEN_VAPIS) \ + $(VAPI_DEPS) + +CLEANFILES += \ + $(VAPIGEN_VAPIS) \ + $(VAPI_DEPS) + +endif # ENABLE_VAPIGEN + endif # ---------------------------------------------------------------- @@ -412,32 +511,3 @@ check-local: check-symbols check-memory: make -C tests check-memory - -EXTRA_DIST = \ - gcr.pc.in \ - gcr-base.pc.in \ - gcr-marshal.list \ - gcr-oids.list \ - gcr-mkoids \ - $(ui_DATA) \ - $(DBUS_XML_DEFINITIONS) \ - gcr-enum-types.h.template \ - gcr-enum-types.c.template \ - gcr.symbols \ - gcr-base.symbols \ - $(desktop_in_in_files) \ - $(service_in_files) \ - $(mime_DATA) - -CLEANFILES = \ - $(BUILT_SOURCES) \ - $(pkgconfig_DATA) \ - $(service_DATA) \ - $(desktop_in_files) \ - $(desktop_DATA) \ - $(gir_DATA) \ - $(typelibs_DATA) \ - gcr-actual.abi \ - gcr-actual-base.abi \ - gcr-expected.abi \ - gcr-expected-base.abi diff --git a/gcr/gcr-certificate-renderer.c b/gcr/gcr-certificate-renderer.c index d4e05f4..4aba295 100644 --- a/gcr/gcr-certificate-renderer.c +++ b/gcr/gcr-certificate-renderer.c @@ -24,6 +24,7 @@ #include "gcr-certificate-extensions.h" #include "gcr-certificate-renderer.h" #include "gcr-certificate-renderer-private.h" +#include "gcr-deprecated.h" #include "gcr-display-view.h" #include "gcr-fingerprint.h" #include "gcr-icons.h" @@ -383,7 +384,17 @@ gcr_certificate_renderer_set_property (GObject *obj, guint prop_id, const GValue gcr_renderer_emit_data_changed (GCR_RENDERER (self)); break; case PROP_ATTRIBUTES: - gcr_certificate_renderer_set_attributes (self, g_value_get_boxed (value)); + gck_attributes_unref (self->pv->opt_attrs); + self->pv->opt_attrs = g_value_get_boxed (value); + if (self->pv->opt_attrs) + gck_attributes_ref (self->pv->opt_attrs); + if (self->pv->opt_cert) { + g_object_unref (self->pv->opt_cert); + g_object_notify (G_OBJECT (self), "certificate"); + self->pv->opt_cert = NULL; + } + gcr_renderer_emit_data_changed (GCR_RENDERER (self)); + g_object_notify (G_OBJECT (self), "attributes"); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec); @@ -743,12 +754,14 @@ gcr_certificate_renderer_set_certificate (GcrCertificateRenderer *self, GcrCerti * Get the PKCS\#11 attributes, if any, set for this renderer to display. * * Returns: (allow-none) (transfer none): the attributes, owned by the renderer + * + * Deprecated: 3.6: Use gcr_renderer_get_attributes() instead */ GckAttributes * gcr_certificate_renderer_get_attributes (GcrCertificateRenderer *self) { g_return_val_if_fail (GCR_IS_CERTIFICATE_RENDERER (self), NULL); - return self->pv->opt_attrs; + return gcr_renderer_get_attributes (GCR_RENDERER (self)); } /** @@ -758,27 +771,14 @@ gcr_certificate_renderer_get_attributes (GcrCertificateRenderer *self) * * Set the PKCS\#11 attributes for this renderer to display. One of the attributes * should be a CKA_VALUE type attribute containing a DER encoded certificate. + * + * Deprecated: 3.6: Use gcr_renderer_set_attributes() instead */ void gcr_certificate_renderer_set_attributes (GcrCertificateRenderer *self, GckAttributes *attrs) { g_return_if_fail (GCR_IS_CERTIFICATE_RENDERER (self)); - - gck_attributes_unref (self->pv->opt_attrs); - self->pv->opt_attrs = attrs; - - if (self->pv->opt_attrs) - gck_attributes_ref (self->pv->opt_attrs); - - if (self->pv->opt_cert) { - g_object_unref (self->pv->opt_cert); - g_object_notify (G_OBJECT (self), "certificate"); - self->pv->opt_cert = NULL; - } - - gcr_renderer_emit_data_changed (GCR_RENDERER (self)); - g_object_notify (G_OBJECT (self), "attributes"); - + gcr_renderer_set_attributes (GCR_RENDERER (self), attrs); } typedef struct { diff --git a/gcr/gcr-certificate-renderer.h b/gcr/gcr-certificate-renderer.h index 6167dd5..2450b98 100644 --- a/gcr/gcr-certificate-renderer.h +++ b/gcr/gcr-certificate-renderer.h @@ -67,11 +67,6 @@ GcrCertificate* gcr_certificate_renderer_get_certificate (GcrCertif void gcr_certificate_renderer_set_certificate (GcrCertificateRenderer *self, GcrCertificate *certificate); -GckAttributes* gcr_certificate_renderer_get_attributes (GcrCertificateRenderer *self); - -void gcr_certificate_renderer_set_attributes (GcrCertificateRenderer *self, - GckAttributes *attrs); - G_END_DECLS #endif /* __GCR_CERTIFICATE_RENDERER_H__ */ diff --git a/gcr/gcr-certificate-widget.c b/gcr/gcr-certificate-widget.c index 6ffdd44..7fb9954 100644 --- a/gcr/gcr-certificate-widget.c +++ b/gcr/gcr-certificate-widget.c @@ -22,6 +22,7 @@ #include "gcr-certificate.h" #include "gcr-certificate-renderer.h" #include "gcr-certificate-widget.h" +#include "gcr-deprecated.h" #include "gcr-renderer.h" #include "gcr-viewer.h" @@ -64,23 +65,12 @@ enum { PROP_ATTRIBUTES }; -struct _GcrCertificateWidget { - /*< private >*/ - GtkAlignment parent; - GcrCertificateWidgetPrivate *pv; -}; - -struct _GcrCertificateWidgetClass { - /*< private >*/ - GtkAlignmentClass parent_class; -}; - struct _GcrCertificateWidgetPrivate { GcrViewer *viewer; GcrCertificateRenderer *renderer; }; -G_DEFINE_TYPE (GcrCertificateWidget, gcr_certificate_widget, GTK_TYPE_ALIGNMENT); +G_DEFINE_TYPE (GcrCertificateWidget, gcr_certificate_widget, GTK_TYPE_WIDGET); /* ----------------------------------------------------------------------------- * OBJECT @@ -242,12 +232,14 @@ gcr_certificate_widget_set_certificate (GcrCertificateWidget *self, GcrCertifica * a certificate. * * Returns: (allow-none) (transfer none): the attributes, owned by the widget + * + * Deprecated: 3.6: Use gcr_renderer_get_attributes() instead */ GckAttributes * gcr_certificate_widget_get_attributes (GcrCertificateWidget *self) { g_return_val_if_fail (GCR_IS_CERTIFICATE_WIDGET (self), NULL); - return gcr_certificate_renderer_get_attributes (self->pv->renderer); + return gcr_renderer_get_attributes (GCR_RENDERER (self->pv->renderer)); } /** @@ -257,10 +249,13 @@ gcr_certificate_widget_get_attributes (GcrCertificateWidget *self) * * Set the attributes displayed in the widget. The attributes should contain * a certificate. + * + * Deprecated: 3.6: Use gcr_renderer_set_attributes() instead */ void -gcr_certificate_widget_set_attributes (GcrCertificateWidget *self, GckAttributes* attrs) +gcr_certificate_widget_set_attributes (GcrCertificateWidget *self, + GckAttributes *attrs) { g_return_if_fail (GCR_IS_CERTIFICATE_WIDGET (self)); - gcr_certificate_renderer_set_attributes (self->pv->renderer, attrs); + gcr_renderer_set_attributes (GCR_RENDERER (self->pv->renderer), attrs); } diff --git a/gcr/gcr-certificate-widget.h b/gcr/gcr-certificate-widget.h index 3ad2f19..2eca9c3 100644 --- a/gcr/gcr-certificate-widget.h +++ b/gcr/gcr-certificate-widget.h @@ -43,10 +43,16 @@ typedef struct _GcrCertificateWidget GcrCertificateWidget; typedef struct _GcrCertificateWidgetClass GcrCertificateWidgetClass; typedef struct _GcrCertificateWidgetPrivate GcrCertificateWidgetPrivate; -/* - * TODO: GcrCertificateWidget and GcrCertificateWidgetClass are hidden until - * we can figure out what they should be derived from. - */ +struct _GcrCertificateWidget { + /*< private >*/ + GtkWidget parent; + GcrCertificateWidgetPrivate *pv; +}; + +struct _GcrCertificateWidgetClass { + /*< private >*/ + GtkWidgetClass parent_class; +}; GType gcr_certificate_widget_get_type (void); @@ -57,11 +63,6 @@ GcrCertificate* gcr_certificate_widget_get_certificate (GcrCertif void gcr_certificate_widget_set_certificate (GcrCertificateWidget *self, GcrCertificate *certificate); -GckAttributes* gcr_certificate_widget_get_attributes (GcrCertificateWidget *self); - -void gcr_certificate_widget_set_attributes (GcrCertificateWidget *self, - GckAttributes* attrs); - G_END_DECLS #endif /* __GCR_CERTIFICATE_WIDGET_H__ */ diff --git a/gcr/gcr-deprecated.h b/gcr/gcr-deprecated.h index 3447c84..f92b79d 100644 --- a/gcr/gcr-deprecated.h +++ b/gcr/gcr-deprecated.h @@ -34,6 +34,7 @@ #include "gcr-certificate-basics-widget.h" #include "gcr-certificate-details-widget.h" +#include "gcr-certificate-renderer.h" #include "gcr-viewer.h" G_BEGIN_DECLS @@ -41,6 +42,16 @@ G_BEGIN_DECLS void gcr_renderer_render (GcrRenderer *self, GcrViewer *viewer); +GckAttributes * gcr_certificate_renderer_get_attributes (GcrCertificateRenderer *self); + +void gcr_certificate_renderer_set_attributes (GcrCertificateRenderer *self, + GckAttributes *attrs); + +GckAttributes * gcr_certificate_widget_get_attributes (GcrCertificateWidget *self); + +void gcr_certificate_widget_set_attributes (GcrCertificateWidget *self, + GckAttributes *attrs); + G_END_DECLS #endif /* __GI_SCANNER__ */ diff --git a/gcr/gcr-renderer.c b/gcr/gcr-renderer.c index 30ce91f..e66ed89 100644 --- a/gcr/gcr-renderer.c +++ b/gcr/gcr-renderer.c @@ -186,6 +186,43 @@ gcr_renderer_emit_data_changed (GcrRenderer *self) g_signal_emit (self, signals[DATA_CHANGED], 0); } +/** + * gcr_renderer_get_attributes: + * @self: The renderer + * + * Get the PKCS\#11 attributes, if any, set for this renderer to display. + * + * Returns: (allow-none) (transfer none): the attributes, owned by the renderer + */ +GckAttributes * +gcr_renderer_get_attributes (GcrRenderer *self) +{ + GckAttributes *attrs; + + g_return_val_if_fail (GCR_IS_RENDERER (self), NULL); + + g_object_get (self, "attributes", &attrs, NULL); + if (attrs != NULL) + gck_attributes_unref (attrs); + return attrs; +} + +/** + * gcr_renderer_set_attributes: + * @self: The renderer + * @attrs: (allow-none): attributes to set + * + * Set the PKCS\#11 attributes for this renderer to display. + */ +void +gcr_renderer_set_attributes (GcrRenderer *self, + GckAttributes *attrs) +{ + g_return_if_fail (GCR_IS_RENDERER (self)); + + g_object_set (self, "attributes", attrs, NULL); +} + static gint sort_registered_by_n_attrs (gconstpointer a, gconstpointer b) { diff --git a/gcr/gcr-renderer.h b/gcr/gcr-renderer.h index 242374a..ffca094 100644 --- a/gcr/gcr-renderer.h +++ b/gcr/gcr-renderer.h @@ -77,6 +77,11 @@ GcrRenderer* gcr_renderer_create (const gchar * void gcr_renderer_register (GType renderer_type, GckAttributes *attrs); +GckAttributes * gcr_renderer_get_attributes (GcrRenderer *self); + +void gcr_renderer_set_attributes (GcrRenderer *self, + GckAttributes *attrs); + void gcr_renderer_register_well_known (void); G_END_DECLS |