[seahorse] Move SeahorseExportable and SeahorseExporter over to vala
- From: Stefan Walter <stefw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [seahorse] Move SeahorseExportable and SeahorseExporter over to vala
- Date: Sun, 21 Apr 2013 13:30:54 +0000 (UTC)
commit 236206da45510d62125046b63274f0fdb4905f13
Author: Stef Walter <stefw gnome org>
Date: Tue Oct 23 16:00:00 2012 +0200
Move SeahorseExportable and SeahorseExporter over to vala
common/Makefile.am | 2 +
common/seahorse-exportable.vala | 243 ++++++++++++++++
common/seahorse-exporter.vala | 105 +++++++
libseahorse/Makefile.am | 2 -
libseahorse/seahorse-catalog.c | 5 +-
libseahorse/seahorse-exportable.c | 446 -----------------------------
libseahorse/seahorse-exportable.h | 74 -----
libseahorse/seahorse-exporter.c | 273 ------------------
libseahorse/seahorse-exporter.h | 101 -------
libseahorse/seahorse-key-manager-store.c | 6 +-
libseahorse/seahorse-util.c | 44 ---
libseahorse/seahorse-util.h | 3 -
libseahorse/seahorse-viewable.h | 2 +-
pgp/seahorse-gpgme-exporter.c | 6 +-
pgp/seahorse-gpgme-exporter.h | 2 +-
pgp/seahorse-gpgme-key.c | 3 +-
pgp/seahorse-pgp-key-properties.c | 10 +-
pgp/seahorse-transfer.c | 6 +-
pkcs11/seahorse-certificate-der-exporter.c | 4 +-
pkcs11/seahorse-certificate-der-exporter.h | 2 +-
pkcs11/seahorse-certificate.c | 1 -
pkcs11/seahorse-pkcs11-properties.c | 3 +-
pkcs11/seahorse-private-key.c | 1 -
ssh/seahorse-ssh-exporter.c | 6 +-
ssh/seahorse-ssh-exporter.h | 2 +-
ssh/seahorse-ssh-key-properties.c | 6 +-
ssh/seahorse-ssh-key.c | 1 -
ssh/seahorse-ssh-operation.c | 2 +-
28 files changed, 380 insertions(+), 981 deletions(-)
---
diff --git a/common/Makefile.am b/common/Makefile.am
index 239f0f1..e983333 100644
--- a/common/Makefile.am
+++ b/common/Makefile.am
@@ -9,6 +9,8 @@ noinst_LTLIBRARIES = libcommon.la
libcommon_la_SOURCES = \
seahorse-deletable.vala \
seahorse-deleter.vala \
+ seahorse-exportable.vala \
+ seahorse-exporter.vala \
$(NULL)
AM_VALAFLAGS = \
diff --git a/common/seahorse-exportable.vala b/common/seahorse-exportable.vala
new file mode 100644
index 0000000..57974ad
--- /dev/null
+++ b/common/seahorse-exportable.vala
@@ -0,0 +1,243 @@
+/*
+ * Seahorse
+ *
+ * Copyright (C) 2004,2005 Stefan Walter
+ * Copyright (C) 2011 Collabora Ltd.
+ * Copyright (C) 2012 Stefan Walter
+ *
+ * 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.
+ */
+
+namespace Seahorse {
+
+public interface Exportable : GLib.Object {
+ public abstract bool exportable { get; }
+
+ public abstract GLib.List<Exporter> create_exporters(ExporterType type);
+
+ public static bool can_export(GLib.Object object) {
+ if (object is Exportable)
+ return ((Exportable)object).exportable;
+ return false;
+ }
+
+ public static int export_to_directory_wait(GLib.List<GLib.Object> objects,
+ string directory) throws GLib.Error {
+ var loop = new GLib.MainLoop (null, false);
+ GLib.AsyncResult? result = null;
+ int count = 0;
+
+ foreach (var object in objects) {
+ if (!Exportable.can_export(object))
+ continue;
+
+ var exporters = ((Exportable)object).create_exporters(ExporterType.ANY);
+ if (exporters == null)
+ continue;
+
+ var exporter = exporters.data;
+ string filename = GLib.Path.build_filename (directory, exporter.filename, null);
+ var file = GLib.File.new_for_uri(filename);
+
+ exporter.export_to_file.begin(file, false, null, (obj, res) => {
+ result = res;
+ loop.quit();
+ });
+
+ loop.run();
+
+ exporter.export_to_file.end(result);
+
+ count++;
+ }
+
+ return count;
+ }
+
+ public static uint export_to_text_wait(GLib.List<GLib.Object> objects,
+ [CCode (array_length_type = "size_t")] out uchar[] output)
throws GLib.Error {
+ GLib.List<Exporter> exporters = null;
+
+ foreach (var object in objects) {
+ if (!Exportable.can_export(object))
+ continue;
+
+ /* If we've already found exporters, then add to those */
+ if (exporters != null) {
+ foreach (var exporter in exporters)
+ exporter.add_object(object);
+
+ /* Otherwise try and create new exporters for this object */
+ } else {
+ exporters = ((Exportable)object).create_exporters (ExporterType.TEXTUAL);
+ }
+ }
+
+ /* Find the exporter than has the most objects */
+ Exporter? chosen = null;
+ uint total = 0;
+ foreach (var exporter in exporters) {
+ uint count = exporter.get_objects().length();
+ if (count > total) {
+ total = count;
+ chosen = exporter;
+ }
+ }
+
+ if (chosen != null) {
+ var loop = new GLib.MainLoop (null, false);
+ GLib.AsyncResult? result = null;
+
+ chosen.export.begin(null, (obj, res) => {
+ result = res;
+ loop.quit();
+ });
+
+ loop.run();
+
+ output = chosen.export.end(result);
+ return total;
+ }
+
+ output = { };
+ return 0;
+ }
+
+ public static int export_to_prompt_wait(GLib.List<GLib.Object> objects,
+ Gtk.Window? parent) throws GLib.Error {
+ int count = 0;
+
+ var pending = new GLib.HashTable<weak GLib.Object, weak GLib.Object>(GLib.direct_hash,
GLib.direct_equal);
+ foreach (var object in objects)
+ pending.add(object);
+
+ foreach (var object in objects) {
+ if (pending.lookup(object) == null)
+ continue;
+
+ if (!Exportable.can_export(object)) {
+ pending.remove(object);
+ continue;
+ }
+
+ var exporters = ((Exportable)object).create_exporters(ExporterType.ANY);
+ if (exporters == null)
+ continue;
+
+ foreach (var x in objects) {
+ if (x == object)
+ continue;
+ if (pending.lookup(x) != null) {
+ foreach (var exporter in exporters)
+ exporter.add_object(x);
+ }
+ }
+
+ string directory = null;
+ GLib.File? file;
+ Exporter? exporter;
+
+ /* Now show a prompt choosing between the exporters */
+ bool ret = Exportable.prompt(exporters, parent, ref directory,
+ out file, out exporter);
+ if (!ret)
+ break;
+
+ var loop = new GLib.MainLoop(null, false);
+ GLib.AsyncResult? result = null;
+
+ exporter.export_to_file.begin(file, true, null, (obj, res) => {
+ result = res;
+ loop.quit();
+ });
+
+ exporter.export_to_file.end(result);
+ foreach (var e in exporter.get_objects()) {
+ pending.remove(e);
+ count++;
+ }
+ }
+
+ return count;
+ }
+
+ private static string calculate_basename(GLib.File file,
+ string extension) {
+ var basename = file.get_basename();
+ var dot = basename.last_index_of_char('.');
+ if (dot != -1)
+ basename = basename.substring(0, dot);
+ return "%s%s".printf(basename, extension);
+ }
+
+ public static bool prompt(GLib.List<Exporter> exporters,
+ Gtk.Window? parent,
+ ref string directory,
+ out GLib.File chosen_file,
+ out Exporter chosen_exporter) {
+ var chooser = new Gtk.FileChooserDialog(null, parent, Gtk.FileChooserAction.SAVE,
+ Gtk.Stock.CANCEL, Gtk.ResponseType.CANCEL,
+ _("Export"), Gtk.ResponseType.ACCEPT,
+ null);
+
+ chooser.set_default_response(Gtk.ResponseType.ACCEPT);
+ chooser.set_local_only(false);
+ chooser.set_do_overwrite_confirmation(true);
+
+ if (directory != null)
+ chooser.set_current_folder(directory);
+
+ Gtk.FileFilter? first = null;
+ var filters = new GLib.HashTable<Gtk.FileFilter, Exporter>(GLib.direct_hash,
GLib.direct_equal);
+ foreach (var exporter in exporters) {
+ var filter = exporter.file_filter;
+ filters.replace(filter, exporter);
+ chooser.add_filter(filter);
+ if (first == null)
+ first = filter;
+ }
+
+ chooser.notify.connect((obj, prop) => {
+ var exporter = filters.lookup(chooser.get_filter());
+ var name = exporter.filename;
+ var dot = name.last_index_of_char('.');
+ if (dot != -1) {
+ var file = chooser.get_file();
+ if (file != null) {
+ var basename = calculate_basename(file, name.substring(dot));
+ chooser.set_current_name(basename);
+ } else {
+ chooser.set_current_name(name);
+ }
+ }
+ });
+
+ chooser.set_filter(first);
+
+ if (chooser.run() == Gtk.ResponseType.ACCEPT) {
+ chosen_file = chooser.get_file();
+ chosen_exporter = filters.lookup(chooser.get_filter());
+ directory = chooser.get_current_folder();
+ return true;
+ }
+
+ chosen_file = null;
+ chosen_exporter = null;
+ return false;
+ }
+}
+
+}
diff --git a/common/seahorse-exporter.vala b/common/seahorse-exporter.vala
new file mode 100644
index 0000000..3450a65
--- /dev/null
+++ b/common/seahorse-exporter.vala
@@ -0,0 +1,105 @@
+/*
+ * Seahorse
+ *
+ * Copyright (C) 2011 Collabora Ltd.
+ * Copyright (C) 2012 Stefan Walter
+ *
+ * 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 Exporter, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Author: Stef Walter <stefw collabora co uk>
+ */
+
+namespace Seahorse {
+
+public enum ExporterType {
+ ANY,
+ TEXTUAL
+}
+
+public interface Exporter : GLib.Object {
+ public abstract string filename { get; }
+
+ public abstract string content_type { get; }
+
+ public abstract Gtk.FileFilter file_filter { get; }
+
+ public abstract unowned GLib.List<weak GLib.Object> get_objects();
+
+ public abstract bool add_object(GLib.Object obj);
+
+ [CCode (array_length_type = "size_t")]
+ public abstract async uchar[] export(GLib.Cancellable? cancellable) throws GLib.Error;
+
+ static GLib.File file_increment_unique(GLib.File file,
+ ref uint state) {
+
+ string uri = file.get_uri();
+
+ /* Last path component */
+ int last = uri.last_index_of_char('/');
+ if (last == -1)
+ last = 0;
+
+ string prefix;
+ string suffix;
+
+ /* A dot in last path component? */
+ int index = uri.last_index_of_char('.', last);
+ if (index == -1) {
+ prefix = uri;
+ suffix = "";
+ } else {
+ prefix = uri.substring(0, index);
+ suffix = uri.substring(index);
+ }
+
+ state++;
+ return GLib.File.new_for_uri("%s-%u%s".printf(prefix, state, suffix));
+ }
+
+ public async bool export_to_file(GLib.File file,
+ bool overwrite,
+ GLib.Cancellable? cancellable) throws GLib.Error {
+
+ uchar[] bytes = yield this.export(cancellable);
+ GLib.File out = file;
+
+ /*
+ * When not trying to overwrite we pass an invalid etag. This way
+ * if the file exists, it will not match the etag, and we'll be
+ * able to detect it and try another file name.
+ */
+
+ while (true) {
+ uint unique = 0;
+ try {
+ yield out.replace_contents_async(bytes, overwrite ? null : "invalid etag",
+ false, GLib.FileCreateFlags.PRIVATE,
+ cancellable, null);
+ return true;
+
+ } catch (GLib.IOError err) {
+ if (err is GLib.IOError.WRONG_ETAG) {
+ out = file_increment_unique(file, ref unique);
+ continue;
+ }
+ throw err;
+ }
+ }
+ }
+}
+
+}
diff --git a/libseahorse/Makefile.am b/libseahorse/Makefile.am
index aac362c..03df519 100644
--- a/libseahorse/Makefile.am
+++ b/libseahorse/Makefile.am
@@ -53,8 +53,6 @@ libseahorse_la_SOURCES = \
seahorse-collection.c seahorse-collection.h \
seahorse-debug.c seahorse-debug.h \
seahorse-delete-dialog.c seahorse-delete-dialog.h \
- seahorse-exportable.c seahorse-exportable.h \
- seahorse-exporter.c seahorse-exporter.h \
seahorse-icons.c seahorse-icons.h \
seahorse-interaction.c seahorse-interaction.h \
seahorse-key-manager-store.c seahorse-key-manager-store.h \
diff --git a/libseahorse/seahorse-catalog.c b/libseahorse/seahorse-catalog.c
index f384044..62bd618 100644
--- a/libseahorse/seahorse-catalog.c
+++ b/libseahorse/seahorse-catalog.c
@@ -27,7 +27,6 @@
#include "seahorse-backend.h"
#include "seahorse-catalog.h"
#include "seahorse-common.h"
-#include "seahorse-exportable.h"
#include "seahorse-object.h"
#include "seahorse-prefs.h"
#include "seahorse-progress.h"
@@ -244,7 +243,7 @@ on_key_export_clipboard (GtkAction* action,
SeahorseCatalog *self)
{
GList* objects;
- gpointer output;
+ guchar *output;
gsize size;
GError *error = NULL;
GdkAtom atom;
@@ -262,7 +261,7 @@ on_key_export_clipboard (GtkAction* action,
if (error == NULL) {
atom = gdk_atom_intern ("CLIPBOARD", FALSE);
board = gtk_clipboard_get (atom);
- gtk_clipboard_set_text (board, output, (gint)size);
+ gtk_clipboard_set_text (board, (gchar *)output, (gint)size);
} else {
seahorse_util_handle_error (&error, seahorse_catalog_get_window (self),
_("Couldn't export data"));
diff --git a/libseahorse/seahorse-key-manager-store.c b/libseahorse/seahorse-key-manager-store.c
index b6fdcd5..fe0b2c3 100644
--- a/libseahorse/seahorse-key-manager-store.c
+++ b/libseahorse/seahorse-key-manager-store.c
@@ -23,7 +23,7 @@
#include "config.h"
-#include "seahorse-exportable.h"
+#include "seahorse-common.h"
#include "seahorse-place.h"
#include "seahorse-util.h"
@@ -352,7 +352,7 @@ static gboolean
export_to_text (SeahorseKeyManagerStore *self,
GtkSelectionData *selection_data)
{
- gpointer output;
+ guchar *output;
gsize size;
gboolean ret;
guint count;
@@ -367,7 +367,7 @@ export_to_text (SeahorseKeyManagerStore *self,
if (count > 0) {
seahorse_debug ("setting selection text");
- gtk_selection_data_set_text (selection_data, output, size);
+ gtk_selection_data_set_text (selection_data, (gchar *)output, (gint)size);
ret = TRUE;
} else if (self->priv->drag_error) {
g_message ("error occurred on export: %s", self->priv->drag_error->message);
diff --git a/libseahorse/seahorse-util.c b/libseahorse/seahorse-util.c
index 8fa7652..d342889 100644
--- a/libseahorse/seahorse-util.c
+++ b/libseahorse/seahorse-util.c
@@ -366,50 +366,6 @@ seahorse_util_printf_fd (int fd, const char* fmt, ...)
return ret;
}
-GFile *
-seahorse_util_file_increment_unique (GFile *file,
- guint *state)
-{
- GFile *result;
- gchar *suffix;
- gchar *prefix;
- gchar *uri_try;
- gchar *x;
- guint len;
-
- g_return_val_if_fail (G_IS_FILE (file), NULL);
- g_return_val_if_fail (state != NULL, NULL);
-
- prefix = g_file_get_uri (file);
- len = strlen (prefix);
-
- g_return_val_if_fail (len > 0, NULL);
-
- /* Always take off a slash at end */
- if (prefix[len - 1] == '/')
- prefix[len - 1] = 0;
-
- /* Split into prefix and suffix */
- suffix = strrchr (prefix, '.');
- x = strrchr (prefix, '/');
- if (suffix == NULL || (x != NULL && suffix < x)) {
- suffix = g_strdup ("");
- } else {
- x = suffix;
- suffix = g_strdup (suffix);
- *x = 0;
- }
-
- ++(*state);
- uri_try = g_strdup_printf ("%s-%u%s", prefix, *state, suffix);
- g_free (suffix);
- g_free (prefix);
-
- result = g_file_new_for_uri (uri_try);
- g_free (uri_try);
- return result;
-}
-
/**
* seahorse_util_write_file_private:
* @filename: file to write to
diff --git a/libseahorse/seahorse-util.h b/libseahorse/seahorse-util.h
index b6f1f3d..103c576 100644
--- a/libseahorse/seahorse-util.h
+++ b/libseahorse/seahorse-util.h
@@ -66,9 +66,6 @@ gboolean seahorse_util_print_fd (int fd,
gboolean seahorse_util_printf_fd (int fd,
const char* data, ...);
-GFile * seahorse_util_file_increment_unique (GFile *file,
- guint *state);
-
gboolean seahorse_util_write_file_private (const gchar* filename,
const gchar* contents,
GError **err);
diff --git a/libseahorse/seahorse-viewable.h b/libseahorse/seahorse-viewable.h
index 2b14f42..f3ea7cb 100644
--- a/libseahorse/seahorse-viewable.h
+++ b/libseahorse/seahorse-viewable.h
@@ -24,7 +24,7 @@
#ifndef __SEAHORSE_VIEWABLE_H__
#define __SEAHORSE_VIEWABLE_H__
-#include "seahorse-exporter.h"
+#include "seahorse-common.h"
#include <gio/gio.h>
diff --git a/pgp/seahorse-gpgme-exporter.c b/pgp/seahorse-gpgme-exporter.c
index 73328fd..9ee3e65 100644
--- a/pgp/seahorse-gpgme-exporter.c
+++ b/pgp/seahorse-gpgme-exporter.c
@@ -31,7 +31,7 @@
#include "seahorse-gpg-op.h"
#include "seahorse-progress.h"
-#include "seahorse-exporter.h"
+#include "seahorse-common.h"
#include "seahorse-object.h"
#include "seahorse-util.h"
@@ -374,7 +374,7 @@ seahorse_gpgme_exporter_export_async (SeahorseExporter *exporter,
g_object_unref (res);
}
-static gpointer
+static guchar *
seahorse_gpgme_exporter_export_finish (SeahorseExporter *exporter,
GAsyncResult *result,
gsize *size,
@@ -398,7 +398,7 @@ static void
seahorse_gpgme_exporter_iface_init (SeahorseExporterIface *iface)
{
iface->add_object = seahorse_gpgme_exporter_add_object;
- iface->export_async = seahorse_gpgme_exporter_export_async;
+ iface->export = seahorse_gpgme_exporter_export_async;
iface->export_finish = seahorse_gpgme_exporter_export_finish;
iface->get_objects = seahorse_gpgme_exporter_get_objects;
}
diff --git a/pgp/seahorse-gpgme-exporter.h b/pgp/seahorse-gpgme-exporter.h
index 1b3c7ba..00bf4c0 100644
--- a/pgp/seahorse-gpgme-exporter.h
+++ b/pgp/seahorse-gpgme-exporter.h
@@ -26,7 +26,7 @@
#include <glib-object.h>
-#include "seahorse-exporter.h"
+#include "seahorse-common.h"
#define SEAHORSE_TYPE_GPGME_EXPORTER (seahorse_gpgme_exporter_get_type ())
#define SEAHORSE_GPGME_EXPORTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj),
SEAHORSE_TYPE_GPGME_EXPORTER, SeahorseGpgmeExporter))
diff --git a/pgp/seahorse-gpgme-key.c b/pgp/seahorse-gpgme-key.c
index 00f9c3c..e3c726d 100644
--- a/pgp/seahorse-gpgme-key.c
+++ b/pgp/seahorse-gpgme-key.c
@@ -34,7 +34,6 @@
#include "seahorse-pgp-key.h"
#include "seahorse-common.h"
-#include "seahorse-exportable.h"
#include "seahorse-icons.h"
#include "seahorse-predicate.h"
#include "seahorse-object-list.h"
@@ -587,7 +586,7 @@ seahorse_gpgme_key_create_exporters (SeahorseExportable *exportable,
{
GList *result = NULL;
- if (type != SEAHORSE_EXPORTER_TEXTUAL)
+ if (type != SEAHORSE_EXPORTER_TYPE_TEXTUAL)
result = g_list_append (result, seahorse_gpgme_exporter_new (G_OBJECT (exportable), FALSE,
FALSE));
result = g_list_append (result, seahorse_gpgme_exporter_new (G_OBJECT (exportable), TRUE, FALSE));
diff --git a/pgp/seahorse-pgp-key-properties.c b/pgp/seahorse-pgp-key-properties.c
index f3b0344..69968d1 100644
--- a/pgp/seahorse-pgp-key-properties.c
+++ b/pgp/seahorse-pgp-key-properties.c
@@ -31,9 +31,8 @@
#include <glib/gi18n.h>
#include "seahorse-bind.h"
+#include "seahorse-common.h"
#include "seahorse-delete-dialog.h"
-#include "seahorse-exportable.h"
-#include "seahorse-exporter.h"
#include "seahorse-icons.h"
#include "seahorse-object.h"
#include "seahorse-object-model.h"
@@ -1149,7 +1148,8 @@ on_export_complete (GObject *source,
GtkWindow *parent = GTK_WINDOW (user_data);
GError *error = NULL;
- if (!seahorse_exporter_export_to_file_finish (SEAHORSE_EXPORTER (source), result, &error))
+ seahorse_exporter_export_to_file_finish (SEAHORSE_EXPORTER (source), result, &error);
+ if (error != NULL)
seahorse_util_handle_error (&error, parent, _("Couldn't export key"));
g_object_unref (parent);
@@ -1172,8 +1172,8 @@ on_pgp_details_export_button (GtkWidget *widget,
window = GTK_WINDOW (seahorse_widget_get_toplevel (swidget));
if (seahorse_exportable_prompt (exporters, window, NULL, &file, &exporter)) {
- seahorse_exporter_export_to_file_async (exporter, file, TRUE, NULL,
- on_export_complete, g_object_ref (window));
+ seahorse_exporter_export_to_file (exporter, file, TRUE, NULL,
+ on_export_complete, g_object_ref (window));
g_object_unref (file);
g_object_unref (exporter);
}
diff --git a/pgp/seahorse-transfer.c b/pgp/seahorse-transfer.c
index c824a39..e4f46f1 100644
--- a/pgp/seahorse-transfer.c
+++ b/pgp/seahorse-transfer.c
@@ -26,9 +26,9 @@
#include "seahorse-gpgme-exporter.h"
#include "seahorse-gpgme-keyring.h"
+#include "seahorse-common.h"
#define DEBUG_FLAG SEAHORSE_DEBUG_OPERATION
#include "seahorse-debug.h"
-#include "seahorse-exporter.h"
#include "seahorse-object-list.h"
#include "seahorse-progress.h"
#include "seahorse-transfer.h"
@@ -179,8 +179,8 @@ on_timeout_start_transfer (gpointer user_data)
} else if (SEAHORSE_IS_GPGME_KEYRING (closure->from)) {
g_assert (closure->keys != NULL);
exporter = seahorse_gpgme_exporter_new_multiple (closure->keys, TRUE);
- seahorse_exporter_export_async (exporter, closure->cancellable,
- on_source_export_ready, g_object_ref (res));
+ seahorse_exporter_export (exporter, closure->cancellable,
+ on_source_export_ready, g_object_ref (res));
g_object_unref (exporter);
} else {
diff --git a/pkcs11/seahorse-certificate-der-exporter.c b/pkcs11/seahorse-certificate-der-exporter.c
index 3b6f7d6..4bc9262 100644
--- a/pkcs11/seahorse-certificate-der-exporter.c
+++ b/pkcs11/seahorse-certificate-der-exporter.c
@@ -201,7 +201,7 @@ seahorse_certificate_der_exporter_export_async (SeahorseExporter *exporter,
g_object_unref (res);
}
-static gpointer
+static guchar *
seahorse_certificate_der_exporter_export_finish (SeahorseExporter *exporter,
GAsyncResult *result,
gsize *size,
@@ -225,7 +225,7 @@ static void
seahorse_certificate_der_exporter_iface_init (SeahorseExporterIface *iface)
{
iface->add_object = seahorse_certificate_der_exporter_add_object;
- iface->export_async = seahorse_certificate_der_exporter_export_async;
+ iface->export = seahorse_certificate_der_exporter_export_async;
iface->export_finish = seahorse_certificate_der_exporter_export_finish;
iface->get_objects = seahorse_certificate_der_exporter_get_objects;
}
diff --git a/pkcs11/seahorse-certificate-der-exporter.h b/pkcs11/seahorse-certificate-der-exporter.h
index 78d02b5..0e159e2 100644
--- a/pkcs11/seahorse-certificate-der-exporter.h
+++ b/pkcs11/seahorse-certificate-der-exporter.h
@@ -24,7 +24,7 @@
#ifndef __SEAHORSE_CERTIFICATE_DER_EXPORTER_H__
#define __SEAHORSE_CERTIFICATE_DER_EXPORTER_H__
-#include "seahorse-exporter.h"
+#include "seahorse-common.h"
#include <glib-object.h>
diff --git a/pkcs11/seahorse-certificate.c b/pkcs11/seahorse-certificate.c
index f6b3290..c73fc79 100644
--- a/pkcs11/seahorse-certificate.c
+++ b/pkcs11/seahorse-certificate.c
@@ -33,7 +33,6 @@
#include "seahorse-types.h"
#include "seahorse-common.h"
-#include "seahorse-exportable.h"
#include "seahorse-util.h"
#include "seahorse-validity.h"
#include "seahorse-viewable.h"
diff --git a/pkcs11/seahorse-pkcs11-properties.c b/pkcs11/seahorse-pkcs11-properties.c
index 4593dfa..f5c6811 100644
--- a/pkcs11/seahorse-pkcs11-properties.c
+++ b/pkcs11/seahorse-pkcs11-properties.c
@@ -30,7 +30,6 @@
#include "seahorse-action.h"
#include "seahorse-common.h"
-#include "seahorse-exportable.h"
#include "seahorse-progress.h"
#include "seahorse-util.h"
@@ -358,7 +357,7 @@ seahorse_pkcs11_properties_constructed (GObject *obj)
if (SEAHORSE_IS_EXPORTABLE (self->object))
exporters = seahorse_exportable_create_exporters (SEAHORSE_EXPORTABLE (self->object),
- SEAHORSE_EXPORTER_ANY);
+ SEAHORSE_EXPORTER_TYPE_ANY);
request = gtk_action_group_get_action (self->actions, "export-object");
gtk_action_set_visible (request, exporters != NULL);
diff --git a/pkcs11/seahorse-private-key.c b/pkcs11/seahorse-private-key.c
index 5f51ac9..31fe931 100644
--- a/pkcs11/seahorse-private-key.c
+++ b/pkcs11/seahorse-private-key.c
@@ -31,7 +31,6 @@
#include "seahorse-types.h"
#include "seahorse-common.h"
-#include "seahorse-exportable.h"
#include "seahorse-util.h"
#include "seahorse-viewable.h"
diff --git a/ssh/seahorse-ssh-exporter.c b/ssh/seahorse-ssh-exporter.c
index 1f76279..ebab76f 100644
--- a/ssh/seahorse-ssh-exporter.c
+++ b/ssh/seahorse-ssh-exporter.c
@@ -28,7 +28,7 @@
#include "seahorse-ssh-exporter.h"
#include "seahorse-ssh-source.h"
-#include "seahorse-exporter.h"
+#include "seahorse-common.h"
#include "seahorse-object.h"
#include "seahorse-util.h"
@@ -256,7 +256,7 @@ seahorse_ssh_exporter_export_async (SeahorseExporter *exporter,
g_object_unref (res);
}
-static gpointer
+static guchar *
seahorse_ssh_exporter_export_finish (SeahorseExporter *exporter,
GAsyncResult *result,
gsize *size,
@@ -299,7 +299,7 @@ static void
seahorse_ssh_exporter_iface_init (SeahorseExporterIface *iface)
{
iface->add_object = seahorse_ssh_exporter_add_object;
- iface->export_async = seahorse_ssh_exporter_export_async;
+ iface->export = seahorse_ssh_exporter_export_async;
iface->export_finish = seahorse_ssh_exporter_export_finish;
iface->get_objects = seahorse_ssh_exporter_get_objects;
}
diff --git a/ssh/seahorse-ssh-exporter.h b/ssh/seahorse-ssh-exporter.h
index d8516b5..104b567 100644
--- a/ssh/seahorse-ssh-exporter.h
+++ b/ssh/seahorse-ssh-exporter.h
@@ -26,7 +26,7 @@
#include <glib-object.h>
-#include "seahorse-exporter.h"
+#include "seahorse-common.h"
#define SEAHORSE_TYPE_SSH_EXPORTER (seahorse_ssh_exporter_get_type ())
#define SEAHORSE_SSH_EXPORTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj),
SEAHORSE_TYPE_SSH_EXPORTER, SeahorseSshExporter))
diff --git a/ssh/seahorse-ssh-key-properties.c b/ssh/seahorse-ssh-key-properties.c
index 376282e..08cf3e8 100644
--- a/ssh/seahorse-ssh-key-properties.c
+++ b/ssh/seahorse-ssh-key-properties.c
@@ -27,8 +27,6 @@
#include "seahorse-ssh-operation.h"
#include "seahorse-bind.h"
-#include "seahorse-exporter.h"
-#include "seahorse-exportable.h"
#include "seahorse-icons.h"
#include "seahorse-object.h"
#include "seahorse-object-widget.h"
@@ -219,8 +217,8 @@ on_ssh_export_button_clicked (GtkWidget *widget, SeahorseWidget *swidget)
window = GTK_WINDOW (seahorse_widget_get_toplevel (swidget));
if (seahorse_exportable_prompt (exporters, window, NULL, &file, &exporter)) {
- seahorse_exporter_export_to_file_async (exporter, file, TRUE, NULL,
- on_export_complete, g_object_ref (window));
+ seahorse_exporter_export_to_file (exporter, file, TRUE, NULL,
+ on_export_complete, g_object_ref (window));
g_object_unref (file);
g_object_unref (exporter);
}
diff --git a/ssh/seahorse-ssh-key.c b/ssh/seahorse-ssh-key.c
index 7f26ae7..c2533bf 100644
--- a/ssh/seahorse-ssh-key.c
+++ b/ssh/seahorse-ssh-key.c
@@ -31,7 +31,6 @@
#include "seahorse-ssh-source.h"
#include "seahorse-common.h"
-#include "seahorse-exportable.h"
#include "seahorse-icons.h"
#include "seahorse-place.h"
#include "seahorse-validity.h"
diff --git a/ssh/seahorse-ssh-operation.c b/ssh/seahorse-ssh-operation.c
index 3a48cac..6b69534 100644
--- a/ssh/seahorse-ssh-operation.c
+++ b/ssh/seahorse-ssh-operation.c
@@ -24,9 +24,9 @@
#include "seahorse-ssh-operation.h"
+#include "seahorse-common.h"
#define DEBUG_FLAG SEAHORSE_DEBUG_OPERATION
#include "seahorse-debug.h"
-#include "seahorse-exporter.h"
#include "seahorse-util.h"
#include <sys/wait.h>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]