diff options
Diffstat (limited to 'src/nmtui/nmt-utils.h')
| -rw-r--r-- | src/nmtui/nmt-utils.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/nmtui/nmt-utils.h b/src/nmtui/nmt-utils.h index 3b780ae7..79058c0d 100644 --- a/src/nmtui/nmt-utils.h +++ b/src/nmtui/nmt-utils.h @@ -6,6 +6,8 @@ #ifndef NMT_UTILS_H #define NMT_UTILS_H +#include "libnmt-newt/nmt-newt-types.h" + typedef struct { gpointer private[3]; } NmtSyncOp; @@ -18,4 +20,37 @@ void nmt_sync_op_complete_boolean(NmtSyncOp *op, gboolean result, GError *er gpointer nmt_sync_op_wait_pointer(NmtSyncOp *op, GError **error); void nmt_sync_op_complete_pointer(NmtSyncOp *op, gpointer result, GError *error); +gboolean nmt_utils_filter_match(const char *haystack, const char *needle); + +#define NMT_SEARCH_ENTRY_WIDTH 34 + +/** + * NmtSearch: + * + * Vim-style '/' search glue shared by the connection lists. The caller builds + * the @label and @entry into its own layout and hands them over; NmtSearch + * wires '/' to reveal the entry, Enter to confirm, Esc to clear, keeps the + * status label in sync, and pins the form width so the list does not jump. + * + * @apply is invoked with the current text whenever the filter changes; @count + * returns the live match count for the label. + */ +typedef struct _NmtSearch NmtSearch; + +typedef void (*NmtSearchApplyFunc)(gpointer user_data, const char *text); +typedef int (*NmtSearchCountFunc)(gpointer user_data); + +NmtSearch *nmt_search_new(NmtNewtEntry *entry, + NmtNewtLabel *label, + NmtNewtWidget *focus, + NmtSearchApplyFunc apply, + NmtSearchCountFunc count, + gpointer user_data); + +void nmt_search_bind_form(NmtSearch *search, NmtNewtForm *form); +void nmt_search_update_label(NmtSearch *search); + +GVariant * +nmt_sync_get_secrets(NMRemoteConnection *connection, const char *setting_name, GError **error); + #endif /* NMT_UTILS_H */ |