/** * cryptui_key_store_set_filter: * @ckstore: a libcryptui key store * @func: a filter function * @user_data: a generic pointer * * Filters the key store's keys with the given filter function. */ void cryptui_key_store_set_filter (CryptUIKeyStore *ckstore, CryptUIKeyStoreFilterFunc func, gpointer user_data) { ckstore->priv->filter_func = func; ckstore->priv->filter_data = user_data; refilter_later (ckstore); }
/** * cryptui_key_store_set_search_mode: * @ckstore: a libcryptui key store * @mode: search mode * * Sets whether the keys returned will be all, just those searched for, or * those selected. */ void cryptui_key_store_set_search_mode (CryptUIKeyStore *ckstore, CryptUIKeyStoreMode mode) { if (ckstore->priv->filter_mode != mode) { ckstore->priv->filter_mode = mode; refilter_later (ckstore); } }
static void seahorse_key_manager_store_set_property (GObject *gobject, guint prop_id, const GValue *value, GParamSpec *pspec) { SeahorseKeyManagerStore *skstore = SEAHORSE_KEY_MANAGER_STORE (gobject); const gchar* t; switch (prop_id) { /* The filtering mode */ case PROP_MODE: if (skstore->priv->filter_mode != g_value_get_uint (value)) { skstore->priv->filter_mode = g_value_get_uint (value); refilter_later (skstore); } break; case PROP_SETTINGS: skstore->priv->settings = g_value_dup_object (value); break; /* The filter text */ case PROP_FILTER: t = g_value_get_string (value); /* * If we're not in filtered mode and there is text OR * we're in filtered mode (regardless of text or not) * then update the filter */ if ((skstore->priv->filter_mode != KEY_STORE_MODE_FILTERED && t && t[0]) || (skstore->priv->filter_mode == KEY_STORE_MODE_FILTERED)) { skstore->priv->filter_mode = KEY_STORE_MODE_FILTERED; g_free (skstore->priv->filter_text); /* We always use lower case text (see filter_callback) */ skstore->priv->filter_text = g_utf8_strdown (t, -1); refilter_later (skstore); } break; default: break; } }
/** * cryptui_key_store_set_search_text: * @ckstore: a libcryptui key store * @search_text: a string * * Filters the keys in the store by the text in search_text. */ void cryptui_key_store_set_search_text (CryptUIKeyStore *ckstore, const gchar *search_text) { /* * If we're not in filtered mode and there is text OR * we're in results mode (regardless of text or not) * then update the results */ if ((ckstore->priv->filter_mode != CRYPTUI_KEY_STORE_MODE_RESULTS && search_text && search_text[0]) || (ckstore->priv->filter_mode == CRYPTUI_KEY_STORE_MODE_RESULTS)) { ckstore->priv->filter_mode = CRYPTUI_KEY_STORE_MODE_RESULTS; g_free (ckstore->priv->search_text); /* We always use lower case text (see filter_callback) */ ckstore->priv->search_text = g_utf8_strdown (search_text, -1); refilter_later (ckstore); } }