1 /*
2    FSearch - A fast file search utility
3    Copyright © 2016 Christian Boxdörfer
4 
5    This program is free software; you can redistribute it and/or modify
6    it under the terms of the GNU General Public License as published by
7    the Free Software Foundation; either version 2 of the License, or
8    (at your option) any later version.
9 
10    This program is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13    GNU General Public License for more details.
14 
15    You should have received a copy of the GNU General Public License
16    along with this program; if not, see <http://www.gnu.org/licenses/>.
17    */
18 
19 #pragma once
20 
21 #include <stdbool.h>
22 #include <stdint.h>
23 #include <glib.h>
24 
25 typedef struct _FsearchConfig FsearchConfig;
26 
27 struct _FsearchConfig
28 {
29     // Search
30     bool limit_results;
31     bool hide_results_on_empty_search;
32     bool search_in_path;
33     bool enable_regex;
34     bool match_case;
35     bool auto_search_in_path;
36     bool search_as_you_type;
37     bool show_base_2_units;
38 
39     // Applications
40     char *folder_open_cmd;
41 
42     // Window
43     bool restore_window_size;
44     int32_t window_width;
45     int32_t window_height;
46 
47     // Interface
48     bool enable_dark_theme;
49     bool enable_list_tooltips;
50     bool restore_column_config;
51     uint32_t action_after_file_open;
52     bool action_after_file_open_keyboard;
53     bool action_after_file_open_mouse;
54 
55     // Warning Dialogs
56     bool show_dialog_failed_opening;
57 
58     // View menu
59     bool show_menubar;
60     bool show_statusbar;
61     bool show_filter;
62     bool show_search_button;
63 
64     // Columns
65     bool show_listview_icons;
66     bool show_path_column;
67     bool show_type_column;
68     bool show_size_column;
69     bool show_modified_column;
70 
71     uint32_t name_column_width;
72     uint32_t path_column_width;
73     uint32_t type_column_width;
74     uint32_t size_column_width;
75     uint32_t modified_column_width;
76 
77     uint32_t name_column_pos;
78     uint32_t path_column_pos;
79     uint32_t type_column_pos;
80     uint32_t size_column_pos;
81     uint32_t modified_column_pos;
82 
83     // database
84     bool update_database_on_launch;
85     bool exclude_hidden_items;
86     bool follow_symlinks;
87 
88     uint32_t num_results;
89 
90     GList *locations;
91     GList *exclude_locations;
92     char **exclude_files;
93 };
94 
95 
96 bool
97 config_make_dir (void);
98 
99 bool
100 config_load (FsearchConfig *config);
101 
102 bool
103 config_load_default (FsearchConfig *config);
104 
105 bool
106 config_save (FsearchConfig *config);
107 
108 void
109 config_build_dir (char *path, size_t len);
110 
111 void
112 config_free (FsearchConfig *config);
113