[seahorse] Move SeahorseDeleter and SeahorseDeletable to vala



commit 9a536caee43b3f95b7052afc5e3832b1cdeea133
Author: Stef Walter <stefw gnome org>
Date:   Sat Oct 20 23:11:26 2012 +0200

    Move SeahorseDeleter and SeahorseDeletable to vala
    
     * And add initial vala infrastructure

 .gitignore                           |   8 +-
 Makefile.am                          |   1 +
 common/Makefile.am                   |  25 +++++
 common/seahorse-deletable.vala       |  93 ++++++++++++++++++
 common/seahorse-deleter.vala         |  44 +++++++++
 configure.ac                         |   4 +
 gkr/Makefile.am                      |   2 +
 gkr/seahorse-gkr-item-deleter.c      |   2 +-
 gkr/seahorse-gkr-item-deleter.h      |   2 +-
 gkr/seahorse-gkr-item.c              |  11 ++-
 gkr/seahorse-gkr-keyring-deleter.c   |  14 +--
 gkr/seahorse-gkr-keyring-deleter.h   |   2 +-
 gkr/seahorse-gkr-keyring.c           |  12 ++-
 libseahorse/Makefile.am              |   6 +-
 libseahorse/seahorse-catalog.c       |   2 +-
 libseahorse/seahorse-deletable.c     | 185 -----------------------------------
 libseahorse/seahorse-deletable.h     |  53 ----------
 libseahorse/seahorse-deleter.c       | 135 -------------------------
 libseahorse/seahorse-deleter.h       |  92 -----------------
 pgp/Makefile.am                      |   2 +
 pgp/seahorse-gpgme-key-deleter.c     |   2 +-
 pgp/seahorse-gpgme-key-deleter.h     |   2 +-
 pgp/seahorse-gpgme-key.c             |  11 ++-
 pgp/seahorse-gpgme-secret-deleter.c  |   2 +-
 pgp/seahorse-gpgme-secret-deleter.h  |   2 +-
 pkcs11/Makefile.am                   |   2 +
 pkcs11/seahorse-certificate.c        |  11 ++-
 pkcs11/seahorse-pkcs11-deleter.c     |   2 +-
 pkcs11/seahorse-pkcs11-deleter.h     |   2 +-
 pkcs11/seahorse-pkcs11-key-deleter.h |   2 +-
 pkcs11/seahorse-pkcs11-properties.c  |   4 +-
 pkcs11/seahorse-private-key.c        |  11 ++-
 src/Makefile.am                      |   2 +
 src/seahorse-sidebar.c               |   6 +-
 ssh/Makefile.am                      |   2 +
 ssh/seahorse-ssh-deleter.c           |   2 +-
 ssh/seahorse-ssh-deleter.h           |   2 +-
 ssh/seahorse-ssh-key.c               |  11 ++-
 38 files changed, 273 insertions(+), 500 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 30bc05c..99fb77c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,10 +12,12 @@
 tmp-*
 *~
 *.valid
+Makefile
+Makefile.in
+.deps
+.libs
 
 /configure.lineno
-/Makefile
-/Makefile.in
 /aclocal.m4
 /autom4te.cache
 /config.*
@@ -49,3 +51,5 @@ tmp-*
 /help/*/index.docbook
 /help/*/legal.xml
 
