Mercurial > ~mikael > mcabber > hg
diff mcabber/mcabber/screen.c @ 2292:f181418db215
Replace global variable update_roster with scr_update_roster()
author | franky |
---|---|
date | Tue, 01 Nov 2016 18:00:39 +0100 |
parents | 0d350e979bde |
children | fa8365fb6ac2 |
line wrap: on
line diff
--- a/mcabber/mcabber/screen.c Tue Nov 01 08:39:07 2016 +0100 +++ b/mcabber/mcabber/screen.c Tue Nov 01 18:00:39 2016 +0100 @@ -156,7 +156,7 @@ static time_t chatstate_timestamp; static guint chatstate_timeout_id = 0; -int update_roster; +int _update_roster; int utf8_mode; gboolean chatstates_disabled; gboolean Autoaway; @@ -382,6 +382,7 @@ } g_slist_free(rostercolrules); rostercolrules = NULL; + scr_update_roster(); } // Adds, modifies or removes roster coloring rule @@ -407,6 +408,7 @@ if (found) { free_rostercolrule(found->data); rostercolrules = g_slist_delete_link(rostercolrules, found); + scr_update_roster(); return TRUE; } else { scr_LogPrint(LPRINT_NORMAL, "No such color rule, nothing removed"); @@ -430,6 +432,7 @@ rc->color = cl; rostercolrules = g_slist_prepend(rostercolrules, rc); } + scr_update_roster(); return TRUE; } } @@ -1405,7 +1408,7 @@ roster_msg_setflag(winId, special, FALSE); if (!special) roster_setflags(winId, ROSTER_FLAG_LOCK, TRUE); - update_roster = TRUE; + scr_update_roster(); // Refresh the window scr_update_window(win_entry); @@ -1555,17 +1558,17 @@ if (!special) { if (clearmsgflg) { roster_msg_setflag(winId, FALSE, FALSE); - update_roster = TRUE; + scr_update_roster(); } else if (setmsgflg) { roster_msg_setflag(winId, FALSE, TRUE); - update_roster = TRUE; + scr_update_roster(); } } } static char *attention_sign_guard(const gchar *key, const gchar *new_value) { - update_roster = TRUE; + scr_update_roster(); if (g_strcmp0(settings_opt_get(key), new_value)) { guint sign; char *c; @@ -1819,7 +1822,7 @@ } // We'll need to redraw the roster - update_roster = TRUE; + scr_update_roster(); return; } @@ -2086,7 +2089,9 @@ char space[2] = " "; // We can reset update_roster - update_roster = FALSE; + if (_update_roster == FALSE) + return; + _update_roster = FALSE; buddylist_build(); @@ -2299,6 +2304,12 @@ curs_set(cursor_backup); } +void scr_update_roster(void) +{ + _update_roster = TRUE; +} + + // scr_roster_visibility(status) // Set the roster visibility: // status=1 Show roster @@ -2538,10 +2549,11 @@ // Remove the readmark if it is at the end of the buffer scr_buffer_readmark(-1); } - // We should rebuild the buddylist but not everytime + // We should rebuild the buddylist when the last selected buddy isn't + // displayed anymore if (!(buddylist_get_filter() & 1<<prev_st)) buddylist_defer_build(); - update_roster = TRUE; + scr_update_roster(); } // scr_roster_top() @@ -2779,7 +2791,7 @@ status |= 1<<budstate; buddylist_set_filter(status); buddylist_defer_build(); - update_roster = TRUE; + scr_update_roster(); return; } @@ -2967,7 +2979,7 @@ win_entry->bd->top = NULL; } - update_roster = TRUE; + scr_update_roster(); // Refresh the window scr_update_buddy_window(); @@ -3320,7 +3332,7 @@ } if (!chatmode || !current_id || strcmp(bjid, current_id) || iscurrentlocked) { roster_msg_setflag(bjid, special, TRUE); - update_roster = TRUE; + scr_update_roster(); } } @@ -3357,7 +3369,7 @@ if (!chatmode || !current_id || strcmp(bjid, current_id) || iscurrentlocked) { roster_setuiprio(bjid, special, value, action); - update_roster = TRUE; + scr_update_roster(); } }