diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2010-06-11 17:00:07 +0200 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2010-06-11 17:00:07 +0200 |
commit | 63bc14e805d88162aae8498d8a798974da742269 (patch) | |
tree | 02151b5029564bf830fbd58fe7ef4a94157d8a8f /src | |
parent | b54af6af0be62ef1ad3c02b93bc99085d5b69116 (diff) | |
download | weechat-63bc14e805d88162aae8498d8a798974da742269.zip |
Fix refresh of bar item when it is used more than one time in a bar
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/gui-bar-item.c | 38 | ||||
-rw-r--r-- | src/gui/gui-bar.c | 39 | ||||
-rw-r--r-- | src/gui/gui-bar.h | 3 |
3 files changed, 23 insertions, 57 deletions
diff --git a/src/gui/gui-bar-item.c b/src/gui/gui-bar-item.c index e29183d08..97c826cdb 100644 --- a/src/gui/gui-bar-item.c +++ b/src/gui/gui-bar-item.c @@ -452,30 +452,38 @@ gui_bar_item_update (const char *item_name) for (ptr_bar = gui_bars; ptr_bar; ptr_bar = ptr_bar->next_bar) { - gui_bar_get_item_index (ptr_bar, item_name, &index_item, &index_subitem); - if ((index_item >= 0) && (index_subitem >= 0)) + for (index_item = 0; index_item < ptr_bar->items_count; index_item++) { - if (ptr_bar->bar_window) + for (index_subitem = 0; + index_subitem < ptr_bar->items_subcount[index_item]; + index_subitem++) { - ptr_bar->bar_window->items_refresh_needed[index_item][index_subitem] = 1; - } - else - { - for (ptr_window = gui_windows; ptr_window; - ptr_window = ptr_window->next_window) + if (gui_bar_item_string_is_item (ptr_bar->items_array[index_item][index_subitem], + item_name)) { - for (ptr_bar_window = ptr_window->bar_windows; - ptr_bar_window; - ptr_bar_window = ptr_bar_window->next_bar_window) + if (ptr_bar->bar_window) + { + ptr_bar->bar_window->items_refresh_needed[index_item][index_subitem] = 1; + } + else { - if (ptr_bar_window->bar == ptr_bar) + for (ptr_window = gui_windows; ptr_window; + ptr_window = ptr_window->next_window) { - ptr_bar_window->items_refresh_needed[index_item][index_subitem] = 1; + for (ptr_bar_window = ptr_window->bar_windows; + ptr_bar_window; + ptr_bar_window = ptr_bar_window->next_bar_window) + { + if (ptr_bar_window->bar == ptr_bar) + { + ptr_bar_window->items_refresh_needed[index_item][index_subitem] = 1; + } + } } } + gui_bar_ask_refresh (ptr_bar); } } - gui_bar_ask_refresh (ptr_bar); } } } diff --git a/src/gui/gui-bar.c b/src/gui/gui-bar.c index 42db64852..b9f19ffe7 100644 --- a/src/gui/gui-bar.c +++ b/src/gui/gui-bar.c @@ -299,45 +299,6 @@ gui_bar_get_filling (struct t_gui_bar *bar) } /* - * gui_bar_get_item_index: return index of item and sub item in bar (position - * of item in items list) - * for example, if items are: - * item1,sub1+sub2+sub3,item3 - * index of sub3 is 1, sub index is 2 - * return -1 for index and sub index if item is not - * found in bar - */ - -void -gui_bar_get_item_index (struct t_gui_bar *bar, const char *item_name, - int *index_item, int *index_subitem) -{ - int i, j; - - *index_item = -1; - *index_subitem = -1; - - if (!bar || !item_name || !item_name[0]) - return; - - for (i = 0; i < bar->items_count; i++) - { - for (j = 0; j < bar->items_subcount[i]; j++) - { - /* skip non letters chars at beginning (prefix) */ - if (gui_bar_item_string_is_item (bar->items_array[i][j], item_name)) - { - *index_item = i; - *index_subitem = j; - return; - } - } - } - - /* item is not in bar */ -} - -/* * gui_bar_find_pos: find position for a bar in list (keeping list sorted * by priority) */ diff --git a/src/gui/gui-bar.h b/src/gui/gui-bar.h index fcf2c511d..f1847cb07 100644 --- a/src/gui/gui-bar.h +++ b/src/gui/gui-bar.h @@ -114,9 +114,6 @@ extern int gui_bar_search_option (const char *option_name); extern int gui_bar_search_type (const char *type); extern int gui_bar_search_position (const char *position); extern enum t_gui_bar_filling gui_bar_get_filling (struct t_gui_bar *bar); -extern void gui_bar_get_item_index (struct t_gui_bar *bar, - const char *item_name, - int *index_item, int *index_subitem); extern int gui_bar_check_conditions_for_window (struct t_gui_bar *bar, struct t_gui_window *window); extern int gui_bar_root_get_size (struct t_gui_bar *bar, |