+/common/*.c
+/common/*.h
diff --git a/Makefile.am b/Makefile.am
index 4ab6a19..9f89330 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -21,6 +21,7 @@ PGP_DIR =
 endif
 
 SUBDIRS = libegg \
+       common \
        libseahorse \
        gkr \
        $(PGP_DIR) \
diff --git a/common/Makefile.am b/common/Makefile.am
new file mode 100644
index 0000000..239f0f1
--- /dev/null
+++ b/common/Makefile.am
@@ -0,0 +1,25 @@
+NULL =
+
+INCLUDES = -I$(top_builddir) \
+       -I$(top_srcdir) \
+       $(SEAHORSE_CFLAGS)
+
+noinst_LTLIBRARIES = libcommon.la
+
+libcommon_la_SOURCES = \
+       seahorse-deletable.vala \
+       seahorse-deleter.vala \
+       $(NULL)
+
+AM_VALAFLAGS = \
+       $(VALA_FLAGS) \
+       --use-header \
+       --header=seahorse-common.h \
+       --pkg gtk+-3.0 \
+       $(NULL)
+
+CFLAGS = \
+       -include config.h \
+       -Wno-unused-but-set-variable \
+       -Wno-pointer-sign \
+       $(NULL)
\ No newline at end of file
diff --git a/common/seahorse-deletable.vala b/common/seahorse-deletable.vala
new file mode 100644
index 0000000..4b33623
--- /dev/null
+++ b/common/seahorse-deletable.vala
@@ -0,0 +1,93 @@
+/*
+ * 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 Deletable : GLib.Object {
+       public abstract Deleter create_deleter();
+       public abstract bool deletable { get; }
+
+       public static bool can_delete(GLib.Object obj) {
+               if (obj is Deletable)
+                       return ((Deletable)obj).deletable;
+               return false;
+       }
+
+       public static int delete_with_prompt_wait(GLib.List<GLib.Object> objects,
+                                                 Gtk.Window? parent) throws GLib.Error {
+
+               var loop = new GLib.MainLoop(null, false);
+               GLib.AsyncResult? result = null;
+               int count = 0;
+
+               /* A table for monitoring which objects are still pending */
+               var pending = new GLib.HashTable<weak GLib.Object, weak GLib.Object>(GLib.direct_hash, 
GLib.direct_equal);
+               foreach (var obj in objects)
+                       pending.add(obj);
+
+               foreach (var obj in objects) {
+                       if (pending.lookup(obj) == null)
+                               continue;
+
+                       if (!Deletable.can_delete (obj)) {
+                               pending.remove(obj);
+                               continue;
+                       }
+
+                       var deleter = ((Deletable)obj).create_deleter();
+
+                       /* Now go and add all pending to each exporter */
+                       foreach (var x in objects) {
+                               if (x == obj)
+                                       continue;
+                               if (pending.lookup(x) != null)
+                                       deleter.add_object(x);
+                       }
+
+                       /* Now show a prompt choosing between the exporters */
+                       var ret = deleter.prompt(parent);
+                       if (!ret)
+                               break;
+
+                       deleter.delete.begin(null, (obj, res) => {
+                               result = res;
+                               loop.quit();
+                       });
+
+                       loop.run();
+
+                       if (deleter.delete.end(result)) {
+                               foreach (var x in deleter.get_objects()) {
+                                       pending.remove(x);
+                                       count++;
+                               }
+                       } else {
+                               break;
+                       }
+               }
+
+               return count;
+       }
+}
+
+}
diff --git a/common/seahorse-deleter.vala b/common/seahorse-deleter.vala
new file mode 100644
index 0000000..6048086
--- /dev/null
+++ b/common/seahorse-deleter.vala
@@ -0,0 +1,44 @@
+/*
+ * 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 Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Author: Stef Walter <stefw collabora co uk>
+ */
+
+namespace Seahorse {
+
+public abstract class Deleter : GLib.Object {
+       public abstract unowned Gtk.Dialog create_confirm(Gtk.Window? parent);
+
+       public abstract unowned GLib.List<weak GLib.Object> get_objects();
+
+       public abstract bool add_object (GLib.Object obj);
+
+       public abstract async bool delete(GLib.Cancellable? cancellable) throws GLib.Error;
+
+       public bool prompt(Gtk.Window? parent) {
+               var prompt = this.create_confirm(parent);
+               int res = prompt.run();
+               prompt.destroy();
+               return res == Gtk.ResponseType.OK || res == Gtk.ResponseType.ACCEPT;
+       }
+}
+
+}
diff --git a/configure.ac b/configure.ac
index 95e44ac..66854b1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,6 +23,7 @@ AC_CONFIG_MACRO_DIR([m4])
 
 AC_PROG_CC
 AC_PROG_CXX
+AM_PROG_VALAC([0.18.0])
 AC_PROG_INTLTOOL([0.35.0])
 AM_PROG_LIBTOOL
 AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
@@ -450,6 +451,7 @@ fi
 if test "$enable_debug" = "yes"; then
        debug_status="yes (-g, -O0, debug output, testable)"
        CFLAGS="$CFLAGS -O0"
+       VALA_FLAGS="$VALA_FLAGS --debug"
 elif test "$enable_debug" = "no"; then
        debug_status="no (no debug output, not testable, G_DISABLE_ASSERT)"
        AC_DEFINE_UNQUOTED(G_DISABLE_ASSERT, 1, [Disable glib assertions])
@@ -540,9 +542,11 @@ AC_MSG_RESULT($enable_coverage)
 
 AC_SUBST(SEAHORSE_CFLAGS)
 AC_SUBST(SEAHORSE_LIBS)
