diff --git a/inc/map.h b/inc/map.h index 16ce6d5..faa66be 100644 --- a/inc/map.h +++ b/inc/map.h @@ -18,13 +18,9 @@ #ifndef MAP_H #define MAP_H -#include -#include -#include +#include #include -#include - struct map* map_init(void); struct map* map_init_void(void); diff --git a/inc/wofi.h b/inc/wofi.h index 6fa1840..4170182 100644 --- a/inc/wofi.h +++ b/inc/wofi.h @@ -18,7 +18,8 @@ #ifndef WAIFU_H #define WAIFU_H -#include +#include + #include #include @@ -35,35 +36,5 @@ #include #include -#include #include - -struct cache_line { - char* line; - struct wl_list link; -}; - -void wofi_init(struct map* config); - -char* wofi_parse_image_escapes(const char* text); - -void wofi_write_cache(const gchar* mode, const gchar* cmd); - -void wofi_remove_cache(const gchar* mode, const gchar* cmd); - -struct wl_list* wofi_read_cache(char* mode); - -struct widget* wofi_create_widget(char* mode, char** text, char* search_text, char** actions, size_t action_count); - -bool wofi_allow_images(void); - -bool wofi_allow_markup(void); - -uint64_t wofi_get_image_size(void); - -bool wofi_mod_shift(void); - -bool wofi_mod_control(void); - -void wofi_term_run(const char* cmd); #endif diff --git a/inc/wofi_api.h b/inc/wofi_api.h new file mode 100644 index 0000000..5455a30 --- /dev/null +++ b/inc/wofi_api.h @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2020 Scoopta + * This file is part of Wofi + * Wofi is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Wofi is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Wofi. If not, see . + */ + +#ifndef WOFI_API_H +#define WOFI_API_H + +#include + +#include +#include + +#include + +struct cache_line { + char* line; + struct wl_list link; +}; + +void wofi_init(struct map* config); + +char* wofi_parse_image_escapes(const char* text); + +void wofi_write_cache(const char* mode, const char* cmd); + +void wofi_remove_cache(const char* mode, const char* cmd); + +struct wl_list* wofi_read_cache(char* mode); + +struct widget* wofi_create_widget(char* mode, char** text, char* search_text, char** actions, size_t action_count); + +bool wofi_allow_images(void); + +bool wofi_allow_markup(void); + +uint64_t wofi_get_image_size(void); + +bool wofi_mod_shift(void); + +bool wofi_mod_control(void); + +void wofi_term_run(const char* cmd); + +#endif diff --git a/src/map.c b/src/map.c index ab93904..8bf3db4 100644 --- a/src/map.c +++ b/src/map.c @@ -17,6 +17,12 @@ #include +#include +#include +#include + +#include + struct map { GTree* tree; bool mman; diff --git a/src/wofi.c b/src/wofi.c index 73ba8c5..e7c54b6 100644 --- a/src/wofi.c +++ b/src/wofi.c @@ -415,7 +415,7 @@ static gboolean _insert_widget(gpointer data) { return TRUE; } -void wofi_write_cache(const gchar* mode, const gchar* cmd) { +void wofi_write_cache(const char* mode, const char* cmd) { char* cache_path = get_cache_path(mode); struct wl_list lines; wl_list_init(&lines); @@ -483,7 +483,7 @@ void wofi_write_cache(const gchar* mode, const gchar* cmd) { free(tmp_path); } -void wofi_remove_cache(const gchar* mode, const gchar* cmd) { +void wofi_remove_cache(const char* mode, const char* cmd) { char* cache_path = get_cache_path(mode); if(access(cache_path, R_OK | W_OK) == 0) { struct wl_list lines;