コード例 #1
0
ファイル: cryptui-test-ui.c プロジェクト: MagAdena/libcryptui
static void
print_keyset (CryptUIKeyset *keyset)
{
    GList *keys, *l;
    gboolean cache = FALSE;
    gchar *name;
    guint flags;
    
    keys = cryptui_keyset_get_keys (keyset);
    
    for(l = keys; l; l = g_list_next (l)) {
        g_print ("key: %s\n", (gchar*)l->data);
        
        /* Test half of them cached, half not */
        if (cache)
            cryptui_keyset_cache_key (keyset, (gchar*)l->data);
        cache = !cache;
        
        name = cryptui_keyset_key_display_name (keyset, (gchar*)l->data);
        g_print ("     name: %s\n", name);
        g_free (name);
        
        name = cryptui_keyset_key_display_id (keyset, (gchar*)l->data);
        g_print ("     id: %s\n", name);
        g_free (name);
        
        flags = cryptui_keyset_key_flags (keyset, (gchar*)l->data);
        g_print ("     flags: %d\n", flags);
    }
}
コード例 #2
0
ファイル: cryptui-key-store.c プロジェクト: nobled/seahorse
/* Sets Name and KeyID */
static void
key_store_set (CryptUIKeyStore *ckstore, const gchar *key, GtkTreeIter *iter)
{
    gchar *userid, *keyid;
    gboolean sec;

    cryptui_keyset_cache_key (ckstore->ckset, key);

    userid = cryptui_keyset_key_display_name (ckstore->ckset, key);
    keyid = cryptui_keyset_key_display_id (ckstore->ckset, key);
    sec = cryptui_key_get_enctype (key) == CRYPTUI_ENCTYPE_PRIVATE;

    gtk_tree_store_set (ckstore->priv->store, iter,
                        CRYPTUI_KEY_STORE_CHECK, FALSE,
                        CRYPTUI_KEY_STORE_PAIR, sec,
                        CRYPTUI_KEY_STORE_STOCK_ID, NULL,
                        CRYPTUI_KEY_STORE_NAME, userid,
                        CRYPTUI_KEY_STORE_KEYID, keyid,
                        -1);

    g_free (userid);
    g_free (keyid);
}