+AC_SUBST(VALA_FLAGS)
 
 AC_OUTPUT([
 Makefile
+common/Makefile
 gkr/Makefile
 libegg/Makefile
 libseahorse/Makefile
diff --git a/gkr/Makefile.am b/gkr/Makefile.am
index 7c27549..14fb07e 100644
--- a/gkr/Makefile.am
+++ b/gkr/Makefile.am
@@ -6,6 +6,7 @@ seahorselibexecbindir = $(libdir)/seahorse/
 
 INCLUDES = -I$(top_builddir) \
        -I$(top_srcdir) \
+       -I$(top_srcdir)/common \
        -I$(top_srcdir)/libseahorse \
        $(SEAHORSE_CFLAGS) \
        -DSEAHORSE_UIDIR=\""$(uidir)/"\" \
@@ -31,6 +32,7 @@ libseahorse_gkr_la_SOURCES = \
        seahorse-gkr-keyring-properties.c
 
 libseahorse_gkr_la_LIBADD = \
+       $(top_builddir)/common/libcommon.la \
        $(top_builddir)/libseahorse/libseahorse.la
 
 ui_DATA = \
diff --git a/gkr/seahorse-gkr-item-deleter.c b/gkr/seahorse-gkr-item-deleter.c
index 03da1be..0edf19c 100644
--- a/gkr/seahorse-gkr-item-deleter.c
+++ b/gkr/seahorse-gkr-item-deleter.c
@@ -225,7 +225,7 @@ seahorse_gkr_item_deleter_class_init (SeahorseGkrItemDeleterClass *klass)
 
        deleter_class->add_object = seahorse_gkr_item_deleter_add_object;
        deleter_class->create_confirm = seahorse_gkr_item_deleter_create_confirm;
-       deleter_class->delete_async = seahorse_gkr_item_deleter_delete_async;
+       deleter_class->delete = seahorse_gkr_item_deleter_delete_async;
        deleter_class->delete_finish = seahorse_gkr_item_deleter_delete_finish;
        deleter_class->get_objects = seahorse_gkr_item_deleter_get_objects;
 }
diff --git a/gkr/seahorse-gkr-item-deleter.h b/gkr/seahorse-gkr-item-deleter.h
index 1d493ac..72939ac 100644
--- a/gkr/seahorse-gkr-item-deleter.h
+++ b/gkr/seahorse-gkr-item-deleter.h
@@ -26,7 +26,7 @@
 
 #include <glib-object.h>
 
-#include "seahorse-deleter.h"
+#include "seahorse-common.h"
 #include "seahorse-gkr-item.h"
 
 #define SEAHORSE_TYPE_GKR_ITEM_DELETER               (seahorse_gkr_item_deleter_get_type ())
diff --git a/gkr/seahorse-gkr-item.c b/gkr/seahorse-gkr-item.c
index d6f1594..927d49c 100644
--- a/gkr/seahorse-gkr-item.c
+++ b/gkr/seahorse-gkr-item.c
@@ -34,7 +34,7 @@
 #include "seahorse-gkr-item-deleter.h"
 #include "seahorse-gkr-keyring.h"
 
-#include "seahorse-deletable.h"
+#include "seahorse-common.h"
 #include "seahorse-icons.h"
 #include "seahorse-place.h"
 #include "seahorse-util.h"
@@ -754,10 +754,19 @@ seahorse_gkr_item_create_deleter (SeahorseDeletable *deletable)
        return seahorse_gkr_item_deleter_new (self);
 }
 
+static gboolean
+seahorse_gkr_item_get_deletable (SeahorseDeletable *deletable)
+{
+       gboolean can;
+       g_object_get (deletable, "deletable", &can, NULL);
+       return can;
+}
+
 static void
 seahorse_gkr_item_deletable_iface (SeahorseDeletableIface *iface)
 {
        iface->create_deleter = seahorse_gkr_item_create_deleter;
+       iface->get_deletable = seahorse_gkr_item_get_deletable;
 }
 
 static void
diff --git a/gkr/seahorse-gkr-keyring-deleter.c b/gkr/seahorse-gkr-keyring-deleter.c
index a14678d..026170f 100644
--- a/gkr/seahorse-gkr-keyring-deleter.c
+++ b/gkr/seahorse-gkr-keyring-deleter.c
@@ -120,16 +120,16 @@ on_delete_gkr_complete (GObject *source,
 }
 
 static void
