@@ -19,6 +19,7 @@ static void print_config(struct swappy_config *config) {
19
19
g_info ("line_size: %d" , config -> line_size );
20
20
g_info ("text_font: %s" , config -> text_font );
21
21
g_info ("text_size: %d" , config -> text_size );
22
+ g_info ("paint_mode: %d" , config -> paint_mode );
22
23
}
23
24
24
25
static char * get_default_save_dir () {
@@ -75,6 +76,7 @@ static void load_config_from_file(struct swappy_config *config,
75
76
gchar * save_dir_expanded = NULL ;
76
77
guint64 line_size , text_size ;
77
78
gchar * text_font = NULL ;
79
+ gchar * paint_mode = NULL ;
78
80
GError * error = NULL ;
79
81
80
82
if (file == NULL ) {
@@ -180,6 +182,32 @@ static void load_config_from_file(struct swappy_config *config,
180
182
error = NULL ;
181
183
}
182
184
185
+ paint_mode = g_key_file_get_string (gkf , group , "paint_mode" , & error );
186
+
187
+ if (error == NULL ) {
188
+ if (g_ascii_strcasecmp (paint_mode , "brush" ) == 0 ) {
189
+ config -> paint_mode = SWAPPY_PAINT_MODE_BRUSH ;
190
+ } else if (g_ascii_strcasecmp (paint_mode , "text" ) == 0 ) {
191
+ config -> paint_mode = SWAPPY_PAINT_MODE_TEXT ;
192
+ } else if (g_ascii_strcasecmp (paint_mode , "rectangle" ) == 0 ) {
193
+ config -> paint_mode = SWAPPY_PAINT_MODE_RECTANGLE ;
194
+ } else if (g_ascii_strcasecmp (paint_mode , "ellipse" ) == 0 ) {
195
+ config -> paint_mode = SWAPPY_PAINT_MODE_ELLIPSE ;
196
+ } else if (g_ascii_strcasecmp (paint_mode , "arrow" ) == 0 ) {
197
+ config -> paint_mode = SWAPPY_PAINT_MODE_ARROW ;
198
+ } else if (g_ascii_strcasecmp (paint_mode , "blur" ) == 0 ) {
199
+ config -> paint_mode = SWAPPY_PAINT_MODE_BLUR ;
200
+ } else {
201
+ g_warning (
202
+ "paint_mode is not a valid value: %s - see man page for details" ,
203
+ paint_mode );
204
+ }
205
+ } else {
206
+ g_info ("paint_mode is missing in %s (%s)" , file , error -> message );
207
+ g_error_free (error );
208
+ error = NULL ;
209
+ }
210
+
183
211
g_key_file_free (gkf );
184
212
}
185
213
@@ -194,6 +222,7 @@ static void load_default_config(struct swappy_config *config) {
194
222
config -> text_font = g_strdup (CONFIG_TEXT_FONT_DEFAULT );
195
223
config -> text_size = CONFIG_TEXT_SIZE_DEFAULT ;
196
224
config -> show_panel = CONFIG_SHOW_PANEL_DEFAULT ;
225
+ config -> paint_mode = CONFIG_PAINT_MODE_DEFAULT ;
197
226
}
198
227
199
228
void config_load (struct swappy_state * state ) {
0 commit comments