Mercurial > hg
changeset 1154:f746d91c5d3b
Rearranged duplicated code in screen.c
author | franky@teufel.fs |
---|---|
date | Tue, 13 Feb 2007 21:48:17 +0100 |
parents | 4e307d19427e |
children | 3b9bbf6c4c93 |
files | mcabber/src/screen.c |
diffstat | 1 files changed, 15 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/mcabber/src/screen.c Mon Feb 12 22:19:02 2007 +0100 +++ b/mcabber/src/screen.c Tue Feb 13 21:48:17 2007 +0100 @@ -568,6 +568,19 @@ g_free(lines); } +static winbuf * scr_CreateWindow(const char *winId, int special, int dont_show) +{ + if (special) { + if (!statusWindow) { + statusWindow = scr_new_buddy(NULL, dont_show); + statusWindow->hbuf = statushbuf; + } + return statusWindow; + } else { + return scr_new_buddy(winId, dont_show); + } +} + // scr_ShowWindow() // Display the chat window with the given identifier. // "special" must be true if this is a special buffer window. @@ -578,15 +591,7 @@ win_entry = scr_SearchWindow(winId, special); if (!win_entry) { - if (special) { - if (!statusWindow) { - statusWindow = scr_new_buddy(NULL, FALSE); - statusWindow->hbuf = statushbuf; - } - win_entry = statusWindow; - } else { - win_entry = scr_new_buddy(winId, FALSE); - } + win_entry = scr_CreateWindow(winId, special, FALSE); } top_panel(win_entry->panel); @@ -675,15 +680,7 @@ // If the window entry doesn't exist yet, let's create it. if (!win_entry) { - if (special) { - if (!statusWindow) { - statusWindow = scr_new_buddy(NULL, dont_show); - statusWindow->hbuf = statushbuf; - } - win_entry = statusWindow; - } else { - win_entry = scr_new_buddy(winId, dont_show); - } + win_entry = scr_CreateWindow(winId, special, dont_show); } // The message must be displayed -> update top pointer