-seahorse_gkr_keyring_deleter_delete_async (SeahorseDeleter *deleter,
-                                           GCancellable *cancellable,
-                                           GAsyncReadyCallback callback,
-                                           gpointer user_data)
+seahorse_gkr_keyring_deleter_delete (SeahorseDeleter *deleter,
+                                     GCancellable *cancellable,
+                                     GAsyncReadyCallback callback,
+                                     gpointer user_data)
 {
        SeahorseGkrKeyringDeleter *self = SEAHORSE_GKR_KEYRING_DELETER (deleter);
        GSimpleAsyncResult *res;
 
        res = g_simple_async_result_new (G_OBJECT (self), callback, user_data,
-                                        seahorse_gkr_keyring_deleter_delete_async);
+                                        seahorse_gkr_keyring_deleter_delete);
 
        secret_collection_delete (SECRET_COLLECTION (self->keyring),
                                  cancellable, on_delete_gkr_complete,
@@ -146,7 +146,7 @@ seahorse_gkr_keyring_deleter_delete_finish (SeahorseDeleter *deleter,
        SeahorseGkrKeyringDeleter *self = SEAHORSE_GKR_KEYRING_DELETER (deleter);
 
        g_return_val_if_fail (g_simple_async_result_is_valid (result, G_OBJECT (self),
-                             seahorse_gkr_keyring_deleter_delete_async), FALSE);
+                             seahorse_gkr_keyring_deleter_delete), FALSE);
 
        if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (result), error))
                return FALSE;
@@ -164,7 +164,7 @@ seahorse_gkr_keyring_deleter_class_init (SeahorseGkrKeyringDeleterClass *klass)
 
        deleter_class->add_object = seahorse_gkr_keyring_deleter_add_object;
        deleter_class->create_confirm = seahorse_gkr_keyring_deleter_create_confirm;
-       deleter_class->delete_async = seahorse_gkr_keyring_deleter_delete_async;
+       deleter_class->delete = seahorse_gkr_keyring_deleter_delete;
        deleter_class->delete_finish = seahorse_gkr_keyring_deleter_delete_finish;
        deleter_class->get_objects = seahorse_gkr_keyring_deleter_get_objects;
 }
diff --git a/gkr/seahorse-gkr-keyring-deleter.h b/gkr/seahorse-gkr-keyring-deleter.h
index 75c23d2..0a9eaaa 100644
--- a/gkr/seahorse-gkr-keyring-deleter.h
+++ b/gkr/seahorse-gkr-keyring-deleter.h
@@ -26,7 +26,7 @@
 
 #include <glib-object.h>
 
-#include "seahorse-deleter.h"
+#include "seahorse-common.h"
 #include "seahorse-gkr-keyring.h"
 
 #define SEAHORSE_TYPE_GKR_KEYRING_DELETER               (seahorse_gkr_keyring_deleter_get_type ())
diff --git a/gkr/seahorse-gkr-keyring.c b/gkr/seahorse-gkr-keyring.c
index 551a777..1e89c17 100644
--- a/gkr/seahorse-gkr-keyring.c
+++ b/gkr/seahorse-gkr-keyring.c
@@ -30,7 +30,7 @@
 #include "seahorse-gkr-actions.h"
 
 #include "seahorse-action.h"
-#include "seahorse-deletable.h"
+#include "seahorse-common.h"
 #include "seahorse-lockable.h"
 #include "seahorse-progress.h"
 #include "seahorse-util.h"
@@ -315,10 +315,20 @@ seahorse_gkr_keyring_create_deleter (SeahorseDeletable *deletable)
        return seahorse_gkr_keyring_deleter_new (self);
 }
 
+static gboolean
+seahorse_gkr_keyring_get_deletable (SeahorseDeletable *deletable)
+{
+       gboolean can;
+       g_object_get (deletable, "deletable", &can, NULL);
+       return can;
+}
+
+
 static void
 seahorse_keyring_deletable_iface (SeahorseDeletableIface *iface)
 {
        iface->create_deleter = seahorse_gkr_keyring_create_deleter;
+       iface->get_deletable = seahorse_gkr_keyring_get_deletable;
 }
 
 static void
diff --git a/libseahorse/Makefile.am b/libseahorse/Makefile.am
index 400d248..aac362c 100644
--- a/libseahorse/Makefile.am
+++ b/libseahorse/Makefile.am
@@ -5,6 +5,7 @@ seahorselibexecbindir = $(libdir)/seahorse/
 
 INCLUDES = -I$(top_builddir) \
        -I$(top_srcdir) \
+       -I$(top_srcdir)/common \
        -I$(top_srcdir)/libegg \
        $(SEAHORSE_CFLAGS) \
        -DPKGDATADIR=\""$(pkgdatadir)/"\" \
@@ -52,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-deletable.c seahorse-deletable.h \
-       seahorse-deleter.c seahorse-deleter.h \
        seahorse-exportable.c seahorse-exportable.h \
        seahorse-exporter.c seahorse-exporter.h \
        seahorse-icons.c seahorse-icons.h \
@@ -81,6 +80,9 @@ libseahorse_la_SOURCES = \
        $(MARSHAL_SRCS) \
        $(KEYSERVER_SRCS)
 
