| 72 | | static char *get_activity_list(MAIN_WINDOW_REC *window, int normal, int hilight) |
| 73 | | { |
| 74 | | THEME_REC *theme; |
| 75 | | GString *str; |
| 76 | | GString *format; |
| 77 | | GList *tmp; |
| 78 | | char *ret, *name, *value; |
| 79 | | int is_det; |
| 80 | | int add_name = settings_get_bool("actlist_names"); |
| 81 | | |
| 82 | | str = g_string_new(NULL);
|
| 83 | | format = g_string_new(NULL);
|
| 84 | | |
| 85 | | theme = window != NULL && window->active != NULL &&
|
| 86 | | window->active->theme != NULL ?
|
| 87 | | window->active->theme : current_theme; |
| 88 | | |
| 89 | | for (tmp = activity_list; tmp != NULL; tmp = tmp->next) {
|
| 90 | | WINDOW_REC *window = tmp->data; |
| 91 | | |
| 92 | | is_det = window->data_level >= DATA_LEVEL_HILIGHT; |
| 93 | | if ((!is_det && !normal) || (is_det && !hilight)) |
| 94 | | continue; |
| 95 | | |
| 96 | | |
| 97 | | if (str->len > 0) { |
| 98 | | value = theme_format_expand(theme, "{sb_act_sep ,}"); |
| 99 | | g_string_append(str, value); |
| 100 | | g_free(value); |
| 101 | | } |
| 102 | | |
| 103 | | switch (window->data_level) { |
| 104 | | case DATA_LEVEL_NONE: |
| 105 | | case DATA_LEVEL_TEXT: |
| 106 | | name = "{sb_act_text %d"; |
| 107 | | break; |
| 108 | | case DATA_LEVEL_MSG: |
| 109 | | name = "{sb_act_msg %d"; |
| 110 | | break; |
| 111 | | default: |
| 112 | | if (window->hilight_color == NULL)
|
| 113 | | name = "{sb_act_hilight %d"; |
| 114 | | else |
| 115 | | name = NULL;
|
| 116 | | break; |
| 117 | | } |
| 118 | | |
| 119 | | if (name != NULL)
|
| 120 | | g_string_printf(format, name, window->refnum); |
| 121 | | else |
| 122 | | g_string_printf(format, "{sb_act_hilight_color %s %d", |
| 123 | | window->hilight_color, |
| 124 | | window->refnum); |
| 125 | | if (add_name && window->active != NULL)
|
| 126 | | g_string_append_printf(format, ":%s", window->active->visible_name); |
| 127 | | g_string_append_c(format, '}');
|
| 128 | | |
| 129 | | value = theme_format_expand(theme, format->str); |
| 130 | | g_string_append(str, value); |
| 131 | | g_free(value); |
| 132 | | } |
| 133 | | |
| 134 | | ret = str->len == 0 ? NULL : str->str;
|
| 135 | | g_string_free(str, ret == NULL);
|
| 136 | | g_string_free(format, TRUE);
|
| 137 | | return ret; |
| 138 | | } |