diff options
author | Ian Fan <ianfan0@gmail.com> | 2019-01-17 16:47:44 +0000 |
---|---|---|
committer | emersion <contact@emersion.fr> | 2019-03-11 14:42:58 +0100 |
commit | 5c8424c0743c36b11baabe8b316ee6daecd0cfb8 (patch) | |
tree | f29b11a1230d2dd85aba556d3c9647737808e09b /swaybar | |
parent | sway_view_child: add listener for view unmap (diff) | |
download | sway-5c8424c0743c36b11baabe8b316ee6daecd0cfb8.tar.gz sway-5c8424c0743c36b11baabe8b316ee6daecd0cfb8.tar.zst sway-5c8424c0743c36b11baabe8b316ee6daecd0cfb8.zip |
stringop.c: remove unused functions
The only use of `join_list` in swaybar/tray/icon.c has been rewritten.
Diffstat (limited to 'swaybar')
-rw-r--r-- | swaybar/tray/icon.c | 47 |
1 files changed, 38 insertions, 9 deletions
diff --git a/swaybar/tray/icon.c b/swaybar/tray/icon.c index bf2736c2..c7ce20b4 100644 --- a/swaybar/tray/icon.c +++ b/swaybar/tray/icon.c | |||
@@ -301,6 +301,43 @@ static list_t *load_themes_in_dir(char *basedir) { | |||
301 | return themes; | 301 | return themes; |
302 | } | 302 | } |
303 | 303 | ||
304 | static void log_loaded_themes(list_t *themes) { | ||
305 | if (themes->length == 0) { | ||
306 | sway_log(SWAY_INFO, "Warning: no icon themes loaded"); | ||
307 | return; | ||
308 | } | ||
309 | |||
310 | const char *sep = ", "; | ||
311 | size_t sep_len = strlen(sep); | ||
312 | |||
313 | size_t len = 1 - sep_len; | ||
314 | for (int i = 0; i < themes->length; ++i) { | ||
315 | struct icon_theme *theme = themes->items[i]; | ||
316 | len += strlen(theme->name) + sep_len; | ||
317 | } | ||
318 | |||
319 | char *str = malloc(len); | ||
320 | if (!str) { | ||
321 | return; | ||
322 | } | ||
323 | char *p = str; | ||
324 | for (int i = 0; i < themes->length; ++i) { | ||
325 | if (i > 0) { | ||
326 | memcpy(p, sep, sep_len); | ||
327 | p += sep_len; | ||
328 | } | ||
329 | |||
330 | struct icon_theme *theme = themes->items[i]; | ||
331 | size_t name_len = strlen(theme->name); | ||
332 | memcpy(p, theme->name, name_len); | ||
333 | p += name_len; | ||
334 | } | ||
335 | *p = '\0'; | ||
336 | |||
337 | sway_log(SWAY_DEBUG, "Loaded icon themes: %s", str); | ||
338 | free(str); | ||
339 | } | ||
340 | |||
304 | void init_themes(list_t **themes, list_t **basedirs) { | 341 | void init_themes(list_t **themes, list_t **basedirs) { |
305 | *basedirs = get_basedirs(); | 342 | *basedirs = get_basedirs(); |
306 | 343 | ||
@@ -311,15 +348,7 @@ void init_themes(list_t **themes, list_t **basedirs) { | |||
311 | list_free(dir_themes); | 348 | list_free(dir_themes); |
312 | } | 349 | } |
313 | 350 | ||
314 | list_t *theme_names = create_list(); | 351 | log_loaded_themes(*themes); |
315 | for (int i = 0; i < (*themes)->length; ++i) { | ||
316 | struct icon_theme *theme = (*themes)->items[i]; | ||
317 | list_add(theme_names, theme->name); | ||
318 | } | ||
319 | char *theme_list = join_list(theme_names, ", "); | ||
320 | sway_log(SWAY_DEBUG, "Loaded themes: %s", theme_list); | ||
321 | free(theme_list); | ||
322 | list_free(theme_names); | ||
323 | } | 352 | } |
324 | 353 | ||
325 | void finish_themes(list_t *themes, list_t *basedirs) { | 354 | void finish_themes(list_t *themes, list_t *basedirs) { |