+libseahorse_la_LIBADD = \
+       $(top_builddir)/common/libcommon.la
+
 seahorse-marshal.h: seahorse-marshal.list $(GLIB_GENMARSHAL)
        $(GLIB_GENMARSHAL) $< --header --prefix=seahorse_marshal > $@
 
diff --git a/libseahorse/seahorse-catalog.c b/libseahorse/seahorse-catalog.c
index df00dc3..f384044 100644
--- a/libseahorse/seahorse-catalog.c
+++ b/libseahorse/seahorse-catalog.c
@@ -26,7 +26,7 @@
 #include "seahorse-actions.h"
 #include "seahorse-backend.h"
 #include "seahorse-catalog.h"
-#include "seahorse-deletable.h"
+#include "seahorse-common.h"
 #include "seahorse-exportable.h"
 #include "seahorse-object.h"
 #include "seahorse-prefs.h"
diff --git a/pgp/Makefile.am b/pgp/Makefile.am
index b1ddb75..65390a2 100644
--- a/pgp/Makefile.am
+++ b/pgp/Makefile.am
@@ -6,6 +6,7 @@ seahorselibexecbindir = $(libdir)/seahorse/
 INCLUDES = -I$(top_builddir) \
        -I$(top_srcdir) \
        -I$(top_srcdir)/libegg \
+       -I$(top_srcdir)/common \
        -I$(top_srcdir)/libseahorse \
        $(SEAHORSE_CFLAGS) \
        -DSEAHORSE_UIDIR=\""$(uidir)"\" \
@@ -81,6 +82,7 @@ libseahorse_pgp_la_SOURCES = \
        $(HKP_SRCS)
 
 libseahorse_pgp_la_LIBADD = \
+       $(top_builddir)/common/libcommon.la \
        $(top_builddir)/libseahorse/libseahorse.la
 
 seahorselibexecbin_PROGRAMS = xloadimage
diff --git a/pgp/seahorse-gpgme-key-deleter.c b/pgp/seahorse-gpgme-key-deleter.c
index e8fb497..57b46c0 100644
--- a/pgp/seahorse-gpgme-key-deleter.c
+++ b/pgp/seahorse-gpgme-key-deleter.c
@@ -163,7 +163,7 @@ seahorse_gpgme_key_deleter_class_init (SeahorseGpgmeKeyDeleterClass *klass)
 
        deleter_class->add_object = seahorse_gpgme_key_deleter_add_object;
        deleter_class->create_confirm = seahorse_gpgme_key_deleter_create_confirm;
-       deleter_class->delete_async = seahorse_gpgme_key_deleter_delete_async;
+       deleter_class->delete = seahorse_gpgme_key_deleter_delete_async;
        deleter_class->delete_finish = seahorse_gpgme_key_deleter_delete_finish;
        deleter_class->get_objects = seahorse_gpgme_key_deleter_get_objects;
 }
diff --git a/pgp/seahorse-gpgme-key-deleter.h b/pgp/seahorse-gpgme-key-deleter.h
index 2dce664..929479a 100644
--- a/pgp/seahorse-gpgme-key-deleter.h
+++ b/pgp/seahorse-gpgme-key-deleter.h
@@ -26,7 +26,7 @@
 
 #include <glib-object.h>
 
-#include "seahorse-deleter.h"
+#include "seahorse-common.h"
 #include "seahorse-gpgme-key.h"
 
 #define SEAHORSE_TYPE_GPGME_KEY_DELETER       (seahorse_gpgme_key_deleter_get_type ())
diff --git a/pgp/seahorse-gpgme-key.c b/pgp/seahorse-gpgme-key.c
index 466c8b4..00f9c3c 100644
--- a/pgp/seahorse-gpgme-key.c
+++ b/pgp/seahorse-gpgme-key.c
@@ -33,7 +33,7 @@
 #include "seahorse-pgp-backend.h"
 #include "seahorse-pgp-key.h"
 
-#include "seahorse-deletable.h"
+#include "seahorse-common.h"
 #include "seahorse-exportable.h"
 #include "seahorse-icons.h"
 #include "seahorse-predicate.h"
@@ -566,10 +566,19 @@ seahorse_gpgme_key_create_deleter (SeahorseDeletable *deletable)
                return seahorse_gpgme_key_deleter_new (self);
 }
 
+static gboolean
+seahorse_gpgme_key_get_deletable (SeahorseDeletable *deletable)
+{
+       gboolean can;
+       g_object_get (deletable, "deletable", &can, NULL);
+       return can;
+}
+
 static void
 seahorse_gpgme_key_deletable_iface (SeahorseDeletableIface *iface)
 {
        iface->create_deleter = seahorse_gpgme_key_create_deleter;
+       iface->get_deletable = seahorse_gpgme_key_get_deletable;
 }
 
 static GList *
