After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 341772 - Deleting a single key fails
Deleting a single key fails
Status: RESOLVED FIXED
Product: seahorse
Classification: Applications
Component: general
git master
Other Linux
: Normal normal
: 1.0.0
Assigned To: Seahorse Maintainer
Seahorse Maintainer
Depends on:
Blocks:
 
 
Reported: 2006-05-14 20:31 UTC by Adam Schreiber
Modified: 2006-05-16 14:49 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch based on Jim Pharis' work (2.94 KB, patch)
2006-05-14 20:32 UTC, Adam Schreiber
reviewed Details | Review
This patch fixed the problem. (699 bytes, patch)
2006-05-16 14:49 UTC, Stef Walter
committed Details | Review

Description Adam Schreiber 2006-05-14 20:31:35 UTC
Jim Pharis identified a bug whereby deleting multiple keys worked, but deleting single keys didn't.  He tracked down the error to libseahorse/seahorse-key-store.c:seahorse_key_store_get_selected_key() not setting the uid passed in correctly.  He determined that replacing instances of seahorse_key_store_get_selected_key() with seahorse_key_store_get_selected_keys() solves the problem.  Based on his work I will attach a patch that does that.  However, we should continue to investigate why 

gtk_tree_model_get (model, iter, KEY_STORE_UID, &uid, -1);

in key_from_iterator isn't setting the correct uid. Although when the key isn't a sub key, it should probably be set to 0.
Comment 1 Adam Schreiber 2006-05-14 20:32:36 UTC
Created attachment 65457 [details] [review]
Patch based on Jim Pharis' work
Comment 2 Stef Walter 2006-05-15 17:50:48 UTC
Does seahorse_key_store_get_selected_key not work? If not it should probably be fixed rather than putting work arounds all throughout the code.

Also this patch removes the ability to delete a single UID from the key manager. 
Comment 3 Adam Schreiber 2006-05-15 18:03:30 UTC
I think Jim is looking at whether the model contains the correct data.  I've only tested the bug against keys with 1 UID, the main one.  While it does remove that ability, should that level of granularity be present in the key manager?
Comment 4 Jim Pharis 2006-05-15 18:59:21 UTC
Nate,

seahorse_key_store_get_selected_key takes the uid as a param, its currently broken in seahorse-key-manager because the caller doesn't set uid. 

The seahorse_key_store_get_selected_key may or may not work, but either way I don't see the need for it when seahorse_key_store_get_selected_keys does, from what I can tell, the same thing, but without the need for the uid to be passed. That function ..._keys finds the uid from the view, and works correctly, even when needing to find a single key. Its like there is an entire extra function just for the single use case of finding 1 key.

- Jim

P.S. I ran through some model appends and it appears the correct data is getting into the model. I think it changing afterwards somehow (but before the view is displayed). I'm still looking.
Comment 5 Stef Walter 2006-05-16 14:37:00 UTC
(In reply to comment #3)
> I think Jim is looking at whether the model contains the correct data.  I've
> only tested the bug against keys with 1 UID, the main one.  While it does
> remove that ability, should that level of granularity be present in the key
> manager?

I think so. It makes sense to the user. "I select this row. I select delete. This row should go away." The principle of least suprise. 

(In reply to comment #4)
> seahorse_key_store_get_selected_key takes the uid as a param, its currently
> broken in seahorse-key-manager because the caller doesn't set uid. 

|uid| is an 'out' argument. You pass a guint* in and it returns the uid. If you pass in NULL it ignores that argument.

> The seahorse_key_store_get_selected_key may or may not work, but either way I
> don't see the need for it when seahorse_key_store_get_selected_keys does, from
> what I can tell, the same thing, but without the need for the uid to be passed.

Because as noted above, we like to only delete a single UID if that's what is selected.

> That function ..._keys finds the uid from the view, and works correctly, even
> when needing to find a single key. Its like there is an entire extra function
> just for the single use case of finding 1 key.

You'll find this all throughout seahorse. This prevents us from allocating a whole list of keys, and then freeing that list. In many cases it is worth it.

Comment 6 Stef Walter 2006-05-16 14:49:29 UTC
Created attachment 65594 [details] [review]
This patch fixed the problem.

It was a simple (but dumb) mistake in my recent refactoring... Committed.