[seahorse] Fix regression of configure key action



commit bad4930e1f26957ac9024befd93b57c5ca105392
Author: Stef Walter <stefw gnome org>
Date:   Fri Mar 9 14:50:49 2012 +0100

    Fix regression of configure key action
    
     * Make sure it's displayed at the right times
     * Fix selection of which key is uploaded
    
    https://bugzilla.gnome.org/show_bug.cgi?id=671525

 libseahorse/seahorse-catalog.c |    4 ++--
 ssh/seahorse-ssh-actions.c     |   24 ++++++++++++++++++------
 2 files changed, 20 insertions(+), 8 deletions(-)
---
diff --git a/libseahorse/seahorse-catalog.c b/libseahorse/seahorse-catalog.c
index ffe2221..38fcfaf 100644
--- a/libseahorse/seahorse-catalog.c
+++ b/libseahorse/seahorse-catalog.c
@@ -352,10 +352,10 @@ seahorse_catalog_real_selection_changed (SeahorseCatalog *self)
 	previous = self->pv->selection_actions;
 	self->pv->selection_actions = groups;
 
-	for (l = self->pv->selection_actions; l != NULL; l = g_list_next (l))
-		gtk_action_group_set_visible (l->data, TRUE);
 	for (l = previous; l != NULL; l = g_list_next (l))
 		gtk_action_group_set_visible (l->data, FALSE);
+	for (l = self->pv->selection_actions; l != NULL; l = g_list_next (l))
+		gtk_action_group_set_visible (l->data, TRUE);
 	g_list_free_full (previous, g_object_unref);
 }
 
diff --git a/ssh/seahorse-ssh-actions.c b/ssh/seahorse-ssh-actions.c
index a9504fd..a88b64e 100644
--- a/ssh/seahorse-ssh-actions.c
+++ b/ssh/seahorse-ssh-actions.c
@@ -76,12 +76,24 @@ static void
 on_ssh_upload (GtkAction* action,
                gpointer user_data)
 {
-	GList *ssh_keys = user_data;
-
-	if (ssh_keys == NULL)
-		return;
+	SeahorseActions *actions = SEAHORSE_ACTIONS (user_data);
+	SeahorseCatalog *catalog;
+	GList *keys, *objects, *l;
+
+	keys = NULL;
+	catalog = seahorse_actions_get_catalog (actions);
+
+	if (catalog != NULL) {
+		objects = seahorse_catalog_get_selected_objects (catalog);
+		for (l = objects; l != NULL; l = g_list_next (l)) {
+			if (SEAHORSE_IS_SSH_KEY (l->data))
+				keys = g_list_prepend (keys, l->data);
+		}
+		g_list_free (objects);
+	}
 
-	seahorse_ssh_upload_prompt (ssh_keys, seahorse_action_get_window (action));
+	seahorse_ssh_upload_prompt (keys, seahorse_action_get_window (action));
+	g_list_free (keys);
 }
 
 static const GtkActionEntry KEYS_ACTIONS[] = {
@@ -95,7 +107,7 @@ seahorse_ssh_actions_init (SeahorseSshActions *self)
 {
 	GtkActionGroup *actions = GTK_ACTION_GROUP (self);
 	gtk_action_group_set_translation_domain (actions, GETTEXT_PACKAGE);
-	gtk_action_group_add_actions (actions, KEYS_ACTIONS, G_N_ELEMENTS (KEYS_ACTIONS), NULL);
+	gtk_action_group_add_actions (actions, KEYS_ACTIONS, G_N_ELEMENTS (KEYS_ACTIONS), self);
 	seahorse_actions_register_definition (SEAHORSE_ACTIONS (self), UI_DEFINITION);
 }
 



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