## Search Functionality

Search Functionality — Find Keyring Items

## Synopsis

                        MateKeyringFound;
    void                mate_keyring_found_free            (MateKeyringFound *found);
    void                mate_keyring_found_list_free       (GList *found_list);
    gpointer            mate_keyring_find_items            (MateKeyringItemType type,
                                                             MateKeyringAttributeList *attributes,
                                                             MateKeyringOperationGetListCallback callback,
                                                             gpointer data,
                                                             GDestroyNotify destroy_data);
    gpointer            mate_keyring_find_itemsv           (MateKeyringItemType type,
                                                             MateKeyringOperationGetListCallback callback,
                                                             gpointer data,
                                                             GDestroyNotify destroy_data,
                                                             ...);
    MateKeyringResult  mate_keyring_find_items_sync       (MateKeyringItemType type,
                                                             MateKeyringAttributeList *attributes,
                                                             GList **found);
    MateKeyringResult  mate_keyring_find_itemsv_sync      (MateKeyringItemType type,
                                                             GList **found,
                                                             ...);

## Description

A find operation searches through all keyrings for items that match the attributes. The user may have been prompted to unlock necessary keyrings, and user will have been prompted for access to the items if needed.

A find operation may return multiple or zero results.

## Details

### MateKeyringFound

    typedef struct {
    	char *keyring;
    	guint item_id;
    	MateKeyringAttributeList *attributes;
    	char *secret;
    } MateKeyringFound;

### mate_keyring_found_free ()

    void                mate_keyring_found_free            (MateKeyringFound *found);

`found` : |

### mate_keyring_found_list_free ()

    void                mate_keyring_found_list_free       (GList *found_list);

Free the memory used by the MateKeyringFound items in `found_list`.

`found_list` : | a GList of MateKeyringFound

### mate_keyring_find_items ()

    gpointer            mate_keyring_find_items            (MateKeyringItemType type,
                                                             MateKeyringAttributeList *attributes,
                                                             MateKeyringOperationGetListCallback callback,
                                                             gpointer data,
                                                             GDestroyNotify destroy_data);

Searches through all keyrings for items that match the `attributes`. The matches are for exact equality.

A `GList` of MateKeyringFound structures are passed to the `callback`. The list and structures are freed after the callback returns.

The user may have been prompted to unlock necessary keyrings, and user will have been prompted for access to the items if needed.

For a synchronous version of this function see `mate_keyring_find_items_sync()`.

`type` : | The type of items to find.
`attributes` : | A list of attributes to search for. This cannot be an empty list.
`callback` : | A callback which will be called when the request completes or fails.
`data` : | A pointer to arbitrary data that will be passed to the `callback`.
`destroy_data` : | A function to free `data` when it's no longer needed.
Returns : | The asychronous request, which can be passed to `mate_keyring_cancel_request()`.

### mate_keyring_find_itemsv ()

    gpointer            mate_keyring_find_itemsv           (MateKeyringItemType type,
                                                             MateKeyringOperationGetListCallback callback,
                                                             gpointer data,
                                                             GDestroyNotify destroy_data,
                                                             ...);

Searches through all keyrings for items that match the specified attributes. The matches are for exact equality.

The variable argument list should contain a) The attribute name as a null terminated string, followed by b) The attribute type, either `MATE_KEYRING_ATTRIBUTE_TYPE_STRING` or `MATE_KEYRING_ATTRIBUTE_TYPE_UINT32` and then the c) attribute value, either a character string, or 32-bit unsigned int. The list should be terminated with a NULL.

A `GList` of MateKeyringFound structures are passed to the `callback`. The list and structures are freed after the callback returns.

The user may have been prompted to unlock necessary keyrings, and user will have been prompted for access to the items if needed.

For a synchronous version of this function see `mate_keyring_find_itemsv_sync()`.

`type` : | The type of items to find.
`callback` : | A callback which will be called when the request completes or fails.
`data` : | A pointer to arbitrary data that will be passed to the `callback`.
`destroy_data` : | A function to free `data` when it's no longer needed.
`...` : | Attribute name, followed by the attribute type, and string or 32-bit unsigned int value. Terminated with NULL.
Returns : | The asychronous request, which can be passed to `mate_keyring_cancel_request()`.

### mate_keyring_find_items_sync ()

    MateKeyringResult  mate_keyring_find_items_sync       (MateKeyringItemType type,
                                                             MateKeyringAttributeList *attributes,
                                                             GList **found);

Searches through all keyrings for items that match the `attributes` and `type`. The matches are for exact equality.

A `GList` of MateKeyringFound structures is returned in `found`. The list may have zero items if nothing matched the criteria. The list should be freed using `mate_keyring_found_list_free()`.

The user may have been prompted to unlock necessary keyrings, and user will have been prompted for access to the items if needed.

For an asynchronous version of this function see `mate_keyring_find_items()`.

`type` : | The type of items to find.
`attributes` : | A list of attributes to search for. This cannot be an empty list.
`found` : | The location to return a list of MateKeyringFound pointers.
Returns : | `MATE_KEYRING_RESULT_OK` if the operation was succcessful or an error result otherwise.

### mate_keyring_find_itemsv_sync ()

    MateKeyringResult  mate_keyring_find_itemsv_sync      (MateKeyringItemType type,
                                                             GList **found,
                                                             ...);

Searches through all keyrings for items that match the `attributes` and `type`. The matches are for exact equality.

The variable argument list should contain a) The attribute name as a null terminated string, followed by b) The attribute type, either `MATE_KEYRING_ATTRIBUTE_TYPE_STRING` or `MATE_KEYRING_ATTRIBUTE_TYPE_UINT32` and then the c) attribute value, either a character string, or 32-bit unsigned int. The list should be terminated with a NULL.

A `GList` of MateKeyringFound structures is returned in `found`. The list may have zero items if nothing matched the criteria. The list should be freed using `mate_keyring_found_list_free()`.

The user may have been prompted to unlock necessary keyrings, and user will have been prompted for access to the items if needed.

For an asynchronous version of this function see `mate_keyring_find_items()`.

`type` : | The type of items to find.
`found` : | The location to return a list of MateKeyringFound pointers.
`...` : | Attribute name, followed by the attribute type, and string or 32-bit unsigned int value. Terminated with NULL.
Returns : | `MATE_KEYRING_RESULT_OK` if the operation was succcessful or an error result otherwise.