diff --git a/pgp/seahorse-gpgme-secret-deleter.c b/pgp/seahorse-gpgme-secret-deleter.c
index 4b2a4ea..48b75c1 100644
--- a/pgp/seahorse-gpgme-secret-deleter.c
+++ b/pgp/seahorse-gpgme-secret-deleter.c
@@ -159,7 +159,7 @@ seahorse_gpgme_secret_deleter_class_init (SeahorseGpgmeSecretDeleterClass *klass
 
        deleter_class->add_object = seahorse_gpgme_secret_deleter_add_object;
        deleter_class->create_confirm = seahorse_gpgme_secret_deleter_create_confirm;
-       deleter_class->delete_async = seahorse_gpgme_secret_deleter_delete_async;
+       deleter_class->delete = seahorse_gpgme_secret_deleter_delete_async;
        deleter_class->delete_finish = seahorse_gpgme_secret_deleter_delete_finish;
        deleter_class->get_objects = seahorse_gpgme_secret_deleter_get_objects;
 }
diff --git a/pgp/seahorse-gpgme-secret-deleter.h b/pgp/seahorse-gpgme-secret-deleter.h
index 766010a..27d42bb 100644
--- a/pgp/seahorse-gpgme-secret-deleter.h
+++ b/pgp/seahorse-gpgme-secret-deleter.h
@@ -26,7 +26,7 @@
 
 #include <glib-object.h>
 
-#include "seahorse-deleter.h"
+#include "seahorse-common.h"
 #include "seahorse-gpgme-key.h"
 
 #define SEAHORSE_TYPE_GPGME_SECRET_DELETER       (seahorse_gpgme_secret_deleter_get_type ())
diff --git a/pkcs11/Makefile.am b/pkcs11/Makefile.am
index 909cd77..6ea55a9 100644
--- a/pkcs11/Makefile.am
+++ b/pkcs11/Makefile.am
@@ -5,6 +5,7 @@ seahorselibexecbindir = $(libdir)/seahorse/
 
 INCLUDES = -I$(top_builddir) \
        -I$(top_srcdir) \
+       -I$(top_srcdir)/common \
        -I$(top_srcdir)/libseahorse \
        $(SEAHORSE_CFLAGS) \
        -DSEAHORSE_UIDIR=\""$(uidir)"\" \
@@ -29,6 +30,7 @@ libseahorse_pkcs11_la_SOURCES = \
        seahorse-token.c seahorse-token.h
 
 libseahorse_pkcs11_la_LIBADD = \
+       $(top_builddir)/common/libcommon.la \
        $(top_builddir)/libseahorse/libseahorse.la \
        $(GCR_LIBS)
 
diff --git a/pkcs11/seahorse-certificate.c b/pkcs11/seahorse-certificate.c
index f7b8645..f6b3290 100644
--- a/pkcs11/seahorse-certificate.c
+++ b/pkcs11/seahorse-certificate.c
@@ -32,7 +32,7 @@
 #include "seahorse-token.h"
 #include "seahorse-types.h"
 
-#include "seahorse-deletable.h"
+#include "seahorse-common.h"
 #include "seahorse-exportable.h"
 #include "seahorse-util.h"
 #include "seahorse-validity.h"
@@ -392,10 +392,19 @@ seahorse_certificate_create_deleter (SeahorseDeletable *deletable)
        return deleter;
 }
 
+static gboolean
+seahorse_certificate_get_deletable (SeahorseDeletable *deletable)
+{
+       gboolean can;
+       g_object_get (deletable, "deletable", &can, NULL);
+       return can;
+}
+
 static void
 seahorse_certificate_deletable_iface (SeahorseDeletableIface *iface)
 {
        iface->create_deleter = seahorse_certificate_create_deleter;
+       iface->get_deletable = seahorse_certificate_get_deletable;
 }
 
 static void
diff --git a/pkcs11/seahorse-pkcs11-deleter.c b/pkcs11/seahorse-pkcs11-deleter.c
index 3181151..549c82e 100644
--- a/pkcs11/seahorse-pkcs11-deleter.c
+++ b/pkcs11/seahorse-pkcs11-deleter.c
@@ -217,7 +217,7 @@ seahorse_pkcs11_deleter_class_init (SeahorsePkcs11DeleterClass *klass)
 
        deleter_class->add_object = seahorse_pkcs11_deleter_add_object;
        deleter_class->create_confirm = seahorse_pkcs11_deleter_create_confirm;
-       deleter_class->delete_async = seahorse_pkcs11_deleter_delete_async;
+       deleter_class->delete = seahorse_pkcs11_deleter_delete_async;
        deleter_class->delete_finish = seahorse_pkcs11_deleter_delete_finish;
        deleter_class->get_objects = seahorse_pkcs11_deleter_get_objects;
 }
