seahorse r2307 - in trunk: . gkr libseahorse pgp pkcs11 src ssh
- From: nnielsen svn gnome org
- To: svn-commits-list gnome org
- Subject: seahorse r2307 - in trunk: . gkr libseahorse pgp pkcs11 src ssh
- Date: Sun, 27 Jul 2008 16:00:34 +0000 (UTC)
Author: nnielsen
Date: Sun Jul 27 16:00:34 2008
New Revision: 2307
URL: http://svn.gnome.org/viewvc/seahorse?rev=2307&view=rev
Log:
* gkr/seahorse-gkeyring-operation.c:
* gkr/seahorse-gkeyring-source.c:
* gkr/seahorse-gkr-commands.vala:
* libseahorse/libseahorse-c.vapi:
* libseahorse/seahorse-commands.vala:
* libseahorse/seahorse-operation.h:
* libseahorse/seahorse-source.c:
* libseahorse/seahorse-source.h:
* libseahorse/seahorse-transfer-operation.c:
* libseahorse/seahorse-unknown-source.c:
* libseahorse/seahorse-util.c:
* libseahorse/seahorse-util.h:
* pgp/Makefile.am:
* pgp/seahorse-hkp-source.c:
* pgp/seahorse-ldap-source.c:
* pgp/seahorse-pgp-commands.vala:
* pgp/seahorse-pgp-delete.c: (removed)
* pgp/seahorse-pgp-dialogs.h:
* pgp/seahorse-pgp-key.c:
* pgp/seahorse-pgp-key-properties.c:
* pgp/seahorse-pgp-operation.c:
* pgp/seahorse-pgp-source.c:
* src/seahorse-viewer.vala:
* ssh/seahorse-delete.c: (removed)
* ssh/seahorse-ssh-commands.vala:
* ssh/seahorse-ssh-operation.c:
* ssh/seahorse-ssh-source.c: Refactor the delete code so it
returns proper operations and handles identities properly.
Removed:
trunk/pgp/seahorse-pgp-delete.c
trunk/ssh/seahorse-delete.c
Modified:
trunk/ChangeLog
trunk/gkr/seahorse-gkeyring-operation.c
trunk/gkr/seahorse-gkeyring-source.c
trunk/gkr/seahorse-gkr-commands.c
trunk/gkr/seahorse-gkr-commands.h
trunk/gkr/seahorse-gkr-commands.vala
trunk/gkr/vala-build.stamp
trunk/libseahorse/libseahorse-c.vapi
trunk/libseahorse/libseahorse.gidl
trunk/libseahorse/libseahorse.vapi
trunk/libseahorse/seahorse-commands.c
trunk/libseahorse/seahorse-commands.h
trunk/libseahorse/seahorse-commands.vala
trunk/libseahorse/seahorse-operation.h
trunk/libseahorse/seahorse-source.c
trunk/libseahorse/seahorse-source.h
trunk/libseahorse/seahorse-transfer-operation.c
trunk/libseahorse/seahorse-unknown-source.c
trunk/libseahorse/seahorse-util.c
trunk/libseahorse/seahorse-util.h
trunk/libseahorse/vala-build.stamp
trunk/pgp/Makefile.am
trunk/pgp/seahorse-hkp-source.c
trunk/pgp/seahorse-ldap-source.c
trunk/pgp/seahorse-pgp-commands.c
trunk/pgp/seahorse-pgp-commands.h
trunk/pgp/seahorse-pgp-commands.vala
trunk/pgp/seahorse-pgp-dialogs.h
trunk/pgp/seahorse-pgp-key-properties.c
trunk/pgp/seahorse-pgp-key.c
trunk/pgp/seahorse-pgp-operation.c
trunk/pgp/seahorse-pgp-source.c
trunk/pgp/vala-build.stamp
trunk/pkcs11/ (props changed)
trunk/pkcs11/vala-build.stamp
trunk/src/seahorse-key-manager.c
trunk/src/seahorse-viewer.c
trunk/src/seahorse-viewer.vala
trunk/src/vala-build.stamp
trunk/ssh/Makefile.am
trunk/ssh/seahorse-ssh-commands.c
trunk/ssh/seahorse-ssh-commands.h
trunk/ssh/seahorse-ssh-commands.vala
trunk/ssh/seahorse-ssh-operation.c
trunk/ssh/seahorse-ssh-source.c
trunk/ssh/vala-build.stamp
Modified: trunk/gkr/seahorse-gkeyring-operation.c
==============================================================================
--- trunk/gkr/seahorse-gkeyring-operation.c (original)
+++ trunk/gkr/seahorse-gkeyring-operation.c Sun Jul 27 16:00:34 2008
@@ -154,7 +154,7 @@
/* The above cancel should have stopped this */
g_assert (pv->request == NULL);
- G_OBJECT_CLASS (operation_parent_class)->dispose (gobject);
+ G_OBJECT_CLASS (gkeyring_operation_parent_class)->dispose (gobject);
}
static void
@@ -166,7 +166,7 @@
g_assert (!gop->gsrc);
g_assert (!pv->request);
- G_OBJECT_CLASS (operation_parent_class)->finalize (gobject);
+ G_OBJECT_CLASS (gkeyring_operation_parent_class)->finalize (gobject);
}
static void
Modified: trunk/gkr/seahorse-gkeyring-source.c
==============================================================================
--- trunk/gkr/seahorse-gkeyring-source.c (original)
+++ trunk/gkr/seahorse-gkeyring-source.c Sun Jul 27 16:00:34 2008
@@ -445,7 +445,7 @@
/* The above cancel should have stopped this */
g_assert (lop->request == NULL);
- G_OBJECT_CLASS (operation_parent_class)->dispose (gobject);
+ G_OBJECT_CLASS (list_operation_parent_class)->dispose (gobject);
}
static void
@@ -475,7 +475,7 @@
/* The above cancel should have stopped this */
g_assert (lop->request == NULL);
- G_OBJECT_CLASS (operation_parent_class)->finalize (gobject);
+ G_OBJECT_CLASS (list_operation_parent_class)->finalize (gobject);
}
static void
@@ -492,6 +492,131 @@
}
/* -----------------------------------------------------------------------------
+ * REMOVE OPERATION
+ */
+
+#define SEAHORSE_TYPE_REMOVE_OPERATION (seahorse_remove_operation_get_type ())
+#define SEAHORSE_REMOVE_OPERATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SEAHORSE_TYPE_REMOVE_OPERATION, SeahorseRemoveOperation))
+#define SEAHORSE_REMOVE_OPERATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SEAHORSE_TYPE_REMOVE_OPERATION, SeahorseRemoveOperationClass))
+#define SEAHORSE_IS_REMOVE_OPERATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SEAHORSE_TYPE_REMOVE_OPERATION))
+#define SEAHORSE_IS_REMOVE_OPERATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SEAHORSE_TYPE_REMOVE_OPERATION))
+#define SEAHORSE_REMOVE_OPERATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SEAHORSE_TYPE_REMOVE_OPERATION, SeahorseRemoveOperationClass))
+
+DECLARE_OPERATION (Remove, remove)
+
+ SeahorseGKeyringSource *gsrc;
+ SeahorseGKeyringItem *gitem;
+ gpointer request;
+
+END_DECLARE_OPERATION
+
+IMPLEMENT_OPERATION (Remove, remove)
+
+static void
+remove_item_ready (GnomeKeyringResult result, SeahorseRemoveOperation *rop)
+{
+ GError *err = NULL;
+ if (result == GNOME_KEYRING_RESULT_CANCELLED)
+ return;
+
+ rop->request = NULL;
+
+ if (result != GNOME_KEYRING_RESULT_OK) {
+ if (seahorse_operation_is_running (SEAHORSE_OPERATION (rop))) {
+ seahorse_gkeyring_operation_parse_error (result, &err);
+ g_assert (err != NULL);
+ seahorse_operation_mark_done (SEAHORSE_OPERATION (rop), FALSE, err);
+ }
+ return;
+ }
+
+ seahorse_context_remove_object (SCTX_APP (), SEAHORSE_OBJECT (rop->gitem));
+ seahorse_operation_mark_done (SEAHORSE_OPERATION (rop), FALSE, NULL);
+}
+
+static SeahorseRemoveOperation*
+start_remove_operation (SeahorseGKeyringSource *gsrc, SeahorseGKeyringItem *gitem)
+{
+ SeahorseRemoveOperation *rop;
+
+ g_assert (SEAHORSE_IS_GKEYRING_SOURCE (gsrc));
+ g_assert (SEAHORSE_IS_GKEYRING_ITEM (gitem));
+
+ rop = g_object_new (SEAHORSE_TYPE_REMOVE_OPERATION, NULL);
+ rop->gsrc = gsrc;
+ g_object_ref (gsrc);
+ rop->gitem = gitem;
+ g_object_ref (gitem);
+
+ seahorse_operation_mark_start (SEAHORSE_OPERATION (rop));
+
+ /* Start listing of ids */
+ seahorse_operation_mark_progress (SEAHORSE_OPERATION (rop), _("Removing item"), -1);
+ rop->request = gnome_keyring_item_delete (gsrc->pv->keyring_name, gitem->item_id,
+ (GnomeKeyringOperationDoneCallback)remove_item_ready, rop, NULL);
+
+ return rop;
+}
+
+static void
+seahorse_remove_operation_init (SeahorseRemoveOperation *rop)
+{
+ /* Everything already set to zero */
+}
+
+static void
+seahorse_remove_operation_dispose (GObject *gobject)
+{
+ SeahorseRemoveOperation *rop = SEAHORSE_REMOVE_OPERATION (gobject);
+
+ /* Cancel it if it's still running */
+ if (seahorse_operation_is_running (SEAHORSE_OPERATION (rop)))
+ seahorse_remove_operation_cancel (SEAHORSE_OPERATION (rop));
+ g_assert (!seahorse_operation_is_running (SEAHORSE_OPERATION (rop)));
+
+ /* The above cancel should have stopped this */
+ g_assert (rop->request == NULL);
+
+ if (rop->gsrc)
+ g_object_unref (rop->gsrc);
+ rop->gsrc = NULL;
+
+ if (rop->gitem)
+ g_object_unref (rop->gitem);
+ rop->gitem = NULL;
+
+ G_OBJECT_CLASS (remove_operation_parent_class)->dispose (gobject);
+}
+
+static void
+seahorse_remove_operation_finalize (GObject *gobject)
+{
+ SeahorseRemoveOperation *rop = SEAHORSE_REMOVE_OPERATION (gobject);
+ g_assert (!seahorse_operation_is_running (SEAHORSE_OPERATION (rop)));
+
+ g_assert (rop->gsrc == NULL);
+ g_assert (rop->gitem == NULL);
+
+ /* The above cancel should have stopped this */
+ g_assert (rop->request == NULL);
+
+ G_OBJECT_CLASS (remove_operation_parent_class)->finalize (gobject);
+}
+
+static void
+seahorse_remove_operation_cancel (SeahorseOperation *operation)
+{
+ SeahorseRemoveOperation *rop = SEAHORSE_REMOVE_OPERATION (operation);
+
+ if (rop->request)
+ gnome_keyring_cancel_request (rop->request);
+ rop->request = NULL;
+
+ if (seahorse_operation_is_running (operation))
+ seahorse_operation_mark_done (operation, TRUE, NULL);
+}
+
+/* -----------------------------------------------------------------------------
* INTERNAL
*/
@@ -614,14 +739,11 @@
return seahorse_operation_new_complete (err);
}
-static gboolean
-seahorse_gkeyring_source_remove (SeahorseSource *sksrc, SeahorseObject *sobj,
- guint name, GError **err)
+static SeahorseOperation*
+seahorse_gkeyring_source_remove (SeahorseSource *sksrc, SeahorseObject *sobj)
{
SeahorseGKeyringItem *git;
SeahorseGKeyringSource *gsrc;
- GnomeKeyringResult res;
- gboolean ret;
g_return_val_if_fail (SEAHORSE_IS_GKEYRING_ITEM (sobj), FALSE);
git = SEAHORSE_GKEYRING_ITEM (sobj);
@@ -629,18 +751,7 @@
g_return_val_if_fail (SEAHORSE_IS_GKEYRING_SOURCE (sksrc), FALSE);
gsrc = SEAHORSE_GKEYRING_SOURCE (sksrc);
- /* Don't have multiple names */
- g_return_val_if_fail (name == 0, FALSE);
-
- res = gnome_keyring_item_delete_sync (gsrc->pv->keyring_name, git->item_id);
- ret = seahorse_gkeyring_operation_parse_error (res, err);
-
- if (ret) {
- seahorse_context_remove_object (SCTX_APP (), sobj);
- seahorse_source_load_async (sksrc, 0);
- }
-
- return ret;
+ return SEAHORSE_OPERATION (start_remove_operation (gsrc, git));
}
static void
Modified: trunk/gkr/seahorse-gkr-commands.c
==============================================================================
--- trunk/gkr/seahorse-gkr-commands.c (original)
+++ trunk/gkr/seahorse-gkr-commands.c Sun Jul 27 16:00:34 2008
@@ -44,7 +44,7 @@
SEAHORSE_GKEYRING_COMMANDS_COMMAND_ACTIONS
};
static void seahorse_gkeyring_commands_real_show_properties (SeahorseCommands* base, SeahorseObject* key);
-static void seahorse_gkeyring_commands_real_delete_objects (SeahorseCommands* base, GList* keys, GError** error);
+static SeahorseOperation* seahorse_gkeyring_commands_real_delete_objects (SeahorseCommands* base, GList* keys);
static gpointer seahorse_gkeyring_commands_parent_class = NULL;
static void seahorse_gkeyring_commands_dispose (GObject * obj);
@@ -59,37 +59,34 @@
}
-static void seahorse_gkeyring_commands_real_delete_objects (SeahorseCommands* base, GList* keys, GError** error) {
+static SeahorseOperation* seahorse_gkeyring_commands_real_delete_objects (SeahorseCommands* base, GList* keys) {
SeahorseGKeyringCommands * self;
- GError * inner_error;
guint num;
char* prompt;
+ SeahorseOperation* _tmp4;
self = SEAHORSE_GKEYRING_COMMANDS (base);
- g_return_if_fail (keys != NULL);
- inner_error = NULL;
+ g_return_val_if_fail (keys != NULL, NULL);
num = g_list_length (keys);
if (num == 0) {
- return;
+ return NULL;
}
prompt = NULL;
if (num == 1) {
- char* _tmp0;
- _tmp0 = NULL;
- prompt = (_tmp0 = g_strdup_printf (_ ("Are you sure you want to delete the password '%s'?"), seahorse_object_get_display_name (((SeahorseObject*) (((SeahorseObject*) (keys->data)))))), (prompt = (g_free (prompt), NULL)), _tmp0);
- } else {
char* _tmp1;
_tmp1 = NULL;
- prompt = (_tmp1 = g_strdup_printf (_ ("Are you sure you want to delete %d passwords?"), num), (prompt = (g_free (prompt), NULL)), _tmp1);
- }
- if (seahorse_util_prompt_delete (prompt)) {
- seahorse_source_delete_objects (keys, &inner_error);
- if (inner_error != NULL) {
- g_propagate_error (error, inner_error);
- prompt = (g_free (prompt), NULL);
- return;
- }
+ prompt = (_tmp1 = g_strdup_printf (_ ("Are you sure you want to delete the password '%s'?"), seahorse_object_get_display_name (((SeahorseObject*) (((SeahorseObject*) (keys->data)))))), (prompt = (g_free (prompt), NULL)), _tmp1);
+ } else {
+ char* _tmp2;
+ _tmp2 = NULL;
+ prompt = (_tmp2 = g_strdup_printf (_ ("Are you sure you want to delete %d passwords?"), num), (prompt = (g_free (prompt), NULL)), _tmp2);
+ }
+ if (!seahorse_util_prompt_delete (prompt, GTK_WIDGET (seahorse_view_get_window (seahorse_commands_get_view (SEAHORSE_COMMANDS (self)))))) {
+ SeahorseOperation* _tmp3;
+ _tmp3 = NULL;
+ return (_tmp3 = NULL, (prompt = (g_free (prompt), NULL)), _tmp3);
}
- prompt = (g_free (prompt), NULL);
+ _tmp4 = NULL;
+ return (_tmp4 = seahorse_source_delete_objects (keys), (prompt = (g_free (prompt), NULL)), _tmp4);
}
Modified: trunk/gkr/seahorse-gkr-commands.h
==============================================================================
--- trunk/gkr/seahorse-gkr-commands.h (original)
+++ trunk/gkr/seahorse-gkr-commands.h Sun Jul 27 16:00:34 2008
@@ -26,6 +26,7 @@
#include <glib-object.h>
#include <seahorse-commands.h>
#include <seahorse-object.h>
+#include <seahorse-operation.h>
#include <stdlib.h>
#include <string.h>
#include <gtk/gtk.h>
Modified: trunk/gkr/seahorse-gkr-commands.vala
==============================================================================
--- trunk/gkr/seahorse-gkr-commands.vala (original)
+++ trunk/gkr/seahorse-gkr-commands.vala Sun Jul 27 16:00:34 2008
@@ -53,10 +53,10 @@
ItemProperties.show ((Gkr.Item)key, view.window);
}
- public override void delete_objects (List<Object> keys) throws GLib.Error {
+ public override Operation? delete_objects (List<Object> keys) {
uint num = keys.length();
if (num == 0)
- return;
+ return null;
string prompt;
if (num == 1)
@@ -64,8 +64,10 @@
else
prompt = _("Are you sure you want to delete %d passwords?").printf(num);
- if (Util.prompt_delete (prompt))
- Seahorse.Source.delete_objects (keys);
+ if (!Util.prompt_delete (prompt, view.window))
+ return null;
+
+ return Seahorse.Source.delete_objects (keys);
}
}
}
Modified: trunk/gkr/vala-build.stamp
==============================================================================
--- trunk/gkr/vala-build.stamp (original)
+++ trunk/gkr/vala-build.stamp Sun Jul 27 16:00:34 2008
@@ -1 +1 @@
-1216678890
+1217171775
Modified: trunk/libseahorse/libseahorse-c.vapi
==============================================================================
--- trunk/libseahorse/libseahorse-c.vapi (original)
+++ trunk/libseahorse/libseahorse-c.vapi Sun Jul 27 16:00:34 2008
@@ -26,7 +26,7 @@
public class Source : GLib.Object {
public GLib.Quark ktype { get; }
public static Operation export_objects (GLib.List<Object> objects, GLib.OutputStream output);
- public static void delete_objects (GLib.List<Object> objects) throws GLib.Error;
+ public static Operation delete_objects (GLib.List<Object> objects);
public virtual Operation load (GLib.Quark id);
public virtual Operation search (string match);
@@ -134,10 +134,10 @@
public string chooser_open_prompt (Gtk.Dialog dialog);
public void handle_error (GLib.Error ex, string format, ...);
- public void show_error (Gtk.Widget parent, string heading, string description);
- public bool prompt_delete (string text);
+ public void show_error (Gtk.Widget? parent, string heading, string description);
+ public bool prompt_delete (string text, Gtk.Widget? parent = null);
- public string uri_get_last (string uri);
+ public weak string uri_get_last (string uri);
public GLib.Quark detect_file_type (string uri);
public GLib.Quark detect_data_type (string text, long len);
}
Modified: trunk/libseahorse/libseahorse.gidl
==============================================================================
--- trunk/libseahorse/libseahorse.gidl (original)
+++ trunk/libseahorse/libseahorse.gidl Sun Jul 27 16:00:34 2008
@@ -30,7 +30,7 @@
<parameter name="self" type="Seahorse.Commands*"/>
<parameter name="obj" type="GLib.List*"/>
</parameters>
- <return-type type="void"/>
+ <return-type type="Seahorse.Operation*" transfer="full"/>
</method>
<property name="view" type="Seahorse.View*" readable="1" writable="1"/>
<property name="ktype" type="GLib.Quark" readable="1"/>
Modified: trunk/libseahorse/libseahorse.vapi
==============================================================================
--- trunk/libseahorse/libseahorse.vapi (original)
+++ trunk/libseahorse/libseahorse.vapi Sun Jul 27 16:00:34 2008
@@ -23,7 +23,7 @@
[CCode (cheader_filename = "seahorse-commands.h")]
public abstract class Commands : GLib.Object {
public abstract void show_properties (Seahorse.Object obj);
- public abstract void delete_objects (GLib.List<Seahorse.Object> obj) throws GLib.Error;
+ public abstract Seahorse.Operation? delete_objects (GLib.List<Seahorse.Object> obj);
public Seahorse.View view { get; construct; }
public abstract GLib.Quark ktype { get; }
public abstract Gtk.ActionGroup command_actions { get; }
Modified: trunk/libseahorse/seahorse-commands.c
==============================================================================
--- trunk/libseahorse/seahorse-commands.c (original)
+++ trunk/libseahorse/seahorse-commands.c Sun Jul 27 16:00:34 2008
@@ -37,7 +37,7 @@
SEAHORSE_COMMANDS_UI_DEFINITION
};
static void seahorse_commands_real_show_properties (SeahorseCommands* self, SeahorseObject* obj);
-static void seahorse_commands_real_delete_objects (SeahorseCommands* self, GList* obj, GError** error);
+static SeahorseOperation* seahorse_commands_real_delete_objects (SeahorseCommands* self, GList* obj);
static void seahorse_commands_set_view (SeahorseCommands* self, SeahorseView* value);
static gpointer seahorse_commands_parent_class = NULL;
static void seahorse_commands_dispose (GObject * obj);
@@ -56,15 +56,15 @@
}
-static void seahorse_commands_real_delete_objects (SeahorseCommands* self, GList* obj, GError** error) {
- g_return_if_fail (SEAHORSE_IS_COMMANDS (self));
+static SeahorseOperation* seahorse_commands_real_delete_objects (SeahorseCommands* self, GList* obj) {
+ g_return_val_if_fail (SEAHORSE_IS_COMMANDS (self), NULL);
g_critical ("Type `%s' does not implement abstract method `seahorse_commands_delete_objects'", g_type_name (G_TYPE_FROM_INSTANCE (self)));
- return;
+ return NULL;
}
-void seahorse_commands_delete_objects (SeahorseCommands* self, GList* obj, GError** error) {
- SEAHORSE_COMMANDS_GET_CLASS (self)->delete_objects (self, obj, error);
+SeahorseOperation* seahorse_commands_delete_objects (SeahorseCommands* self, GList* obj) {
+ return SEAHORSE_COMMANDS_GET_CLASS (self)->delete_objects (self, obj);
}
Modified: trunk/libseahorse/seahorse-commands.h
==============================================================================
--- trunk/libseahorse/seahorse-commands.h (original)
+++ trunk/libseahorse/seahorse-commands.h Sun Jul 27 16:00:34 2008
@@ -24,6 +24,7 @@
#include <glib.h>
#include <glib-object.h>
+#include <seahorse-operation.h>
#include <gtk/gtk.h>
#include <stdlib.h>
#include <string.h>
@@ -52,12 +53,12 @@
struct _SeahorseCommandsClass {
GObjectClass parent_class;
void (*show_properties) (SeahorseCommands* self, SeahorseObject* obj);
- void (*delete_objects) (SeahorseCommands* self, GList* obj, GError** error);
+ SeahorseOperation* (*delete_objects) (SeahorseCommands* self, GList* obj);
};
void seahorse_commands_show_properties (SeahorseCommands* self, SeahorseObject* obj);
-void seahorse_commands_delete_objects (SeahorseCommands* self, GList* obj, GError** error);
+SeahorseOperation* seahorse_commands_delete_objects (SeahorseCommands* self, GList* obj);
SeahorseView* seahorse_commands_get_view (SeahorseCommands* self);
GQuark seahorse_commands_get_ktype (SeahorseCommands* self);
GtkActionGroup* seahorse_commands_get_command_actions (SeahorseCommands* self);
Modified: trunk/libseahorse/seahorse-commands.vala
==============================================================================
--- trunk/libseahorse/seahorse-commands.vala (original)
+++ trunk/libseahorse/seahorse-commands.vala Sun Jul 27 16:00:34 2008
@@ -39,6 +39,6 @@
public abstract void show_properties (Object obj);
- public abstract void delete_objects (List<Object> obj) throws GLib.Error;
+ public abstract Operation? delete_objects (List<Object> obj);
}
}
Modified: trunk/libseahorse/seahorse-operation.h
==============================================================================
--- trunk/libseahorse/seahorse-operation.h (original)
+++ trunk/libseahorse/seahorse-operation.h Sun Jul 27 16:00:34 2008
@@ -274,11 +274,11 @@
} \
return operation_type; \
} \
- static GObjectClass *operation_parent_class = NULL; \
+ static GObjectClass *opx##_operation_parent_class = NULL; \
static void seahorse_##opx##_operation_class_init (Seahorse##Opx##OperationClass *klass) { \
GObjectClass *gobject_class = G_OBJECT_CLASS (klass); \
SeahorseOperationClass *op_class = SEAHORSE_OPERATION_CLASS (klass); \
- operation_parent_class = g_type_class_peek_parent (klass); \
+ opx##_operation_parent_class = g_type_class_peek_parent (klass); \
op_class->cancel = seahorse_##opx##_operation_cancel; \
gobject_class->dispose = seahorse_##opx##_operation_dispose; \
gobject_class->finalize = seahorse_##opx##_operation_finalize; \
Modified: trunk/libseahorse/seahorse-source.c
==============================================================================
--- trunk/libseahorse/seahorse-source.c (original)
+++ trunk/libseahorse/seahorse-source.c Sun Jul 27 16:00:34 2008
@@ -236,27 +236,42 @@
return op;
}
-gboolean
-seahorse_source_delete_objects (GList *objects, GError **error)
+SeahorseOperation*
+seahorse_source_delete_objects (GList *objects)
{
- GList *l;
+ SeahorseOperation *op = NULL;
+ SeahorseMultiOperation *mop = NULL;
SeahorseSource *sksrc;
SeahorseObject *sobj;
+ GList *l;
for (l = objects; l; l = g_list_next (l)) {
- g_assert (SEAHORSE_IS_OBJECT (l->data));
sobj = SEAHORSE_OBJECT (l->data);
-
- /* Delete from this source */
+ g_return_val_if_fail (SEAHORSE_IS_OBJECT (sobj), NULL);;
+
+ /* Export from this object source */
sksrc = seahorse_object_get_source (sobj);
- g_return_val_if_fail (sksrc != NULL, FALSE);
+ g_return_val_if_fail (sksrc != NULL, NULL);
- if (!seahorse_source_remove (sksrc, sobj, 0, error))
- return FALSE;
+ if (op != NULL) {
+ if (mop == NULL)
+ mop = seahorse_multi_operation_new ();
+ seahorse_multi_operation_take (mop, op);
+ }
+
+ /* We pass our own data object, to which data is appended */
+ op = seahorse_source_remove (sksrc, l->data);
+ g_return_val_if_fail (op != NULL, NULL);
}
- return TRUE;
+ if (mop)
+ op = SEAHORSE_OPERATION (mop);
+
+ if (!op)
+ op = seahorse_operation_new_complete (NULL);
+
+ return op;
}
SeahorseOperation*
@@ -320,19 +335,20 @@
return op;
}
-gboolean
-seahorse_source_remove (SeahorseSource *sksrc, SeahorseObject *sobj, guint name, GError **error)
+SeahorseOperation*
+seahorse_source_remove (SeahorseSource *src, SeahorseObject *sobj)
{
- SeahorseSourceClass *klass;
-
- g_assert (!error || !*error);
- g_return_val_if_fail (seahorse_object_get_source (sobj) == sksrc, FALSE);
-
- g_return_val_if_fail (SEAHORSE_IS_SOURCE (sksrc), FALSE);
- klass = SEAHORSE_SOURCE_GET_CLASS (sksrc);
- g_return_val_if_fail (klass->remove != NULL, FALSE);
+ SeahorseSourceClass *klass;
+
+ g_return_val_if_fail (SEAHORSE_IS_SOURCE (src), NULL);
+ g_return_val_if_fail (SEAHORSE_IS_OBJECT (sobj), NULL);
+ g_return_val_if_fail (seahorse_object_get_source (sobj) == src, NULL);
+
+ g_return_val_if_fail (SEAHORSE_IS_SOURCE (src), FALSE);
+ klass = SEAHORSE_SOURCE_GET_CLASS (src);
+ g_return_val_if_fail (klass->remove != NULL, FALSE);
- return (*klass->remove) (sksrc, sobj, name, error);
+ return (*klass->remove) (src, sobj);
}
GQuark
Modified: trunk/libseahorse/seahorse-source.h
==============================================================================
--- trunk/libseahorse/seahorse-source.h (original)
+++ trunk/libseahorse/seahorse-source.h Sun Jul 27 16:00:34 2008
@@ -142,15 +142,12 @@
* remove
* @sksrc: The #SeahorseSource to delete the object from.
* @object: A object to delete.
- * @name: UID/name to delete, or 0 for main object.
- * @error: Error code when not successful.
*
* Delete the objects from the object source.
*
- * Returns: Whether successful or not.
+ * Returns: The remove operation.
*/
- gboolean (*remove) (SeahorseSource *sksrc, struct _SeahorseObject *sobj,
- guint name, GError **error);
+ SeahorseOperation* (*remove) (SeahorseSource *sksrc, struct _SeahorseObject *sobj);
} SeahorseSourceClass;
@@ -183,8 +180,7 @@
SeahorseOperation* seahorse_source_export_objects (GList *objects,
GOutputStream *output);
-gboolean seahorse_source_delete_objects (GList *objects,
- GError **error);
+SeahorseOperation* seahorse_source_delete_objects (GList *objects);
SeahorseOperation* seahorse_source_export (SeahorseSource *sksrc,
GList *objects,
@@ -194,10 +190,8 @@
GSList *ids,
GOutputStream *output);
-gboolean seahorse_source_remove (SeahorseSource *sksrc,
- struct _SeahorseObject *sobj,
- guint name,
- GError **error);
+SeahorseOperation* seahorse_source_remove (SeahorseSource *sksrc,
+ struct _SeahorseObject *sobj);
GQuark seahorse_source_get_ktype (SeahorseSource *sksrc);
Modified: trunk/libseahorse/seahorse-transfer-operation.c
==============================================================================
--- trunk/libseahorse/seahorse-transfer-operation.c (original)
+++ trunk/libseahorse/seahorse-transfer-operation.c Sun Jul 27 16:00:34 2008
@@ -304,7 +304,7 @@
}
pv->operation = NULL;
- G_OBJECT_CLASS (operation_parent_class)->dispose (gobject);
+ G_OBJECT_CLASS (transfer_operation_parent_class)->dispose (gobject);
}
static void
@@ -330,7 +330,7 @@
g_free (pv->message);
pv->message = NULL;
- G_OBJECT_CLASS (operation_parent_class)->finalize (gobject);
+ G_OBJECT_CLASS (transfer_operation_parent_class)->finalize (gobject);
}
static void
Modified: trunk/libseahorse/seahorse-unknown-source.c
==============================================================================
--- trunk/libseahorse/seahorse-unknown-source.c (original)
+++ trunk/libseahorse/seahorse-unknown-source.c Sun Jul 27 16:00:34 2008
@@ -83,13 +83,12 @@
return NULL;
}
-static gboolean
-seahorse_unknown_source_remove (SeahorseSource *sksrc, SeahorseObject *sobj,
- guint name, GError **error)
+static SeahorseOperation*
+seahorse_unknown_source_remove (SeahorseSource *sksrc, SeahorseObject *sobj)
{
g_return_val_if_fail (sksrc == seahorse_object_get_source (sobj), FALSE);
seahorse_context_remove_object (SCTX_APP (), sobj);
- return TRUE;
+ return seahorse_operation_new_complete (NULL);
}
static void
Modified: trunk/libseahorse/seahorse-util.c
==============================================================================
--- trunk/libseahorse/seahorse-util.c (original)
+++ trunk/libseahorse/seahorse-util.c Sun Jul 27 16:00:34 2008
@@ -108,12 +108,24 @@
}
gboolean
-seahorse_util_prompt_delete (const gchar *text)
+seahorse_util_prompt_delete (const gchar *text, GtkWidget *parent)
{
GtkWidget *warning, *button;
gint response;
- warning = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL,
+ if (parent) {
+ if (!GTK_IS_WIDGET (parent)) {
+ g_warn_if_reached ();
+ parent = NULL;
+ } else {
+ if (!GTK_IS_WINDOW (parent))
+ parent = gtk_widget_get_toplevel (parent);
+ if (!GTK_IS_WINDOW (parent) && GTK_WIDGET_TOPLEVEL (parent))
+ parent = NULL;
+ }
+ }
+
+ warning = gtk_message_dialog_new (GTK_WINDOW (parent), GTK_DIALOG_MODAL,
GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE,
"%s", text);
Modified: trunk/libseahorse/seahorse-util.h
==============================================================================
--- trunk/libseahorse/seahorse-util.h (original)
+++ trunk/libseahorse/seahorse-util.h Sun Jul 27 16:00:34 2008
@@ -65,7 +65,8 @@
void seahorse_util_handle_error (GError* err,
const char* desc, ...);
-gboolean seahorse_util_prompt_delete (const gchar *text);
+gboolean seahorse_util_prompt_delete (const gchar *text,
+ GtkWidget *parent);
gchar* seahorse_util_read_to_text (GInputStream * input,
guint *len);
Modified: trunk/libseahorse/vala-build.stamp
==============================================================================
--- trunk/libseahorse/vala-build.stamp (original)
+++ trunk/libseahorse/vala-build.stamp Sun Jul 27 16:00:34 2008
@@ -1 +1 @@
-1216417226
+1217099898
Modified: trunk/pgp/Makefile.am
==============================================================================
--- trunk/pgp/Makefile.am (original)
+++ trunk/pgp/Makefile.am Sun Jul 27 16:00:34 2008
@@ -66,7 +66,6 @@
seahorse-gpg-options.c seahorse-gpg-options.h \
seahorse-pgp-add-subkey.c \
seahorse-pgp-add-uid.c \
- seahorse-pgp-delete.c \
seahorse-pgp-error.c \
seahorse-pgp-expires.c \
seahorse-pgp-generate.c \
Modified: trunk/pgp/seahorse-hkp-source.c
==============================================================================
--- trunk/pgp/seahorse-hkp-source.c (original)
+++ trunk/pgp/seahorse-hkp-source.c Sun Jul 27 16:00:34 2008
@@ -200,7 +200,7 @@
hop->session = NULL;
}
- G_OBJECT_CLASS (operation_parent_class)->dispose (gobject);
+ G_OBJECT_CLASS (hkp_operation_parent_class)->dispose (gobject);
}
static void
@@ -211,7 +211,7 @@
g_assert (hop->hsrc == NULL);
g_assert (hop->session == NULL);
- G_OBJECT_CLASS (operation_parent_class)->finalize (gobject);
+ G_OBJECT_CLASS (hkp_operation_parent_class)->finalize (gobject);
}
static void
Modified: trunk/pgp/seahorse-ldap-source.c
==============================================================================
--- trunk/pgp/seahorse-ldap-source.c (original)
+++ trunk/pgp/seahorse-ldap-source.c Sun Jul 27 16:00:34 2008
@@ -390,7 +390,7 @@
lop->stag = 0;
}
- G_OBJECT_CLASS (operation_parent_class)->dispose (gobject);
+ G_OBJECT_CLASS (ldap_operation_parent_class)->dispose (gobject);
}
static void
@@ -403,7 +403,7 @@
g_assert (lop->stag == 0);
g_assert (lop->ldap == NULL);
- G_OBJECT_CLASS (operation_parent_class)->finalize (gobject);
+ G_OBJECT_CLASS (ldap_operation_parent_class)->finalize (gobject);
}
static void
Modified: trunk/pgp/seahorse-pgp-commands.c
==============================================================================
--- trunk/pgp/seahorse-pgp-commands.c (original)
+++ trunk/pgp/seahorse-pgp-commands.c Sun Jul 27 16:00:34 2008
@@ -24,7 +24,8 @@
#include <seahorse-pgp-dialogs.h>
#include <seahorse-pgp-key.h>
#include <seahorse-view.h>
-#include <seahorse-pgp-uid.h>
+#include <seahorse-util.h>
+#include <seahorse-source.h>
#include <config.h>
#include <common/seahorse-registry.h>
#include "seahorse-pgp.h"
@@ -44,7 +45,8 @@
SEAHORSE_PGP_COMMANDS_COMMAND_ACTIONS
};
static void seahorse_pgp_commands_real_show_properties (SeahorseCommands* base, SeahorseObject* obj);
-static void seahorse_pgp_commands_real_delete_objects (SeahorseCommands* base, GList* objects, GError** error);
+static void _g_list_free_g_object_unref (GList* self);
+static SeahorseOperation* seahorse_pgp_commands_real_delete_objects (SeahorseCommands* base, GList* objects);
static void seahorse_pgp_commands_on_key_sign (SeahorsePGPCommands* self, GtkAction* action);
static void seahorse_pgp_commands_on_view_selection_changed (SeahorsePGPCommands* self, SeahorseView* view);
static void _seahorse_pgp_commands_on_key_sign_gtk_action_activate (GtkAction* _sender, gpointer self);
@@ -70,47 +72,114 @@
}
-static void seahorse_pgp_commands_real_delete_objects (SeahorseCommands* base, GList* objects, GError** error) {
+static void _g_list_free_g_object_unref (GList* self) {
+ g_list_foreach (self, ((GFunc) (g_object_unref)), NULL);
+ g_list_free (self);
+}
+
+
+static SeahorseOperation* seahorse_pgp_commands_real_delete_objects (SeahorseCommands* base, GList* objects) {
SeahorsePGPCommands * self;
guint num;
+ gint num_keys;
+ gint num_identities;
+ char* message;
+ GList* to_delete;
+ guint length;
+ guint _tmp10;
+ SeahorseOperation* _tmp12;
self = SEAHORSE_PGP_COMMANDS (base);
- g_return_if_fail (objects != NULL);
+ g_return_val_if_fail (objects != NULL, NULL);
num = g_list_length (objects);
if (num == 0) {
- return;
+ return NULL;
}
+ num_keys = 0;
+ num_identities = 0;
+ message = NULL;
+ /*
+ * Go through and validate all what we have to delete,
+ * removing UIDs where the parent Key is also on the
+ * chopping block.
+ */
+ to_delete = NULL;
{
GList* obj_collection;
GList* obj_it;
obj_collection = objects;
for (obj_it = obj_collection; obj_it != NULL; obj_it = obj_it->next) {
- SeahorseObject* _tmp1;
+ SeahorseObject* _tmp4;
SeahorseObject* obj;
- _tmp1 = NULL;
- obj = (_tmp1 = ((SeahorseObject*) (obj_it->data)), (_tmp1 == NULL ? NULL : g_object_ref (_tmp1)));
+ _tmp4 = NULL;
+ obj = (_tmp4 = ((SeahorseObject*) (obj_it->data)), (_tmp4 == NULL ? NULL : g_object_ref (_tmp4)));
{
- /*
- * Delete all the user ids first, if parent key is
- * not on the chopping block already.
- */
- if (G_TYPE_FROM_INSTANCE (G_OBJECT (obj)) == SEAHORSE_PGP_TYPE_UID) {
- SeahorsePGPUid* _tmp0;
- SeahorsePGPUid* uid;
- _tmp0 = NULL;
- uid = (_tmp0 = SEAHORSE_PGP_UID (obj), (_tmp0 == NULL ? NULL : g_object_ref (_tmp0)));
- if (g_list_find (objects, seahorse_object_get_parent (SEAHORSE_OBJECT (uid))) == NULL) {
- seahorse_pgp_delete_userid_show (SEAHORSE_PGP_KEY (seahorse_object_get_parent (SEAHORSE_OBJECT (uid))), seahorse_pgp_uid_get_index (uid));
+ GType _tmp3;
+ _tmp3 = G_TYPE_FROM_INSTANCE (G_OBJECT (obj));
+ if (_tmp3 == SEAHORSE_PGP_TYPE_UID)
+ do {
+ if (g_list_find (objects, seahorse_object_get_parent (obj)) == NULL) {
+ SeahorseObject* _tmp1;
+ _tmp1 = NULL;
+ to_delete = g_list_prepend (to_delete, (_tmp1 = obj, (_tmp1 == NULL ? NULL : g_object_ref (_tmp1))));
+ num_identities = num_identities + 1;
}
- objects = g_list_remove (objects, obj);
- (uid == NULL ? NULL : (uid = (g_object_unref (uid), NULL)));
+ break;
+ } while (0); else if (_tmp3 == SEAHORSE_PGP_TYPE_KEY)
+ do {
+ SeahorseObject* _tmp2;
+ _tmp2 = NULL;
+ to_delete = g_list_prepend (to_delete, (_tmp2 = obj, (_tmp2 == NULL ? NULL : g_object_ref (_tmp2))));
+ num_keys = num_keys + 1;
+ break;
+ } while (0);
+ (obj == NULL ? NULL : (obj = (g_object_unref (obj), NULL)));
+ }
+ }
+ }
+ /* Figure out a good prompt message */
+ length = g_list_length (to_delete);
+ _tmp10 = length;
+ if (_tmp10 == 0)
+ do {
+ SeahorseOperation* _tmp5;
+ _tmp5 = NULL;
+ return (_tmp5 = NULL, (message = (g_free (message), NULL)), (to_delete == NULL ? NULL : (to_delete = (_g_list_free_g_object_unref (to_delete), NULL))), _tmp5);
+ } while (0); else if (_tmp10 == 1)
+ do {
+ char* _tmp6;
+ _tmp6 = NULL;
+ message = (_tmp6 = g_strdup_printf (_ ("Are you sure you want to permanently delete %s?"), seahorse_object_get_display_name (((SeahorseObject*) (((SeahorseObject*) (to_delete->data)))))), (message = (g_free (message), NULL)), _tmp6);
+ break;
+ } while (0); else
+ do {
+ if (num_keys > 0 && num_identities > 0) {
+ char* _tmp7;
+ _tmp7 = NULL;
+ message = (_tmp7 = g_strdup_printf (_ ("Are you sure you want to permanently delete %d keys and identities?"), length), (message = (g_free (message), NULL)), _tmp7);
+ } else {
+ if (num_keys > 0) {
+ char* _tmp8;
+ _tmp8 = NULL;
+ message = (_tmp8 = g_strdup_printf (_ ("Are you sure you want to permanently delete %d keys?"), length), (message = (g_free (message), NULL)), _tmp8);
+ } else {
+ if (num_identities > 0) {
+ char* _tmp9;
+ _tmp9 = NULL;
+ message = (_tmp9 = g_strdup_printf (_ ("Are you sure you want to permanently delete %d identities?"), length), (message = (g_free (message), NULL)), _tmp9);
} else {
- g_return_if_fail (G_TYPE_FROM_INSTANCE (G_OBJECT (obj)) != SEAHORSE_PGP_TYPE_KEY);
+ g_assert_not_reached ();
}
- (obj == NULL ? NULL : (obj = (g_object_unref (obj), NULL)));
}
}
+ break;
+ } while (0);
+ if (!seahorse_util_prompt_delete (message, GTK_WIDGET (seahorse_view_get_window (seahorse_commands_get_view (SEAHORSE_COMMANDS (self)))))) {
+ SeahorseOperation* _tmp11;
+ _tmp11 = NULL;
+ return (_tmp11 = NULL, (message = (g_free (message), NULL)), (to_delete == NULL ? NULL : (to_delete = (_g_list_free_g_object_unref (to_delete), NULL))), _tmp11);
}
- seahorse_pgp_delete_show (objects);
+ _tmp12 = NULL;
+ return (_tmp12 = seahorse_source_delete_objects (to_delete), (message = (g_free (message), NULL)), (to_delete == NULL ? NULL : (to_delete = (_g_list_free_g_object_unref (to_delete), NULL))), _tmp12);
}
Modified: trunk/pgp/seahorse-pgp-commands.h
==============================================================================
--- trunk/pgp/seahorse-pgp-commands.h (original)
+++ trunk/pgp/seahorse-pgp-commands.h Sun Jul 27 16:00:34 2008
@@ -26,6 +26,7 @@
#include <glib-object.h>
#include <seahorse-commands.h>
#include <seahorse-object.h>
+#include <seahorse-operation.h>
#include <stdlib.h>
#include <string.h>
#include <gtk/gtk.h>
Modified: trunk/pgp/seahorse-pgp-commands.vala
==============================================================================
--- trunk/pgp/seahorse-pgp-commands.vala (original)
+++ trunk/pgp/seahorse-pgp-commands.vala Sun Jul 27 16:00:34 2008
@@ -70,29 +70,61 @@
KeyProperties.show ((Pgp.Key)obj, view.window);
}
- public override void delete_objects (List<Object> objects) throws GLib.Error {
+ public override Operation? delete_objects (List<Object> objects) {
uint num = objects.length();
if (num == 0)
- return;
+ return null;
+ int num_keys = 0;
+ int num_identities = 0;
+ string message;
+
+ /*
+ * Go through and validate all what we have to delete,
+ * removing UIDs where the parent Key is also on the
+ * chopping block.
+ */
+ GLib.List<Object> to_delete = new GLib.List<Object>();
foreach (var obj in objects) {
-
- /*
- * Delete all the user ids first, if parent key is
- * not on the chopping block already.
- */
-
- if (obj.get_type() == typeof (Pgp.Uid)) {
- Pgp.Uid uid = (Pgp.Uid)obj;
- if (objects.find(uid.parent) == null)
- Delete.userid_show ((Pgp.Key)uid.parent, uid.index);
- objects.remove (obj);
- } else {
- return_if_fail (obj.get_type() != typeof (Pgp.Key));
+ switch (obj.get_type()) {
+ case typeof (Pgp.Uid):
+ if (objects.find(obj.parent) == null) {
+ to_delete.prepend(obj);
+ ++num_identities;
+ }
+ break;
+
+ case typeof (Pgp.Key):
+ to_delete.prepend(obj);
+ ++num_keys;
+ break;
}
}
+
+ /* Figure out a good prompt message */
+ uint length = to_delete.length ();
+ switch (length) {
+ case 0:
+ return null;
+ case 1:
+ message = _("Are you sure you want to permanently delete %s?").printf(to_delete.data.display_name);
+ break;
+ default:
+ if (num_keys > 0 && num_identities > 0)
+ message = _("Are you sure you want to permanently delete %d keys and identities?").printf(length);
+ else if (num_keys > 0)
+ message = _("Are you sure you want to permanently delete %d keys?").printf(length);
+ else if (num_identities > 0)
+ message = _("Are you sure you want to permanently delete %d identities?").printf(length);
+ else
+ assert_not_reached();
+ break;
+ }
+
+ if (!Util.prompt_delete(message, view.window))
+ return null;
- Delete.show(objects);
+ return Seahorse.Source.delete_objects(to_delete);
}
private void on_key_sign (Action action) {
Modified: trunk/pgp/seahorse-pgp-dialogs.h
==============================================================================
--- trunk/pgp/seahorse-pgp-dialogs.h (original)
+++ trunk/pgp/seahorse-pgp-dialogs.h Sun Jul 27 16:00:34 2008
@@ -70,10 +70,4 @@
GtkWindow *parent,
gpgmex_photo_id_t photo);
-void seahorse_pgp_delete_subkey_new (SeahorsePGPKey *pkey,
- guint index);
-
-void seahorse_pgp_delete_userid_show (SeahorseKey *skey,
- guint index);
-
#endif /* __SEAHORSE_PGP_DIALOGS_H__ */
Modified: trunk/pgp/seahorse-pgp-key-properties.c
==============================================================================
--- trunk/pgp/seahorse-pgp-key-properties.c (original)
+++ trunk/pgp/seahorse-pgp-key-properties.c Sun Jul 27 16:00:34 2008
@@ -220,10 +220,29 @@
names_delete_clicked (GtkWidget *widget, SeahorseWidget *swidget)
{
SeahorseKey *skey = SEAHORSE_KEY_WIDGET (swidget)->skey;
+ SeahorsePGPKey *pkey = SEAHORSE_PGP_KEY (skey);
gint index = names_get_selected_uid (swidget);
+ gboolean ret;
+ gchar *userid, *message;
+ gpgme_error_t gerr;
- if (index >= 1)
- seahorse_pgp_delete_userid_show (skey, index);
+ if (index < 1)
+ return;
+
+ /* TODO: This whole index thing is messed up */
+ userid = seahorse_key_get_name (skey, index - 1);
+ message = g_strdup_printf (_("Are you sure you want to permanently delete the '%s' user ID?"), userid);
+ g_free (userid);
+
+ ret = seahorse_util_prompt_delete (message, seahorse_widget_get_toplevel (swidget));
+ g_free (message);
+
+ if (ret == FALSE)
+ return;
+
+ gerr = seahorse_pgp_key_op_del_uid (pkey, index);
+ if (!GPG_IS_OK (gerr))
+ seahorse_pgp_handle_gpgme_error (gerr, _("Couldn't delete user ID"));
}
static void
@@ -967,8 +986,26 @@
details_del_subkey_button_clicked (GtkButton *button, SeahorseWidget *swidget)
{
SeahorseKey *skey = SEAHORSE_KEY_WIDGET (swidget)->skey;
+ SeahorsePGPKey *pkey = SEAHORSE_PGP_KEY (skey);
+ guint index = get_selected_subkey (swidget);
+ gboolean ret;
+ gchar *userid, *message;
+ gpgme_error_t err;
- seahorse_pgp_delete_subkey_new (SEAHORSE_PGP_KEY (skey), get_selected_subkey (swidget));
+ userid = seahorse_key_get_name (SEAHORSE_KEY (pkey), 0);
+ message = g_strdup_printf (_("Are you sure you want to permanently delete subkey %d of %s?"),
+ index, userid);
+ g_free (userid);
+
+ ret = seahorse_util_prompt_delete (message, seahorse_widget_get_toplevel (swidget));
+ g_free (message);
+
+ if (ret == FALSE)
+ return;
+
+ err = seahorse_pgp_key_op_del_subkey (pkey, index);
+ if (!GPG_IS_OK (err))
+ seahorse_pgp_handle_gpgme_error (err, _("Couldn't delete subkey"));
}
static void
Modified: trunk/pgp/seahorse-pgp-key.c
==============================================================================
--- trunk/pgp/seahorse-pgp-key.c (original)
+++ trunk/pgp/seahorse-pgp-key.c Sun Jul 27 16:00:34 2008
@@ -143,9 +143,13 @@
{
gpgme_user_id_t guid;
SeahorsePGPUid *uid;
+ SeahorseSource *source;
GList *l;
guint index = 1;
+ source = seahorse_object_get_source (SEAHORSE_OBJECT (pkey));
+ g_return_if_fail (SEAHORSE_IS_PGP_SOURCE (source));
+
l = pkey->uids;
guid = pkey->pubkey ? pkey->pubkey->uids : NULL;
@@ -157,12 +161,12 @@
/* Remove if no uid */
if (!guid) {
- pkey->uids = g_list_remove (pkey->uids, uid);
seahorse_object_set_parent (l->data, NULL);
+ pkey->uids = g_list_remove (pkey->uids, uid);
g_object_unref (uid);
} else {
/* Bring this UID up to date */
- g_object_set (uid, "userid", guid, "index", index, NULL);
+ g_object_set (uid, "userid", guid, "index", index, "source", source, NULL);
++index;
}
@@ -173,7 +177,7 @@
/* Add new UIDs */
while (guid != NULL) {
uid = seahorse_pgp_uid_new (pkey->pubkey, guid);
- g_object_set (uid, "index", index, NULL);
+ g_object_set (uid, "index", index, "source", source, NULL);
++index;
pkey->uids = g_list_append (pkey->uids, uid);
guid = guid->next;
Modified: trunk/pgp/seahorse-pgp-operation.c
==============================================================================
--- trunk/pgp/seahorse-pgp-operation.c (original)
+++ trunk/pgp/seahorse-pgp-operation.c Sun Jul 27 16:00:34 2008
@@ -378,7 +378,7 @@
seahorse_pgp_operation_dispose (GObject *gobject)
{
/* Nothing to do */
- G_OBJECT_CLASS (operation_parent_class)->dispose (gobject);
+ G_OBJECT_CLASS (pgp_operation_parent_class)->dispose (gobject);
}
static void
@@ -410,7 +410,7 @@
g_free (pv->message);
pv->message = NULL;
- G_OBJECT_CLASS (operation_parent_class)->finalize (gobject);
+ G_OBJECT_CLASS (pgp_operation_parent_class)->finalize (gobject);
}
static void
Modified: trunk/pgp/seahorse-pgp-source.c
==============================================================================
--- trunk/pgp/seahorse-pgp-source.c (original)
+++ trunk/pgp/seahorse-pgp-source.c Sun Jul 27 16:00:34 2008
@@ -266,12 +266,9 @@
GInputStream *input);
static SeahorseOperation* seahorse_pgp_source_export (SeahorseSource *sksrc,
GList *keys,
- gboolean complete,
GOutputStream *output);
-static gboolean seahorse_pgp_source_remove (SeahorseSource *sksrc,
- SeahorseObject *sobj,
- guint name,
- GError **error);
+static SeahorseOperation* seahorse_pgp_source_remove (SeahorseSource *sksrc,
+ SeahorseObject *sobj);
/* Other forward decls */
static void monitor_gpg_homedir (GFileMonitor *handle,
@@ -702,7 +699,7 @@
lop->psrc = NULL;
}
- G_OBJECT_CLASS (operation_parent_class)->dispose (gobject);
+ G_OBJECT_CLASS (load_operation_parent_class)->dispose (gobject);
}
static void
@@ -719,7 +716,7 @@
if (lop->ctx)
gpgme_release (lop->ctx);
- G_OBJECT_CLASS (operation_parent_class)->finalize (gobject);
+ G_OBJECT_CLASS (load_operation_parent_class)->finalize (gobject);
}
static void
@@ -1018,18 +1015,16 @@
}
static SeahorseOperation*
-seahorse_pgp_source_export (SeahorseSource *sksrc, GList *keys,
- gboolean complete, GOutputStream *output)
+seahorse_pgp_source_export (SeahorseSource *sksrc, GList *keys, GOutputStream *output)
{
- SeahorsePGPOperation *pop;
- SeahorsePGPSource *psrc;
- SeahorsePGPKey *pkey;
- SeahorseKey *skey;
- ExportContext *ctx;
- gpgme_error_t gerr = GPG_OK;
- gpgme_data_t data;
- const gchar *keyid;
- GList *l;
+ SeahorsePGPOperation *pop;
+ SeahorsePGPSource *psrc;
+ SeahorsePGPKey *pkey;
+ SeahorseKey *skey;
+ ExportContext *ctx;
+ gpgme_data_t data;
+ const gchar *keyid;
+ GList *l;
g_return_val_if_fail (SEAHORSE_IS_PGP_SOURCE (sksrc), NULL);
g_return_val_if_fail (output == NULL || G_IS_OUTPUT_STREAM (output), NULL);
@@ -1056,63 +1051,57 @@
ctx->data = data;
g_object_set_data_full (G_OBJECT (pop), "export-context", ctx, free_export_context);
- for (l = keys; l != NULL; l = g_list_next (l)) {
-
- g_return_val_if_fail (SEAHORSE_IS_PGP_KEY (l->data), NULL);
- pkey = SEAHORSE_PGP_KEY (l->data);
-
- skey = SEAHORSE_KEY (l->data);
- g_return_val_if_fail (seahorse_object_get_source (SEAHORSE_OBJECT (skey)) == sksrc, NULL);
-
- /* Building list */
- keyid = seahorse_pgp_key_get_id (pkey->pubkey, 0);
- g_array_append_val (ctx->keyids, keyid);
-
- /* Exporting of secret keys is synchronous */
- if (complete && SEAHORSE_OBJECT (skey)->_usage == SEAHORSE_USAGE_PRIVATE_KEY) {
-
- gerr = gpgmex_op_export_secret (pop->gctx,
- seahorse_pgp_key_get_id (pkey->seckey, 0), data);
-
- if (!GPG_IS_OK (gerr))
- break;
+ for (l = keys; l != NULL; l = g_list_next (l)) {
+
+ /* Ignore PGP Uids */
+ if (SEAHORSE_IS_PGP_UID (l->data))
+ continue;
+
+ g_return_val_if_fail (SEAHORSE_IS_PGP_KEY (l->data), NULL);
+ pkey = SEAHORSE_PGP_KEY (l->data);
+
+ skey = SEAHORSE_KEY (l->data);
+ g_return_val_if_fail (seahorse_object_get_source (SEAHORSE_OBJECT (skey)) == sksrc, NULL);
+
+ /* Building list */
+ keyid = seahorse_pgp_key_get_id (pkey->pubkey, 0);
+ g_array_append_val (ctx->keyids, keyid);
}
- }
- if (!GPG_IS_OK (gerr))
- seahorse_pgp_operation_mark_failed (pop, gerr);
- else
- {
g_signal_connect (pop, "results", G_CALLBACK (export_key_callback), ctx);
export_key_callback (pop, ctx);
- }
- return SEAHORSE_OPERATION (pop);
+ return SEAHORSE_OPERATION (pop);
}
-static gboolean
-seahorse_pgp_source_remove (SeahorseSource *sksrc, SeahorseObject *sobj,
- guint name, GError **error)
+static SeahorseOperation*
+seahorse_pgp_source_remove (SeahorseSource *sksrc, SeahorseObject *sobj)
{
- gpgme_error_t gerr;
-
- g_assert (!error || !*error);
- g_assert (seahorse_object_get_source (sobj) == sksrc);
-
- if (name > 0)
- gerr = seahorse_pgp_key_op_del_uid (SEAHORSE_PGP_KEY (sobj), name);
- else if (seahorse_object_get_usage (sobj) == SEAHORSE_USAGE_PRIVATE_KEY)
- gerr = seahorse_pgp_key_pair_op_delete (SEAHORSE_PGP_KEY (sobj));
- else
- gerr = seahorse_pgp_key_op_delete (SEAHORSE_PGP_KEY (sobj));
+ SeahorseObject *parent;
+ GError *error = NULL;
+ gpgme_error_t gerr;
- if (!GPG_IS_OK (gerr)) {
- seahorse_gpgme_to_error (gerr, error);
- return FALSE;
- }
+ g_return_val_if_fail (SEAHORSE_IS_SOURCE (sksrc), NULL);
+ g_return_val_if_fail (SEAHORSE_IS_OBJECT (sobj), NULL);
+ g_return_val_if_fail (seahorse_object_get_source (sobj) == sksrc, NULL);
+
+ if (SEAHORSE_IS_PGP_UID (sobj)) {
+ parent = seahorse_object_get_parent (sobj);
+ g_return_val_if_fail (SEAHORSE_IS_PGP_KEY (parent), NULL);
+ gerr = seahorse_pgp_key_op_del_uid (SEAHORSE_PGP_KEY (parent),
+ SEAHORSE_PGP_UID (sobj)->index + 1);
+ } else if (SEAHORSE_IS_PGP_KEY (sobj)) {
+ if (seahorse_object_get_usage (sobj) == SEAHORSE_USAGE_PRIVATE_KEY)
+ gerr = seahorse_pgp_key_pair_op_delete (SEAHORSE_PGP_KEY (sobj));
+ else
+ gerr = seahorse_pgp_key_op_delete (SEAHORSE_PGP_KEY (sobj));
+ } else {
+ g_return_val_if_reached (NULL);
+ }
- seahorse_source_load_async (sksrc, 0);
- return TRUE;
+ if (!GPG_IS_OK (gerr))
+ seahorse_gpgme_to_error (gerr, &error);
+ return seahorse_operation_new_complete (error);
}
/* --------------------------------------------------------------------------
Modified: trunk/pgp/vala-build.stamp
==============================================================================
--- trunk/pgp/vala-build.stamp (original)
+++ trunk/pgp/vala-build.stamp Sun Jul 27 16:00:34 2008
@@ -1 +1 @@
-1216678946
+1217173660
Modified: trunk/pkcs11/vala-build.stamp
==============================================================================
--- trunk/pkcs11/vala-build.stamp (original)
+++ trunk/pkcs11/vala-build.stamp Sun Jul 27 16:00:34 2008
@@ -1 +1 @@
-1217097084
+1217171779
Modified: trunk/src/seahorse-key-manager.c
==============================================================================
--- trunk/src/seahorse-key-manager.c (original)
+++ trunk/src/seahorse-key-manager.c Sun Jul 27 16:00:34 2008
@@ -589,7 +589,7 @@
file = g_file_new_for_uri (uri);
input = g_file_read (file, NULL, &inner_error);
if (inner_error != NULL) {
- goto __catch4_g_error;
+ goto __catch3_g_error;
}
op = seahorse_source_import (sksrc, G_INPUT_STREAM (input));
seahorse_multi_operation_take (mop, op);
@@ -597,8 +597,8 @@
(input == NULL ? NULL : (input = (g_object_unref (input), NULL)));
(op == NULL ? NULL : (op = (g_object_unref (op), NULL)));
}
- goto __finally4;
- __catch4_g_error:
+ goto __finally3;
+ __catch3_g_error:
{
GError * ex;
ex = inner_error;
@@ -611,7 +611,7 @@
continue;
}
}
- __finally4:
+ __finally3:
;
uri = (g_free (uri), NULL);
(sksrc == NULL ? NULL : (sksrc = (g_object_unref (sksrc), NULL)));
Modified: trunk/src/seahorse-viewer.c
==============================================================================
--- trunk/src/seahorse-viewer.c (original)
+++ trunk/src/seahorse-viewer.c Sun Jul 27 16:00:34 2008
@@ -25,12 +25,12 @@
#include <seahorse-preferences.h>
#include <gio/gio.h>
#include <seahorse-commands.h>
-#include <seahorse-util.h>
-#include <seahorse-types.h>
#include <seahorse-operation.h>
+#include <seahorse-progress.h>
+#include <seahorse-types.h>
+#include <seahorse-util.h>
#include <gdk/gdk.h>
#include <seahorse-source.h>
-#include <seahorse-progress.h>
#include <common/seahorse-registry.h>
@@ -69,6 +69,8 @@
static void seahorse_viewer_on_help_show (SeahorseViewer* self, GtkAction* action);
static void seahorse_viewer_on_key_properties (SeahorseViewer* self, GtkAction* action);
static gint seahorse_viewer_compare_by_tag (SeahorseViewer* self, SeahorseObject* one, SeahorseObject* two);
+static void seahorse_viewer_on_delete_complete (SeahorseViewer* self, SeahorseOperation* op);
+static void _seahorse_viewer_on_delete_complete_seahorse_done_func (SeahorseOperation* op, gpointer self);
static void seahorse_viewer_delete_object_batch (SeahorseViewer* self, GList* objects);
static void seahorse_viewer_on_key_delete (SeahorseViewer* self, GtkAction* action);
static void seahorse_viewer_on_copy_complete (SeahorseViewer* self, SeahorseOperation* op);
@@ -392,38 +394,40 @@
}
+static void seahorse_viewer_on_delete_complete (SeahorseViewer* self, SeahorseOperation* op) {
+ g_return_if_fail (SEAHORSE_IS_VIEWER (self));
+ g_return_if_fail (SEAHORSE_IS_OPERATION (op));
+ if (!seahorse_operation_is_successful (op)) {
+ seahorse_operation_display_error (op, _ ("Couldn't delete."), GTK_WIDGET (seahorse_view_get_window (SEAHORSE_VIEW (self))));
+ }
+}
+
+
+static void _seahorse_viewer_on_delete_complete_seahorse_done_func (SeahorseOperation* op, gpointer self) {
+ seahorse_viewer_on_delete_complete (self, op);
+}
+
+
static void seahorse_viewer_delete_object_batch (SeahorseViewer* self, GList* objects) {
- GError * inner_error;
SeahorseCommands* _tmp0;
SeahorseCommands* commands;
+ SeahorseOperation* op;
g_return_if_fail (SEAHORSE_IS_VIEWER (self));
g_return_if_fail (objects != NULL);
- inner_error = NULL;
g_assert (objects != NULL);
_tmp0 = NULL;
commands = (_tmp0 = ((SeahorseCommands*) (g_hash_table_lookup (self->priv->_commands, GINT_TO_POINTER (seahorse_object_get_tag (((SeahorseObject*) (((SeahorseObject*) (objects->data))))))))), (_tmp0 == NULL ? NULL : g_object_ref (_tmp0)));
- {
- if (commands != NULL) {
- seahorse_commands_delete_objects (commands, objects, &inner_error);
- if (inner_error != NULL) {
- goto __catch1_g_error;
- }
- }
+ if (commands == NULL) {
+ (commands == NULL ? NULL : (commands = (g_object_unref (commands), NULL)));
+ return;
}
- goto __finally1;
- __catch1_g_error:
- {
- GError * ex;
- ex = inner_error;
- inner_error = NULL;
- {
- seahorse_util_handle_error (ex, _ ("Couldn't delete."), seahorse_view_get_window (SEAHORSE_VIEW (self)), NULL);
- (ex == NULL ? NULL : (ex = (g_error_free (ex), NULL)));
- }
+ op = seahorse_commands_delete_objects (commands, objects);
+ if (op != NULL) {
+ seahorse_progress_show (op, _ ("Deleting..."), TRUE);
+ seahorse_operation_watch (op, _seahorse_viewer_on_delete_complete_seahorse_done_func, self, NULL, NULL);
}
- __finally1:
- ;
(commands == NULL ? NULL : (commands = (g_object_unref (commands), NULL)));
+ (op == NULL ? NULL : (op = (g_object_unref (op), NULL)));
}
@@ -471,7 +475,7 @@
_tmp2 = NULL;
prompt = (_tmp3 = (_tmp2 = _ ("One or more of the deleted keys are private keys. Are you sure you want to proceed?"), (_tmp2 == NULL ? NULL : g_strdup (_tmp2))), (prompt = (g_free (prompt), NULL)), _tmp3);
}
- if (!seahorse_util_prompt_delete (prompt)) {
+ if (!seahorse_util_prompt_delete (prompt, GTK_WIDGET (seahorse_view_get_window (SEAHORSE_VIEW (self))))) {
prompt = (g_free (prompt), NULL);
(objects == NULL ? NULL : (objects = (g_list_free (objects), NULL)));
(batch == NULL ? NULL : (batch = (g_list_free (batch), NULL)));
@@ -630,7 +634,7 @@
file = g_file_new_for_uri (uri);
output = G_OUTPUT_STREAM (g_file_replace (file, NULL, FALSE, 0, NULL, &inner_error));
if (inner_error != NULL) {
- goto __catch2_g_error;
+ goto __catch1_g_error;
}
op = seahorse_source_export_objects (objects, output);
seahorse_progress_show (op, _ ("Exporting keys"), TRUE);
@@ -639,17 +643,14 @@
(output == NULL ? NULL : (output = (g_object_unref (output), NULL)));
(op == NULL ? NULL : (op = (g_object_unref (op), NULL)));
}
- goto __finally2;
- __catch2_g_error:
+ goto __finally1;
+ __catch1_g_error:
{
GError * ex;
ex = inner_error;
inner_error = NULL;
{
- char* _tmp1;
- _tmp1 = NULL;
- seahorse_util_handle_error (ex, _ ("Couldn't export key to \"%s\""), (_tmp1 = seahorse_util_uri_get_last (uri)), NULL);
- _tmp1 = (g_free (_tmp1), NULL);
+ seahorse_util_handle_error (ex, _ ("Couldn't export key to \"%s\""), seahorse_util_uri_get_last (uri), NULL);
(ex == NULL ? NULL : (ex = (g_error_free (ex), NULL)));
(objects == NULL ? NULL : (objects = (g_list_free (objects), NULL)));
(dialog == NULL ? NULL : (dialog = (g_object_unref (dialog), NULL)));
@@ -657,7 +658,7 @@
return;
}
}
- __finally2:
+ __finally1:
;
}
(objects == NULL ? NULL : (objects = (g_list_free (objects), NULL)));
@@ -796,12 +797,12 @@
path = g_strdup_printf ("%sseahorse-%s.ui", SEAHORSE_GLADEDIR, seahorse_widget_get_name (SEAHORSE_WIDGET (self)));
gtk_ui_manager_add_ui_from_file (self->priv->_ui_manager, path, &inner_error);
if (inner_error != NULL) {
- goto __catch3_g_error;
+ goto __catch2_g_error;
}
path = (g_free (path), NULL);
}
- goto __finally3;
- __catch3_g_error:
+ goto __finally2;
+ __catch2_g_error:
{
GError * ex;
ex = inner_error;
@@ -811,7 +812,7 @@
(ex == NULL ? NULL : (ex = (g_error_free (ex), NULL)));
}
}
- __finally3:
+ __finally2:
;
_tmp1 = NULL;
win = (_tmp1 = seahorse_widget_get_toplevel (SEAHORSE_WIDGET (self)), (_tmp1 == NULL ? NULL : g_object_ref (_tmp1)));
Modified: trunk/src/seahorse-viewer.vala
==============================================================================
--- trunk/src/seahorse-viewer.vala (original)
+++ trunk/src/seahorse-viewer.vala Sun Jul 27 16:00:34 2008
@@ -276,16 +276,23 @@
return 1;
return 0;
}
+
+ private void on_delete_complete (Operation op) {
+ if (!op.is_successful ())
+ op.display_error (_("Couldn't delete."), window);
+ }
private void delete_object_batch (List<Object> objects) {
assert (objects != null);
var commands = _commands.lookup(objects.data.tag);
- try {
- if (commands != null)
- commands.delete_objects (objects);
- } catch (GLib.Error ex) {
- Util.handle_error (ex, _("Couldn't delete."), window);
+ if (commands == null)
+ return;
+
+ Operation? op = commands.delete_objects (objects);
+ if (op != null) {
+ Progress.show (op, _("Deleting..."), true);
+ op.watch (on_delete_complete, null);
}
}
@@ -308,7 +315,7 @@
prompt = _("%s is a private key. Are you sure you want to proceed?").printf(objects.data.display_name);
else
prompt = _("One or more of the deleted keys are private keys. Are you sure you want to proceed?");
- if (!Util.prompt_delete (prompt))
+ if (!Util.prompt_delete (prompt, window))
return;
}
}
Modified: trunk/src/vala-build.stamp
==============================================================================
--- trunk/src/vala-build.stamp (original)
+++ trunk/src/vala-build.stamp Sun Jul 27 16:00:34 2008
@@ -1 +1 @@
-1217097103
+1217173424
Modified: trunk/ssh/Makefile.am
==============================================================================
--- trunk/ssh/Makefile.am (original)
+++ trunk/ssh/Makefile.am Sun Jul 27 16:00:34 2008
@@ -45,7 +45,6 @@
libseahorse_ssh_la_SOURCES = \
seahorse-ssh-module.c seahorse-ssh-module.h \
seahorse-algo.c seahorse-algo.h \
- seahorse-delete.c \
seahorse-ssh-dialogs.h \
seahorse-ssh-generate.c \
seahorse-ssh-key-data.c seahorse-ssh-key-data.h \
Modified: trunk/ssh/seahorse-ssh-commands.c
==============================================================================
--- trunk/ssh/seahorse-ssh-commands.c (original)
+++ trunk/ssh/seahorse-ssh-commands.c Sun Jul 27 16:00:34 2008
@@ -46,7 +46,7 @@
SEAHORSE_SSH_COMMANDS_COMMAND_ACTIONS
};
static void seahorse_ssh_commands_real_show_properties (SeahorseCommands* base, SeahorseObject* key);
-static void seahorse_ssh_commands_real_delete_objects (SeahorseCommands* base, GList* keys, GError** error);
+static SeahorseOperation* seahorse_ssh_commands_real_delete_objects (SeahorseCommands* base, GList* keys);
static void seahorse_ssh_commands_on_ssh_upload (SeahorseSSHCommands* self, GtkAction* action);
static void seahorse_ssh_commands_on_view_selection_changed (SeahorseSSHCommands* self, SeahorseView* view);
static void _seahorse_ssh_commands_on_ssh_upload_gtk_action_activate (GtkAction* _sender, gpointer self);
@@ -68,37 +68,34 @@
}
-static void seahorse_ssh_commands_real_delete_objects (SeahorseCommands* base, GList* keys, GError** error) {
+static SeahorseOperation* seahorse_ssh_commands_real_delete_objects (SeahorseCommands* base, GList* keys) {
SeahorseSSHCommands * self;
- GError * inner_error;
guint num;
char* prompt;
+ SeahorseOperation* _tmp4;
self = SEAHORSE_SSH_COMMANDS (base);
- g_return_if_fail (keys != NULL);
- inner_error = NULL;
+ g_return_val_if_fail (keys != NULL, NULL);
num = g_list_length (keys);
if (num == 0) {
- return;
+ return NULL;
}
prompt = NULL;
if (num == 1) {
- char* _tmp0;
- _tmp0 = NULL;
- prompt = (_tmp0 = g_strdup_printf (_ ("Are you sure you want to delete the secure shell key '%s'?"), seahorse_object_get_display_name (((SeahorseObject*) (((SeahorseObject*) (keys->data)))))), (prompt = (g_free (prompt), NULL)), _tmp0);
- } else {
char* _tmp1;
_tmp1 = NULL;
- prompt = (_tmp1 = g_strdup_printf (_ ("Are you sure you want to delete %d secure shell keys?"), num), (prompt = (g_free (prompt), NULL)), _tmp1);
- }
- if (seahorse_util_prompt_delete (prompt)) {
- seahorse_source_delete_objects (keys, &inner_error);
- if (inner_error != NULL) {
- g_propagate_error (error, inner_error);
- prompt = (g_free (prompt), NULL);
- return;
- }
+ prompt = (_tmp1 = g_strdup_printf (_ ("Are you sure you want to delete the secure shell key '%s'?"), seahorse_object_get_display_name (((SeahorseObject*) (((SeahorseObject*) (keys->data)))))), (prompt = (g_free (prompt), NULL)), _tmp1);
+ } else {
+ char* _tmp2;
+ _tmp2 = NULL;
+ prompt = (_tmp2 = g_strdup_printf (_ ("Are you sure you want to delete %d secure shell keys?"), num), (prompt = (g_free (prompt), NULL)), _tmp2);
+ }
+ if (!seahorse_util_prompt_delete (prompt, NULL)) {
+ SeahorseOperation* _tmp3;
+ _tmp3 = NULL;
+ return (_tmp3 = NULL, (prompt = (g_free (prompt), NULL)), _tmp3);
}
- prompt = (g_free (prompt), NULL);
+ _tmp4 = NULL;
+ return (_tmp4 = seahorse_source_delete_objects (keys), (prompt = (g_free (prompt), NULL)), _tmp4);
}
Modified: trunk/ssh/seahorse-ssh-commands.h
==============================================================================
--- trunk/ssh/seahorse-ssh-commands.h (original)
+++ trunk/ssh/seahorse-ssh-commands.h Sun Jul 27 16:00:34 2008
@@ -26,6 +26,7 @@
#include <glib-object.h>
#include <seahorse-commands.h>
#include <seahorse-object.h>
+#include <seahorse-operation.h>
#include <stdlib.h>
#include <string.h>
#include <gtk/gtk.h>
Modified: trunk/ssh/seahorse-ssh-commands.vala
==============================================================================
--- trunk/ssh/seahorse-ssh-commands.vala (original)
+++ trunk/ssh/seahorse-ssh-commands.vala Sun Jul 27 16:00:34 2008
@@ -67,10 +67,10 @@
KeyProperties.show ((Ssh.Key)key, view.window);
}
- public override void delete_objects (List<Object> keys) throws GLib.Error {
+ public override Operation? delete_objects (List<Object> keys) {
uint num = keys.length();
if (num == 0)
- return;
+ return null;
string prompt;
if (num == 1)
@@ -78,8 +78,10 @@
else
prompt = _("Are you sure you want to delete %d secure shell keys?").printf(num);
- if (Util.prompt_delete (prompt))
- Seahorse.Source.delete_objects (keys);
+ if (!Util.prompt_delete (prompt))
+ return null;
+
+ return Seahorse.Source.delete_objects (keys);
}
private void on_ssh_upload (Action action) {
Modified: trunk/ssh/seahorse-ssh-operation.c
==============================================================================
--- trunk/ssh/seahorse-ssh-operation.c (original)
+++ trunk/ssh/seahorse-ssh-operation.c Sun Jul 27 16:00:34 2008
@@ -514,7 +514,7 @@
gtk_widget_destroy (GTK_WIDGET (pv->prompt_dialog));
pv->prompt_dialog = NULL;
- G_OBJECT_CLASS (operation_parent_class)->dispose (gobject);
+ G_OBJECT_CLASS (ssh_operation_parent_class)->dispose (gobject);
}
static void
@@ -557,7 +557,7 @@
g_assert (pv->pid == 0 && pv->wpid == 0);
g_assert (pv->io_askpass == NULL && pv->stag_askpass == 0);
- G_OBJECT_CLASS (operation_parent_class)->finalize (gobject);
+ G_OBJECT_CLASS (ssh_operation_parent_class)->finalize (gobject);
}
static void
Modified: trunk/ssh/seahorse-ssh-source.c
==============================================================================
--- trunk/ssh/seahorse-ssh-source.c (original)
+++ trunk/ssh/seahorse-ssh-source.c Sun Jul 27 16:00:34 2008
@@ -647,18 +647,18 @@
return op;
}
-static gboolean
-seahorse_ssh_source_remove (SeahorseSource *sksrc, SeahorseObject *sobj,
- guint name, GError **err)
+static SeahorseOperation*
+seahorse_ssh_source_remove (SeahorseSource *sksrc, SeahorseObject *sobj)
{
SeahorseSSHKeyData *keydata = NULL;
SeahorseSSHSource *ssrc = SEAHORSE_SSH_SOURCE (sksrc);
gboolean ret = TRUE;
+ GError *err = NULL;
gchar *fullpath;
- g_assert (name == 0);
- g_assert (seahorse_object_get_source (sobj) == sksrc);
- g_assert (!err || !*err);
+ g_return_val_if_fail (SEAHORSE_IS_SSH_SOURCE (sksrc), NULL);
+ g_return_val_if_fail (SEAHORSE_IS_SSH_KEY (sksrc), NULL);
+ g_return_val_if_fail (seahorse_object_get_source (sobj) == sksrc, NULL);
g_object_get (sobj, "key-data", &keydata, NULL);
g_return_val_if_fail (keydata, FALSE);
@@ -668,15 +668,13 @@
/* Take just that line out of the file */
if (keydata->pubfile) {
- if (!seahorse_ssh_key_data_filter_file (keydata->pubfile, NULL, keydata, err))
- ret = FALSE;
+ seahorse_ssh_key_data_filter_file (keydata->pubfile, NULL, keydata, &err);
}
/* Make sure to take it out of any other files too */
if (ret && keydata->authorized) {
fullpath = seahorse_ssh_source_file_for_public (ssrc, FALSE);
- if (!seahorse_ssh_key_data_filter_file (fullpath, NULL, keydata, err))
- ret = FALSE;
+ seahorse_ssh_key_data_filter_file (fullpath, NULL, keydata, &err);
g_free (fullpath);
}
@@ -686,25 +684,23 @@
if (keydata->pubfile) {
if (g_unlink (keydata->pubfile) == -1) {
- g_set_error (err, G_FILE_ERROR, g_file_error_from_errno (errno),
+ g_set_error (&err, G_FILE_ERROR, g_file_error_from_errno (errno),
"%s", g_strerror (errno));
- ret = FALSE;
}
}
if (ret && keydata->privfile) {
if (g_unlink (keydata->privfile) == -1) {
- g_set_error (err, G_FILE_ERROR, g_file_error_from_errno (errno),
+ g_set_error (&err, G_FILE_ERROR, g_file_error_from_errno (errno),
"%s", g_strerror (errno));
- ret = FALSE;
}
}
}
-
- if (ret)
+
+ if (err == NULL)
seahorse_context_remove_object (SCTX_APP (), sobj);
- return ret;
+ return seahorse_operation_new_complete (err);
}
static void
Modified: trunk/ssh/vala-build.stamp
==============================================================================
--- trunk/ssh/vala-build.stamp (original)
+++ trunk/ssh/vala-build.stamp Sun Jul 27 16:00:34 2008
@@ -1 +1 @@
-1216679059
+1217171790
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]