Commit bb84c46c authored by winckel's avatar winckel

Added handling of message read abort when closing windows.

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4862 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 0b31d140
...@@ -164,6 +164,12 @@ void ui_set_title(const char *fmt, ...) ...@@ -164,6 +164,12 @@ void ui_set_title(const char *fmt, ...)
gtk_window_set_title (GTK_WINDOW(ui_main_data.window), title); gtk_window_set_title (GTK_WINDOW(ui_main_data.window), title);
} }
void ui_main_window_destroy (void)
{
ui_progressbar_window_destroy();
gtk_main_quit();
}
int ui_gtk_initialize(int argc, char *argv[]) int ui_gtk_initialize(int argc, char *argv[])
{ {
GtkWidget *vbox; GtkWidget *vbox;
...@@ -190,7 +196,7 @@ int ui_gtk_initialize(int argc, char *argv[]) ...@@ -190,7 +196,7 @@ int ui_gtk_initialize(int argc, char *argv[])
gtk_container_add (GTK_CONTAINER(ui_main_data.window), vbox); gtk_container_add (GTK_CONTAINER(ui_main_data.window), vbox);
/* Assign the destroy event */ /* Assign the destroy event */
g_signal_connect(ui_main_data.window, "destroy", G_CALLBACK (gtk_main_quit), NULL); g_signal_connect(ui_main_data.window, "destroy", ui_main_window_destroy, NULL);
/* Show the application window */ /* Show the application window */
gtk_widget_show_all (ui_main_data.window); gtk_widget_show_all (ui_main_data.window);
......
...@@ -63,6 +63,8 @@ void ui_gtk_parse_arg(int argc, char *argv[]); ...@@ -63,6 +63,8 @@ void ui_gtk_parse_arg(int argc, char *argv[]);
void ui_set_title(const char *fmt, ...); void ui_set_title(const char *fmt, ...);
void ui_main_window_destroy (void);
int ui_gtk_initialize(int argc, char *argv[]); int ui_gtk_initialize(int argc, char *argv[]);
void ui_gtk_flush_events(void); void ui_gtk_flush_events(void);
......
...@@ -99,7 +99,7 @@ int ui_menu_bar_create(GtkWidget *vbox) ...@@ -99,7 +99,7 @@ int ui_menu_bar_create(GtkWidget *vbox)
quit = gtk_menu_item_new_with_mnemonic ("_Quit"); quit = gtk_menu_item_new_with_mnemonic ("_Quit");
gtk_widget_add_accelerator (quit, "activate", accel_group, GDK_KEY_q, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE); gtk_widget_add_accelerator (quit, "activate", accel_group, GDK_KEY_q, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
gtk_menu_shell_append (GTK_MENU_SHELL(filters_menu), quit); gtk_menu_shell_append (GTK_MENU_SHELL(filters_menu), quit);
g_signal_connect(G_OBJECT(quit), "activate", G_CALLBACK(gtk_main_quit), NULL); g_signal_connect(G_OBJECT(quit), "activate", ui_main_window_destroy, NULL);
} }
} }
......
...@@ -31,6 +31,7 @@ static const itti_message_types_t itti_dump_message_type_end = ITTI_DUMP_MESS ...@@ -31,6 +31,7 @@ static const itti_message_types_t itti_dump_message_type_end = ITTI_DUMP_MESS
static gboolean chooser_running; static gboolean chooser_running;
static FILE *messages_file; static FILE *messages_file;
static uint32_t message_number; static uint32_t message_number;
static gboolean ui_abort;
int ui_disable_connect_button(void) int ui_disable_connect_button(void)
{ {
...@@ -126,6 +127,7 @@ int ui_messages_read(char *file_name) ...@@ -126,6 +127,7 @@ int ui_messages_read(char *file_name)
ui_main_data.follow_last = TRUE; ui_main_data.follow_last = TRUE;
/* Initialize the progress bar */ /* Initialize the progress bar */
ui_abort = FALSE;
ui_progress_bar_set_fraction (0); ui_progress_bar_set_fraction (0);
do do
...@@ -261,7 +263,7 @@ int ui_messages_read(char *file_name) ...@@ -261,7 +263,7 @@ int ui_messages_read(char *file_name)
break; break;
} }
} }
} while (read_data > 0); } while ((ui_abort == FALSE) && (read_data > 0));
if (read_messages > 0) if (read_messages > 0)
{ {
...@@ -561,8 +563,16 @@ int ui_filters_save_file_chooser(void) ...@@ -561,8 +563,16 @@ int ui_filters_save_file_chooser(void)
return result; return result;
} }
void ui_progressbar_window_destroy (void)
{
ui_abort = TRUE;
ui_progress_bar_terminate();
}
int ui_progress_bar_set_fraction(double fraction) int ui_progress_bar_set_fraction(double fraction)
{ {
if (ui_abort == FALSE)
{
/* If not exist instantiate */ /* If not exist instantiate */
if (!ui_main_data.progressbar && !ui_main_data.progressbar_window) if (!ui_main_data.progressbar && !ui_main_data.progressbar_window)
{ {
...@@ -577,12 +587,17 @@ int ui_progress_bar_set_fraction(double fraction) ...@@ -577,12 +587,17 @@ int ui_progress_bar_set_fraction(double fraction)
ui_main_data.progressbar = gtk_progress_bar_new (); ui_main_data.progressbar = gtk_progress_bar_new ();
gtk_container_add (GTK_CONTAINER (ui_main_data.progressbar_window), ui_main_data.progressbar); gtk_container_add (GTK_CONTAINER (ui_main_data.progressbar_window), ui_main_data.progressbar);
/* Assign the destroy event */
g_signal_connect(ui_main_data.progressbar_window, "destroy", ui_progressbar_window_destroy, NULL);
gtk_widget_show_all (ui_main_data.progressbar_window); gtk_widget_show_all (ui_main_data.progressbar_window);
} }
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR(ui_main_data.progressbar), fraction); gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR(ui_main_data.progressbar), fraction);
// ui_gtk_flush_events(); // ui_gtk_flush_events();
}
return RC_OK; return RC_OK;
} }
...@@ -592,14 +607,13 @@ int ui_progress_bar_terminate(void) ...@@ -592,14 +607,13 @@ int ui_progress_bar_terminate(void)
if (ui_main_data.progressbar) if (ui_main_data.progressbar)
{ {
gtk_widget_destroy (ui_main_data.progressbar); gtk_widget_destroy (ui_main_data.progressbar);
ui_main_data.progressbar = NULL;
} }
if (ui_main_data.progressbar_window) if (ui_main_data.progressbar_window)
{ {
gtk_widget_destroy (ui_main_data.progressbar_window); gtk_widget_destroy (ui_main_data.progressbar_window);
}
ui_main_data.progressbar = NULL;
ui_main_data.progressbar_window = NULL; ui_main_data.progressbar_window = NULL;
}
return RC_OK; return RC_OK;
} }
...@@ -17,6 +17,8 @@ int ui_filters_open_file_chooser(void); ...@@ -17,6 +17,8 @@ int ui_filters_open_file_chooser(void);
int ui_filters_save_file_chooser(void); int ui_filters_save_file_chooser(void);
void ui_progressbar_window_destroy(void);
int ui_progress_bar_set_fraction(double fraction); int ui_progress_bar_set_fraction(double fraction);
int ui_progress_bar_terminate(void); int ui_progress_bar_terminate(void);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment