mirror of
https://github.com/davatorium/rofi.git
synced 2024-11-18 13:54:36 -05:00
[Help] Print out the parsed config/theme files.
This commit is contained in:
parent
2614fe4425
commit
f0500a5a0e
3 changed files with 44 additions and 10 deletions
|
@ -454,4 +454,17 @@ RofiDistance rofi_theme_property_copy_distance(RofiDistance const distance);
|
|||
*/
|
||||
int rofi_theme_rasi_validate(const char *filename);
|
||||
|
||||
/**
|
||||
*
|
||||
* Free memory.
|
||||
*/
|
||||
void rofi_theme_free_parsed_files(void);
|
||||
|
||||
/**
|
||||
* @param is_term Indicate if printed to terminal.
|
||||
*
|
||||
* Print the list of parsed config files.
|
||||
*/
|
||||
void rofi_theme_print_parsed_files(int is_term);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -269,7 +269,7 @@ static void print_list_of_modi(int is_term) {
|
|||
break;
|
||||
}
|
||||
}
|
||||
printf(" * %s%s%s%s\n", active ? "+" : "",
|
||||
printf(" • %s%s%s%s\n", active ? "+" : "",
|
||||
is_term ? (active ? color_green : color_red) : "",
|
||||
available_modi[i]->name, is_term ? color_reset : "");
|
||||
}
|
||||
|
@ -328,31 +328,31 @@ static void help(G_GNUC_UNUSED int argc, char **argv) {
|
|||
printf("\n");
|
||||
printf("Compile time options:\n");
|
||||
#ifdef WINDOW_MODE
|
||||
printf("\t* window %senabled%s\n", is_term ? color_green : "",
|
||||
printf("\t• window %senabled%s\n", is_term ? color_green : "",
|
||||
is_term ? color_reset : "");
|
||||
#else
|
||||
printf("\t* window %sdisabled%s\n", is_term ? color_red : "",
|
||||
printf("\t• window %sdisabled%s\n", is_term ? color_red : "",
|
||||
is_term ? color_reset : "");
|
||||
#endif
|
||||
#ifdef ENABLE_DRUN
|
||||
printf("\t* drun %senabled%s\n", is_term ? color_green : "",
|
||||
printf("\t• drun %senabled%s\n", is_term ? color_green : "",
|
||||
is_term ? color_reset : "");
|
||||
#else
|
||||
printf("\t* drun %sdisabled%s\n", is_term ? color_red : "",
|
||||
printf("\t• drun %sdisabled%s\n", is_term ? color_red : "",
|
||||
is_term ? color_reset : "");
|
||||
#endif
|
||||
#ifdef ENABLE_GCOV
|
||||
printf("\t* gcov %senabled%s\n", is_term ? color_green : "",
|
||||
printf("\t• gcov %senabled%s\n", is_term ? color_green : "",
|
||||
is_term ? color_reset : "");
|
||||
#else
|
||||
printf("\t* gcov %sdisabled%s\n", is_term ? color_red : "",
|
||||
printf("\t• gcov %sdisabled%s\n", is_term ? color_red : "",
|
||||
is_term ? color_reset : "");
|
||||
#endif
|
||||
#ifdef ENABLE_ASAN
|
||||
printf("\t* asan %senabled%s\n", is_term ? color_green : "",
|
||||
printf("\t• asan %senabled%s\n", is_term ? color_green : "",
|
||||
is_term ? color_reset : "");
|
||||
#else
|
||||
printf("\t* asan %sdisabled%s\n", is_term ? color_red : "",
|
||||
printf("\t• asan %sdisabled%s\n", is_term ? color_red : "",
|
||||
is_term ? color_reset : "");
|
||||
#endif
|
||||
printf("\n");
|
||||
|
@ -380,6 +380,7 @@ static void help(G_GNUC_UNUSED int argc, char **argv) {
|
|||
printf(" Configuration file: %sDisabled%s\n",
|
||||
is_term ? color_bold : "", is_term ? color_reset : "");
|
||||
}
|
||||
rofi_theme_print_parsed_files(is_term);
|
||||
}
|
||||
|
||||
static void help_print_disabled_mode(const char *mode) {
|
||||
|
@ -478,6 +479,7 @@ static void cleanup(void) {
|
|||
rofi_collect_modi_destroy();
|
||||
rofi_icon_fetcher_destroy();
|
||||
|
||||
rofi_theme_free_parsed_files();
|
||||
if (rofi_configuration) {
|
||||
rofi_theme_free(rofi_configuration);
|
||||
rofi_configuration = NULL;
|
||||
|
|
|
@ -46,6 +46,25 @@
|
|||
#include "widgets/textbox.h"
|
||||
#include <gio/gio.h>
|
||||
|
||||
GList *parsed_config_files = NULL;
|
||||
|
||||
void rofi_theme_free_parsed_files(void) {
|
||||
g_list_free_full(parsed_config_files, g_free);
|
||||
parsed_config_files = NULL;
|
||||
}
|
||||
|
||||
void rofi_theme_print_parsed_files(gboolean is_term) {
|
||||
printf("\nParsed files:\n");
|
||||
for (GList *iter = g_list_first(parsed_config_files); iter != NULL;
|
||||
iter = g_list_next(iter)) {
|
||||
printf("\t\u2022 %s%s%s\n",
|
||||
is_term ? color_bold : "", (const char *)(iter->data),
|
||||
is_term ? color_reset : "");
|
||||
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
void yyerror(YYLTYPE *yylloc, const char *, const char *);
|
||||
static gboolean distance_compare(RofiDistance d, RofiDistance e) {
|
||||
// TODO UPDATE
|
||||
|
@ -1361,7 +1380,7 @@ char *rofi_theme_parse_prepare_file(const char *file, const char *parent_file) {
|
|||
g_free(basedir);
|
||||
}
|
||||
GFile *gf = g_file_new_for_path(filename);
|
||||
g_free(filename);
|
||||
parsed_config_files = g_list_append(parsed_config_files, filename);
|
||||
filename = g_file_get_path(gf);
|
||||
g_object_unref(gf);
|
||||
|
||||
|
|
Loading…
Reference in a new issue