diff --git a/pkcs11/seahorse-pkcs11-deleter.h b/pkcs11/seahorse-pkcs11-deleter.h
index bdb6b81..86bd9a0 100644
--- a/pkcs11/seahorse-pkcs11-deleter.h
+++ b/pkcs11/seahorse-pkcs11-deleter.h
@@ -26,7 +26,7 @@
 
 #include <glib-object.h>
 
-#include "seahorse-deleter.h"
+#include "seahorse-common.h"
 #include "seahorse-certificate.h"
 
 #define SEAHORSE_TYPE_PKCS11_DELETER       (seahorse_pkcs11_deleter_get_type ())
diff --git a/pkcs11/seahorse-pkcs11-key-deleter.h b/pkcs11/seahorse-pkcs11-key-deleter.h
index e93308c..27b004c 100644
--- a/pkcs11/seahorse-pkcs11-key-deleter.h
+++ b/pkcs11/seahorse-pkcs11-key-deleter.h
@@ -26,7 +26,7 @@
 
 #include <glib-object.h>
 
-#include "seahorse-deleter.h"
+#include "seahorse-common.h"
 #include "seahorse-certificate.h"
 
 #define SEAHORSE_TYPE_PKCS11_KEY_DELETER       (seahorse_pkcs11_key_deleter_get_type ())
diff --git a/pkcs11/seahorse-pkcs11-properties.c b/pkcs11/seahorse-pkcs11-properties.c
index 6dec566..4593dfa 100644
--- a/pkcs11/seahorse-pkcs11-properties.c
+++ b/pkcs11/seahorse-pkcs11-properties.c
@@ -29,7 +29,7 @@
 #include "seahorse-private-key.h"
 
 #include "seahorse-action.h"
-#include "seahorse-deleter.h"
+#include "seahorse-common.h"
 #include "seahorse-exportable.h"
 #include "seahorse-progress.h"
 #include "seahorse-util.h"
@@ -211,7 +211,7 @@ on_delete_objects (GtkAction *action,
        }
 
        if (seahorse_deleter_prompt (deleter, GTK_WINDOW (self))) {
-               seahorse_deleter_delete_async (deleter, NULL, on_delete_complete, g_object_ref (self));
+               seahorse_deleter_delete (deleter, NULL, on_delete_complete, g_object_ref (self));
        }
 
        g_object_unref (deleter);
diff --git a/pkcs11/seahorse-private-key.c b/pkcs11/seahorse-private-key.c
index 69b5dd6..5f51ac9 100644
--- a/pkcs11/seahorse-private-key.c
+++ b/pkcs11/seahorse-private-key.c
@@ -30,7 +30,7 @@
 #include "seahorse-token.h"
 #include "seahorse-types.h"
 
-#include "seahorse-deletable.h"
+#include "seahorse-common.h"
 #include "seahorse-exportable.h"
 #include "seahorse-util.h"
 #include "seahorse-viewable.h"
@@ -302,10 +302,19 @@ seahorse_private_key_create_deleter (SeahorseDeletable *deletable)
        return seahorse_pkcs11_key_deleter_new (G_OBJECT (self));
 }
 
+static gboolean
+seahorse_private_key_get_deletable (SeahorseDeletable *deletable)
+{
+       gboolean can;
+       g_object_get (deletable, "deletable", &can, NULL);
+       return can;
+}
+
 static void
 seahorse_private_key_deletable_iface (SeahorseDeletableIface *iface)
 {
        iface->create_deleter = seahorse_private_key_create_deleter;
+       iface->get_deletable = seahorse_private_key_get_deletable;
 }
 
 static GList *
diff --git a/src/Makefile.am b/src/Makefile.am
index b83df82..fec9779 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -5,6 +5,7 @@ localedir = $(datadir)/locale
 
 INCLUDES = -I$(top_builddir) \
        -I$(top_srcdir) \
+       -I$(top_srcdir)/common \
        -I$(top_srcdir)/libseahorse \
        $(SEAHORSE_CFLAGS) \
        -DSEAHORSE_UIDIR=\""$(uidir)"\" \
@@ -40,6 +41,7 @@ seahorse_SOURCES = \
        $(KEYSERVER_SRCS)
 
 seahorse_LDADD = \
+       $(top_builddir)/common/libcommon.la \
        $(top_builddir)/libseahorse/libseahorse.la \
        $(PGP_LDADD) \
        $(SSH_LDADD) \
