diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5a87513..f959f80 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -5,7 +5,7 @@ project(sngrep
set(PROJECT_NAME sngrep)
set(CMAKE_C_STANDARD 11)
-add_compile_options(-Wall -pedantic -Wextra)
+add_compile_options(-Wall -pedantic -Wextra -Werror)
include_directories(${CMAKE_SOURCE_DIR}/src)
include_directories(${CMAKE_SOURCE_DIR}/src/curses)
@@ -39,6 +39,7 @@ set(SOURCES
src/ncurses/windows/stats_win.c
src/ncurses/windows/auth_validate_win.c
src/ncurses/window.c
+ src/ncurses/dialog.c
src/ncurses/keybinding.c
src/ncurses/scrollbar.c
src/filter.c
diff --git a/src/Makefile.am b/src/Makefile.am
index e90c41d..defbb5a 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -40,6 +40,7 @@ sngrep_SOURCES+=storage.c
sngrep_SOURCES+=ncurses/keybinding.c
sngrep_SOURCES+=ncurses/scrollbar.c
sngrep_SOURCES+=ncurses/manager.c
+sngrep_SOURCES+=ncurses/dialog.c
sngrep_SOURCES+=ncurses/window.c
sngrep_SOURCES+=ncurses/windows/stats_win.c
sngrep_SOURCES+=ncurses/windows/filter_win.c
diff --git a/src/ncurses/dialog.c b/src/ncurses/dialog.c
new file mode 100644
index 0000000..08309a4
--- /dev/null
+++ b/src/ncurses/dialog.c
@@ -0,0 +1,314 @@
+/**************************************************************************
+ **
+ ** sngrep - SIP Messages flow viewer
+ **
+ ** Copyright (C) 2013-2018 Ivan Alonso (Kaian)
+ ** Copyright (C) 2013-2018 Irontec SL. All rights reserved.
+ **
+ ** This program is free software: you can redistribute it and/or modify
+ ** it under the terms of the GNU General Public License as published by
+ ** the Free Software Foundation, either version 3 of the License, or
+ ** (at your option) any later version.
+ **
+ ** This program is distributed in the hope that it will be useful,
+ ** but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ ** GNU General Public License for more details.
+ **
+ ** You should have received a copy of the GNU General Public License
+ ** along with this program. If not, see .
+ **
+ ****************************************************************************/
+/**
+ * @file dialog.c
+ * @author Ivan Alonso [aka Kaian]
+ *
+ * @brief Function for handing moodal dialogs
+ *
+ */
+
+#include "config.h"
+#include "ncurses/theme.h"
+#include "ncurses/keybinding.h"
+#include "ncurses/dialog.h"
+
+int
+dialog_run(const char *fmt, ...)
+{
+ char textva[2048];
+ va_list ap;
+ int height, width;
+ WINDOW *win;
+ char *word;
+ int col = 2;
+ int line = 2;
+
+ // Get the message from the format string
+ va_start(ap, fmt);
+ vsprintf(textva, fmt, ap);
+ va_end(ap);
+
+ // Determine dialog dimensions
+ height = 6 + (strlen(textva) / 50);
+ width = strlen(textva);
+
+ // Check we don't have a too big or small window
+ if (width > DIALOG_MAX_WIDTH)
+ width = DIALOG_MAX_WIDTH;
+ if (width < DIALOG_MIN_WIDTH)
+ width = DIALOG_MIN_WIDTH;
+
+ // Create the window
+ win = newwin(height, width, (LINES - height) / 2, (COLS - width) / 2);
+ box(win, 0, 0);
+
+ // Write the message into the screen
+ for (word = strtok(textva, " "); word; word = strtok(NULL, " ")) {
+ if ((gint) (col + strlen(word)) > width - 2) {
+ line++;
+ col = 2;
+ }
+ mvwprintw(win, line, col, "%s", word);
+ col += strlen(word) + 1;
+ }
+
+ // Write Accept button
+ wattron(win, A_REVERSE);
+ mvwprintw(win, height - 2, width / 2 - 5, "[ Accept ]");
+
+ curs_set(0);
+ // Disable input timeout
+ nocbreak();
+ cbreak();
+
+ // Wait for input
+ wgetch(win);
+
+ delwin(win);
+ return 1;
+
+}
+
+WINDOW *
+dialog_progress_run(const char *fmt, ...)
+{
+ char textva[2048];
+ va_list ap;
+ int height, width;
+ WINDOW *win;
+ char *word;
+ int col = 2;
+ int line = 2;
+
+ // Get the message from the format string
+ va_start(ap, fmt);
+ vsprintf(textva, fmt, ap);
+ va_end(ap);
+
+ // Determine dialog dimensions
+ height = 6 + (strlen(textva) / 50);
+ width = strlen(textva);
+
+ // Check we don't want a too big or small window
+ if (width > DIALOG_MAX_WIDTH)
+ width = DIALOG_MAX_WIDTH;
+ if (width < DIALOG_MIN_WIDTH)
+ width = DIALOG_MIN_WIDTH;
+
+ // Create the window
+ win = newwin(height, width, (LINES - height) / 2, (COLS - width) / 2);
+ box(win, 0, 0);
+
+ // Write the message into the screen
+ for (word = strtok(textva, " "); word; word = strtok(NULL, " ")) {
+ if ((gint) (col + strlen(word)) > width - 2) {
+ line++;
+ col = 2;
+ }
+ mvwprintw(win, line, col, "%s", word);
+ col += strlen(word) + 1;
+ }
+
+ curs_set(0);
+ wrefresh(win);
+ // Disable input timeout
+ nocbreak();
+ cbreak();
+
+ return win;
+
+}
+
+void
+dialog_progress_set_value(WINDOW *win, int perc)
+{
+ int width;
+
+ width = getmaxx(win);
+ mvwhline(win, 4, 4, '-', width - 10);
+ mvwaddch(win, 4, 3, '[');
+ mvwaddch(win, 4, width - 7, ']');
+ mvwprintw(win, 4, width - 5, "%d%%", perc);
+
+ if (perc > 0 && perc <= 100)
+ mvwhline(win, 4, 4, ACS_CKBOARD, (width - 10) * ((float) perc / 100));
+
+ wrefresh(win);
+}
+
+void
+dialog_progress_destroy(WINDOW *win)
+{
+ delwin(win);
+}
+
+int
+dialog_confirm(const char *title, const char *text, const char *options)
+{
+ WINDOW *dialog_win;
+ int key, i, curs, newl, height, width;
+ char *str, *tofree, *option, *word;
+ int selected = 0;
+ int optioncnt = 1;
+ int col = 2;
+ int line = 3;
+ char opts[4][10];
+
+ // Initialize
+ memset(opts, 0, 4 * 10);
+
+ // Check how many options exists
+ for (i = 0; options[i]; i++) {
+ if (options[i] == ',')
+ optioncnt++;
+ }
+
+ // We only support 4 options
+ if (optioncnt > 4)
+ return -1;
+
+ // Calculate proper width taking into acount longest data
+ width = strlen(options) + 6 * optioncnt;
+ if ((gint) strlen(title) + 4 > width)
+ width = strlen(title) + 4;
+ if ((gint) strlen(text) > width && strlen(text) < 50)
+ width = strlen(text);
+
+ // Check we don't want a too big or small window
+ if (width > DIALOG_MAX_WIDTH)
+ width = DIALOG_MAX_WIDTH;
+ if (width < DIALOG_MIN_WIDTH)
+ width = DIALOG_MIN_WIDTH;
+
+ // Determine dialog dimensions
+ height = 7; // Minimum for header and button lines
+ height += (strlen(text) / width); // Space for the text.
+ // Add one extra line for each newline in the text
+ for (i = 0; text[i]; i++) {
+ if (text[i] == '\n')
+ height++;
+ }
+
+ // Parse each line of payload looking for sdp information
+ tofree = str = strdup((char *) options);
+ i = 0;
+ while ((option = strsep(&str, ",")) != NULL) {
+ strcpy(opts[i++], option);
+ }
+ g_free(tofree);
+
+ // Create a new panel and show centered
+ dialog_win = newwin(height, width, (LINES - height) / 2, (COLS - width) / 2);
+ keypad(dialog_win, TRUE);
+ curs = curs_set(0);
+
+ // Set the window title
+ mvwprintw(dialog_win, 1, (width - strlen(title)) / 2, title);
+
+ // Write border and boxes around the window
+ wattron(dialog_win, COLOR_PAIR(CP_BLUE_ON_DEF));
+ box(dialog_win, 0, 0);
+
+ mvwhline(dialog_win, 2, 1, ACS_HLINE, width);
+ mvwaddch(dialog_win, 2, 0, ACS_LTEE);
+ mvwaddch(dialog_win, 2, width - 1, ACS_RTEE);
+
+ mvwhline(dialog_win, height - 3, 1, ACS_HLINE, width);
+ mvwaddch(dialog_win, height - 3, 0, ACS_LTEE);
+ mvwaddch(dialog_win, height - 3, width - 1, ACS_RTEE);
+
+ // Exit confirmation message message
+ wattron(dialog_win, COLOR_PAIR(CP_CYAN_ON_DEF));
+ // Write the message into the screen
+ tofree = str = strdup((char *) text);
+ newl = 0;
+ while ((word = strsep(&str, " ")) != NULL) {
+ if (word[strlen(word) - 1] == '\n') {
+ word[strlen(word) - 1] = '\0';
+ newl = 1;
+ }
+
+ if ((gint) (col + strlen(word)) > width - 2) {
+ line++;
+ col = 2;
+ }
+ mvwprintw(dialog_win, line, col, "%s", word);
+ col += strlen(word) + 1;
+ if (newl) {
+ line++;
+ col = 2;
+ newl = 0;
+ }
+ }
+ g_free(tofree);
+ wattroff(dialog_win, COLOR_PAIR(CP_CYAN_ON_DEF));
+
+ for (;;) {
+ // A list of available keys in this window
+ for (i = 0; i < optioncnt; i++) {
+ if (i == selected) wattron(dialog_win, A_REVERSE);
+ mvwprintw(dialog_win, height - 2, 10 + 10 * i, "[ %s ]", opts[i]);
+ wattroff(dialog_win, A_REVERSE);
+ }
+
+ // Get pressed key
+ key = wgetch(dialog_win);
+
+ // Check actions for this key
+ enum KeybindingAction action = ACTION_UNKNOWN;
+ while ((action = key_find_action(key, action)) != ACTION_UNKNOWN) {
+ // Check if we handle this action
+ switch (action) {
+ case ACTION_RIGHT:
+ selected++;
+ break;
+ case ACTION_LEFT:
+ case ACTION_NEXT_FIELD:
+ selected--;
+ break;
+ case ACTION_SELECT:
+ case ACTION_CONFIRM:
+ goto done;
+ case ACTION_PREV_SCREEN:
+ selected = -1;
+ goto done;
+ default:
+ // Parse next action
+ continue;
+ }
+ // key handled successfully
+ break;
+ }
+
+ // Cycle through ooptions
+ if (selected > optioncnt - 1)
+ selected = 0;
+ if (selected < 0)
+ selected = optioncnt - 1;
+ }
+
+done:
+ delwin(dialog_win);
+ curs_set(curs);
+ return selected;
+}
diff --git a/src/ncurses/dialog.h b/src/ncurses/dialog.h
new file mode 100644
index 0000000..698546e
--- /dev/null
+++ b/src/ncurses/dialog.h
@@ -0,0 +1,98 @@
+/**************************************************************************
+ **
+ ** sngrep - SIP Messages flow viewer
+ **
+ ** Copyright (C) 2013-2018 Ivan Alonso (Kaian)
+ ** Copyright (C) 2013-2018 Irontec SL. All rights reserved.
+ **
+ ** This program is free software: you can redistribute it and/or modify
+ ** it under the terms of the GNU General Public License as published by
+ ** the Free Software Foundation, either version 3 of the License, or
+ ** (at your option) any later version.
+ **
+ ** This program is distributed in the hope that it will be useful,
+ ** but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ ** GNU General Public License for more details.
+ **
+ ** You should have received a copy of the GNU General Public License
+ ** along with this program. If not, see .
+ **
+ ****************************************************************************/
+/**
+ * @file dialog.h
+ * @author Ivan Alonso [aka Kaian]
+ *
+ * @brief Common process for modal dialogs
+ *
+ */
+
+#ifndef __SNGREP_DIALOG_H
+#define __SNGREP_DIALOG_H
+
+#include
+#include "ncurses/window.h"
+
+//! Default dialog dimensions
+#define DIALOG_MAX_WIDTH 100
+#define DIALOG_MIN_WIDTH 40
+
+/**
+ * @brief Draw a centered dialog with a message
+ *
+ * Create a centered dialog with a message.
+ * @param msg Message to be drawn
+ */
+int
+dialog_run(const char *fmt, ...);
+
+/**
+ * @brief Create a new progress bar dialog
+ *
+ * Create a new progress bar dialog with the given text. The returned
+ * pointer should be used as parameter for @dialog_progress_set_value
+ * in order to move the progress bar percentage.
+ *
+ * @param fmt, vaarg Text to be displayed above the progress bar
+ * @return a pointer to the created window.
+ */
+WINDOW *
+dialog_progress_run(const char *fmt, ...);
+
+/**
+ * @brief Set current percentage of dialog progress bar
+ *
+ * @param win Window pointer created with @dialog_progress_run
+ * @param perc 0-100 percentage of progress bar
+ */
+void
+dialog_progress_set_value(WINDOW *win, int perc);
+
+/**
+ * @brief Destroy a dialog created by @dialog_progress_run
+ *
+ * This function will deallocate all memory and close the
+ * given window pointer.
+ *
+ * @param win Window pointer created with @dialog_progress_run
+ */
+void
+dialog_progress_destroy(WINDOW *win);
+
+/**
+ * @brief Create a new confirmation dialog with multiple buttons
+ *
+ * This function can be used to create dialogs with multiple buttons to
+ * request user confirmation. By default, the first given option will
+ * be selected.
+ *
+ * @param title Title displayed in the top of the dialog
+ * @param text Text displayed inside the dialog
+ * @param options Comma separated labels for the different buttons
+ * @return the index of the button pressed
+ */
+int
+dialog_confirm(const char *title, const char *text, const char *options);
+
+
+#endif // __SNGREP_DIALOG_H
diff --git a/src/ncurses/manager.c b/src/ncurses/manager.c
index 793a39a..18e475d 100644
--- a/src/ncurses/manager.c
+++ b/src/ncurses/manager.c
@@ -539,284 +539,3 @@ draw_message_pos(WINDOW *win, Message *msg, int starting)
return line - starting;
}
-
-int
-dialog_run(const char *fmt, ...)
-{
- char textva[2048];
- va_list ap;
- int height, width;
- WINDOW *win;
- char *word;
- int col = 2;
- int line = 2;
-
- // Get the message from the format string
- va_start(ap, fmt);
- vsprintf(textva, fmt, ap);
- va_end(ap);
-
- // Determine dialog dimensions
- height = 6 + (strlen(textva) / 50);
- width = strlen(textva);
-
- // Check we don't have a too big or small window
- if (width > DIALOG_MAX_WIDTH)
- width = DIALOG_MAX_WIDTH;
- if (width < DIALOG_MIN_WIDTH)
- width = DIALOG_MIN_WIDTH;
-
- // Create the window
- win = newwin(height, width, (LINES - height) / 2, (COLS - width) / 2);
- box(win, 0, 0);
-
- // Write the message into the screen
- for (word = strtok(textva, " "); word; word = strtok(NULL, " ")) {
- if ((gint) (col + strlen(word)) > width - 2) {
- line++;
- col = 2;
- }
- mvwprintw(win, line, col, "%s", word);
- col += strlen(word) + 1;
- }
-
- // Write Accept button
- wattron(win, A_REVERSE);
- mvwprintw(win, height - 2, width / 2 - 5, "[ Accept ]");
-
- curs_set(0);
- // Disable input timeout
- nocbreak();
- cbreak();
-
- // Wait for input
- wgetch(win);
-
- delwin(win);
- return 1;
-
-}
-
-WINDOW *
-dialog_progress_run(const char *fmt, ...)
-{
- char textva[2048];
- va_list ap;
- int height, width;
- WINDOW *win;
- char *word;
- int col = 2;
- int line = 2;
-
- // Get the message from the format string
- va_start(ap, fmt);
- vsprintf(textva, fmt, ap);
- va_end(ap);
-
- // Determine dialog dimensions
- height = 6 + (strlen(textva) / 50);
- width = strlen(textva);
-
- // Check we don't want a too big or small window
- if (width > DIALOG_MAX_WIDTH)
- width = DIALOG_MAX_WIDTH;
- if (width < DIALOG_MIN_WIDTH)
- width = DIALOG_MIN_WIDTH;
-
- // Create the window
- win = newwin(height, width, (LINES - height) / 2, (COLS - width) / 2);
- box(win, 0, 0);
-
- // Write the message into the screen
- for (word = strtok(textva, " "); word; word = strtok(NULL, " ")) {
- if ((gint) (col + strlen(word)) > width - 2) {
- line++;
- col = 2;
- }
- mvwprintw(win, line, col, "%s", word);
- col += strlen(word) + 1;
- }
-
- curs_set(0);
- wrefresh(win);
- // Disable input timeout
- nocbreak();
- cbreak();
-
- return win;
-
-}
-
-void
-dialog_progress_set_value(WINDOW *win, int perc)
-{
- int width;
-
- width = getmaxx(win);
- mvwhline(win, 4, 4, '-', width - 10);
- mvwaddch(win, 4, 3, '[');
- mvwaddch(win, 4, width - 7, ']');
- mvwprintw(win, 4, width - 5, "%d%%", perc);
-
- if (perc > 0 && perc <= 100)
- mvwhline(win, 4, 4, ACS_CKBOARD, (width - 10) * ((float) perc / 100));
-
- wrefresh(win);
-}
-
-void
-dialog_progress_destroy(WINDOW *win)
-{
- delwin(win);
-}
-
-int
-dialog_confirm(const char *title, const char *text, const char *options)
-{
- WINDOW *dialog_win;
- int key, i, curs, newl, height, width;
- char *str, *tofree, *option, *word;
- int selected = 0;
- int optioncnt = 1;
- int col = 2;
- int line = 3;
- char opts[4][10];
-
- // Initialize
- memset(opts, 0, 4 * 10);
-
- // Check how many options exists
- for (i = 0; options[i]; i++) {
- if (options[i] == ',')
- optioncnt++;
- }
-
- // We only support 4 options
- if (optioncnt > 4)
- return -1;
-
- // Calculate proper width taking into acount longest data
- width = strlen(options) + 6 * optioncnt;
- if ((gint) strlen(title) + 4 > width)
- width = strlen(title) + 4;
- if ((gint) strlen(text) > width && strlen(text) < 50)
- width = strlen(text);
-
- // Check we don't want a too big or small window
- if (width > DIALOG_MAX_WIDTH)
- width = DIALOG_MAX_WIDTH;
- if (width < DIALOG_MIN_WIDTH)
- width = DIALOG_MIN_WIDTH;
-
- // Determine dialog dimensions
- height = 7; // Minimum for header and button lines
- height += (strlen(text) / width); // Space for the text.
- // Add one extra line for each newline in the text
- for (i = 0; text[i]; i++) {
- if (text[i] == '\n')
- height++;
- }
-
- // Parse each line of payload looking for sdp information
- tofree = str = strdup((char *) options);
- i = 0;
- while ((option = strsep(&str, ",")) != NULL) {
- strcpy(opts[i++], option);
- }
- g_free(tofree);
-
- // Create a new panel and show centered
- dialog_win = newwin(height, width, (LINES - height) / 2, (COLS - width) / 2);
- keypad(dialog_win, TRUE);
- curs = curs_set(0);
-
- // Set the window title
- mvwprintw(dialog_win, 1, (width - strlen(title)) / 2, title);
-
- // Write border and boxes around the window
- wattron(dialog_win, COLOR_PAIR(CP_BLUE_ON_DEF));
- box(dialog_win, 0, 0);
-
- mvwhline(dialog_win, 2, 1, ACS_HLINE, width);
- mvwaddch(dialog_win, 2, 0, ACS_LTEE);
- mvwaddch(dialog_win, 2, width - 1, ACS_RTEE);
-
- mvwhline(dialog_win, height - 3, 1, ACS_HLINE, width);
- mvwaddch(dialog_win, height - 3, 0, ACS_LTEE);
- mvwaddch(dialog_win, height - 3, width - 1, ACS_RTEE);
-
- // Exit confirmation message message
- wattron(dialog_win, COLOR_PAIR(CP_CYAN_ON_DEF));
- // Write the message into the screen
- tofree = str = strdup((char *) text);
- newl = 0;
- while ((word = strsep(&str, " ")) != NULL) {
- if (word[strlen(word) - 1] == '\n') {
- word[strlen(word) - 1] = '\0';
- newl = 1;
- }
-
- if ((gint) (col + strlen(word)) > width - 2) {
- line++;
- col = 2;
- }
- mvwprintw(dialog_win, line, col, "%s", word);
- col += strlen(word) + 1;
- if (newl) {
- line++;
- col = 2;
- newl = 0;
- }
- }
- g_free(tofree);
- wattroff(dialog_win, COLOR_PAIR(CP_CYAN_ON_DEF));
-
- for (;;) {
- // A list of available keys in this window
- for (i = 0; i < optioncnt; i++) {
- if (i == selected) wattron(dialog_win, A_REVERSE);
- mvwprintw(dialog_win, height - 2, 10 + 10 * i, "[ %s ]", opts[i]);
- wattroff(dialog_win, A_REVERSE);
- }
-
- // Get pressed key
- key = wgetch(dialog_win);
-
- // Check actions for this key
- enum KeybindingAction action = ACTION_UNKNOWN;
- while ((action = key_find_action(key, action)) != ACTION_UNKNOWN) {
- // Check if we handle this action
- switch (action) {
- case ACTION_RIGHT:
- selected++;
- break;
- case ACTION_LEFT:
- case ACTION_NEXT_FIELD:
- selected--;
- break;
- case ACTION_SELECT:
- case ACTION_CONFIRM:
- goto done;
- case ACTION_PREV_SCREEN:
- selected = -1;
- goto done;
- default:
- // Parse next action
- continue;
- }
- // key handled successfully
- break;
- }
-
- // Cycle through ooptions
- if (selected > optioncnt - 1)
- selected = 0;
- if (selected < 0)
- selected = optioncnt - 1;
- }
-
-done:
- delwin(dialog_win);
- curs_set(curs);
- return selected;
-}
diff --git a/src/ncurses/manager.h b/src/ncurses/manager.h
index b786174..34eedb9 100644
--- a/src/ncurses/manager.h
+++ b/src/ncurses/manager.h
@@ -20,7 +20,7 @@
**
****************************************************************************/
/**
- * @file ui_manager.h
+ * @file manager.h
* @author Ivan Alonso [aka Kaian]
*
* @brief Functions to manage interface panels
@@ -46,9 +46,7 @@
//! Refresh UI every 200 ms
#define REFRESHTHSECS 2
-//! Default dialog dimensions
-#define DIALOG_MAX_WIDTH 100
-#define DIALOG_MIN_WIDTH 40
+
//! Error reporting
#define NCURSES_ERROR (capture_pcap_error_quark())
@@ -169,61 +167,4 @@ draw_message(WINDOW *win, Message *msg);
int
draw_message_pos(WINDOW *win, Message *msg, int starting);
-/**
- * @brief Draw a centered dialog with a message
- *
- * Create a centered dialog with a message.
- * @param msg Message to be drawn
- */
-int
-dialog_run(const char *fmt, ...);
-
-/**
- * @brief Create a new progress bar dialog
- *
- * Create a new progress bar dialog with the given text. The returned
- * pointer should be used as parameter for @dialog_progress_set_value
- * in order to move the progress bar percentage.
- *
- * @param fmt, vaarg Text to be displayed above the progress bar
- * @return a pointer to the created window.
- */
-WINDOW *
-dialog_progress_run(const char *fmt, ...);
-
-/**
- * @brief Set current percentage of dialog progress bar
- *
- * @param win Window pointer created with @dialog_progress_run
- * @param perc 0-100 percentage of progress bar
- */
-void
-dialog_progress_set_value(WINDOW *win, int perc);
-
-/**
- * @brief Destroy a dialog created by @dialog_progress_run
- *
- * This function will deallocate all memory and close the
- * given window pointer.
- *
- * @param win Window pointer created with @dialog_progress_run
- */
-void
-dialog_progress_destroy(WINDOW *win);
-
-/**
- * @brief Create a new confirmation dialog with multiple buttons
- *
- * This function can be used to create dialogs with multiple buttons to
- * request user confirmation. By default, the first given option will
- * be selected.
- *
- * @param title Title displayed in the top of the dialog
- * @param text Text displayed inside the dialog
- * @param options Comma separated labels for the different buttons
- * @return the index of the button pressed
- */
-int
-dialog_confirm(const char *title, const char *text, const char *options);
-
#endif // __SNGREP_UI_MANAGER_H
diff --git a/src/ncurses/windows/auth_validate_win.c b/src/ncurses/windows/auth_validate_win.c
index 7e84751..57e834d 100644
--- a/src/ncurses/windows/auth_validate_win.c
+++ b/src/ncurses/windows/auth_validate_win.c
@@ -27,10 +27,9 @@
*/
#include "config.h"
#include
-#include
-#include "glib-extra.h"
+#include "packet/dissectors/packet_sip.h"
+#include "ncurses/dialog.h"
#include "auth_validate_win.h"
-#include "setting.h"
/**
* @brief Get custom information of given panel
diff --git a/src/ncurses/windows/call_flow_win.c b/src/ncurses/windows/call_flow_win.c
index 3ea08de..50aba2a 100644
--- a/src/ncurses/windows/call_flow_win.c
+++ b/src/ncurses/windows/call_flow_win.c
@@ -20,27 +20,23 @@
**
****************************************************************************/
/**
- * @file call_flow.c
+ * @file call_flow_win.c
* @author Ivan Alonso [aka Kaian]
*
- * @brief Source of functions defined in call_flow.h
+ * @brief Source of functions to handle Message arrows display window
*/
-#include "config.h"
#include
-#include
-#include
#include
#include "capture/capture_pcap.h"
#include "ncurses/manager.h"
-#include "call_flow_win.h"
-#include "call_raw_win.h"
-#include "msg_diff_win.h"
-#include "auth_validate_win.h"
-#include "save_win.h"
-#include "timeval.h"
+#include "ncurses/dialog.h"
+#include "ncurses/windows/call_flow_win.h"
+#include "ncurses/windows/call_raw_win.h"
+#include "ncurses/windows/msg_diff_win.h"
+#include "ncurses/windows/auth_validate_win.h"
+#include "ncurses/windows/save_win.h"
#include "glib-extra.h"
-#include "setting.h"
/***
*
diff --git a/src/ncurses/windows/call_list_win.c b/src/ncurses/windows/call_list_win.c
index 2a7bb35..e762f03 100644
--- a/src/ncurses/windows/call_list_win.c
+++ b/src/ncurses/windows/call_list_win.c
@@ -20,35 +20,28 @@
**
****************************************************************************/
/**
- * @file ui_call_list.c
+ * @file call_list_win.c
* @author Ivan Alonso [aka Kaian]
*
- * @brief Source of functions defined in ui_call_list.h
+ * @brief Functions to handle Call List window
*
*/
#include "config.h"
#include
-#include
-#include
-#include
#include
-#include
#include "glib-extra.h"
#include "setting.h"
#include "filter.h"
-#include "capture/capture_pcap.h"
#ifdef USE_HEP
#include "capture/capture_hep.h"
#endif
#include "ncurses/manager.h"
-#include "call_list_win.h"
-#include "call_flow_win.h"
-#include "call_raw_win.h"
-#include "stats_win.h"
-#include "filter_win.h"
-#include "save_win.h"
-#include "storage.h"
-#include "column_select_win.h"
+#include "ncurses/dialog.h"
+#include "ncurses/windows/call_list_win.h"
+#include "ncurses/windows/call_flow_win.h"
+#include "ncurses/windows/call_raw_win.h"
+#include "ncurses/windows/save_win.h"
+#include "ncurses/windows/column_select_win.h"
/**
* @brief Get custom information of given panel
diff --git a/src/ncurses/windows/call_raw_win.c b/src/ncurses/windows/call_raw_win.c
index 6fb5f8a..532254a 100644
--- a/src/ncurses/windows/call_raw_win.c
+++ b/src/ncurses/windows/call_raw_win.c
@@ -20,7 +20,7 @@
**
****************************************************************************/
/**
- * @file call_raw.c
+ * @file call_raw_win.c
* @author Ivan Alonso [aka Kaian]
*
* @brief Source of functions defined in call_raw.h
@@ -29,14 +29,13 @@
* @todo Replace the panel refresh. Wclear sucks on high latency conections.
*
*/
-#include "config.h"
#include
#include
#include "ncurses/manager.h"
-#include "call_raw_win.h"
-#include "save_win.h"
-#include "capture/capture_pcap.h"
+#include "ncurses/dialog.h"
#include "packet/dissectors/packet_sip.h"
+#include "ncurses/windows/save_win.h"
+#include "ncurses/windows/call_raw_win.h"
/**
* @brief Get custom information of given panel
diff --git a/src/ncurses/windows/column_select_win.c b/src/ncurses/windows/column_select_win.c
index bdf6c06..f63a03b 100644
--- a/src/ncurses/windows/column_select_win.c
+++ b/src/ncurses/windows/column_select_win.c
@@ -27,17 +27,14 @@
* @brief Source of functions defined in ui_column_select.h
*
*/
-#include "config.h"
#include
-#include
-#include
-#include
#include
#include
#include "glib-extra.h"
#include "ncurses/manager.h"
-#include "call_list_win.h"
-#include "column_select_win.h"
+#include "ncurses/dialog.h"
+#include "ncurses/windows/call_list_win.h"
+#include "ncurses/windows/column_select_win.h"
/**
* @brief Get custom information of given panel
diff --git a/src/ncurses/windows/save_win.c b/src/ncurses/windows/save_win.c
index d5b7878..08e5540 100644
--- a/src/ncurses/windows/save_win.c
+++ b/src/ncurses/windows/save_win.c
@@ -25,21 +25,16 @@
*
* @brief Source of functions defined in save_win.h
*/
-#include "config.h"
#include
-#include
-#include
#include
#include
-#include
#include
-#include
#include "glib-extra.h"
-#include "save_win.h"
#include "setting.h"
-#include "capture/capture_pcap.h"
-#include "capture/capture_txt.h"
#include "filter.h"
+#include "capture/capture_txt.h"
+#include "ncurses/dialog.h"
+#include "ncurses/windows/save_win.h"
/**
* @brief Get custom information of given panel
diff --git a/src/ncurses/windows/settings_win.c b/src/ncurses/windows/settings_win.c
index e607ac8..8340b19 100644
--- a/src/ncurses/windows/settings_win.c
+++ b/src/ncurses/windows/settings_win.c
@@ -27,16 +27,10 @@
*/
#include "config.h"
#include
-#include
-#include
-#include
#include
-#include
-#include
-#include
#include "ncurses/manager.h"
-#include "settings_win.h"
-#include "setting.h"
+#include "ncurses/dialog.h"
+#include "ncurses/windows/settings_win.h"
SettingsWinCategory categories[] = {
{ CAT_SETTINGS_INTERFACE, "Interface" },