diff --git a/src/seahorse-sidebar.c b/src/seahorse-sidebar.c
index b6ab359..e332db7 100644
--- a/src/seahorse-sidebar.c
+++ b/src/seahorse-sidebar.c
@@ -26,7 +26,7 @@
 #include "seahorse-action.h"
 #include "seahorse-actions.h"
 #include "seahorse-backend.h"
-#include "seahorse-deletable.h"
+#include "seahorse-common.h"
 #include "seahorse-interaction.h"
 #include "seahorse-lockable.h"
 #include "seahorse-place.h"
@@ -898,8 +898,8 @@ on_place_delete (GtkMenuItem *item,
        deleter = seahorse_deletable_create_deleter (deletable);
 
        if (seahorse_deleter_prompt (deleter, GTK_WINDOW (window)))
-               seahorse_deleter_delete_async (deleter, NULL, on_place_deleted,
-                                              g_object_ref (window));
+               seahorse_deleter_delete (deleter, NULL, on_place_deleted,
+                                        g_object_ref (window));
 
        g_object_unref (deleter);
 }
diff --git a/ssh/Makefile.am b/ssh/Makefile.am
index f2e6921..8a915a6 100644
--- a/ssh/Makefile.am
+++ b/ssh/Makefile.am
@@ -5,6 +5,7 @@ seahorselibexecbindir = $(libdir)/seahorse/
 
 INCLUDES = -I$(top_builddir) \
        -I$(top_srcdir) \
+       -I$(top_srcdir)/common \
        -I$(top_srcdir)/libseahorse \
        $(SEAHORSE_CFLAGS) \
        -DSEAHORSE_UIDIR=\""$(uidir)"\" \
@@ -32,6 +33,7 @@ libseahorse_ssh_la_SOURCES = \
        seahorse-ssh-upload.c
 
 libseahorse_ssh_la_LIBADD = \
+       $(top_builddir)/common/libcommon.la \
        $(top_builddir)/libseahorse/libseahorse.la
 
 seahorselibexecbin_PROGRAMS = seahorse-ssh-askpass
diff --git a/ssh/seahorse-ssh-deleter.c b/ssh/seahorse-ssh-deleter.c
index 8eeeef8..4568fa4 100644
--- a/ssh/seahorse-ssh-deleter.c
+++ b/ssh/seahorse-ssh-deleter.c
@@ -187,7 +187,7 @@ seahorse_ssh_deleter_class_init (SeahorseSshDeleterClass *klass)
 
        deleter_class->add_object = seahorse_ssh_deleter_add_object;
        deleter_class->create_confirm = seahorse_ssh_deleter_create_confirm;
-       deleter_class->delete_async = seahorse_ssh_deleter_delete_async;
+       deleter_class->delete = seahorse_ssh_deleter_delete_async;
        deleter_class->delete_finish = seahorse_ssh_deleter_delete_finish;
        deleter_class->get_objects = seahorse_ssh_deleter_get_objects;
 }
diff --git a/ssh/seahorse-ssh-deleter.h b/ssh/seahorse-ssh-deleter.h
index 70d29e8..ef4f0c2 100644
--- a/ssh/seahorse-ssh-deleter.h
+++ b/ssh/seahorse-ssh-deleter.h
@@ -26,7 +26,7 @@
 
 #include <glib-object.h>
 
-#include "seahorse-deleter.h"
+#include "seahorse-common.h"
 #include "seahorse-ssh-key.h"
 
 #define SEAHORSE_TYPE_SSH_DELETER       (seahorse_ssh_deleter_get_type ())
diff --git a/ssh/seahorse-ssh-key.c b/ssh/seahorse-ssh-key.c
index 4a37435..7f26ae7 100644
--- a/ssh/seahorse-ssh-key.c
+++ b/ssh/seahorse-ssh-key.c
@@ -30,7 +30,7 @@
 #include "seahorse-ssh-operation.h"
 #include "seahorse-ssh-source.h"
 
-#include "seahorse-deletable.h"
+#include "seahorse-common.h"
 #include "seahorse-exportable.h"
 #include "seahorse-icons.h"
 #include "seahorse-place.h"
@@ -330,10 +330,19 @@ seahorse_ssh_key_create_deleter (SeahorseDeletable *deletable)
        return seahorse_ssh_deleter_new (self);
 }
 
+static gboolean
+seahorse_ssh_key_get_deletable (SeahorseDeletable *deletable)
+{
+       gboolean can;
+       g_object_get (deletable, "deletable", &can, NULL);
+       return can;
+}
+
 static void
 seahorse_ssh_key_deletable_iface (SeahorseDeletableIface *iface)
 {
        iface->create_deleter = seahorse_ssh_key_create_deleter;
+       iface->get_deletable = seahorse_ssh_key_get_deletable;
 }
 
 static void


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