Commit 0241785a authored by winckel's avatar winckel

Moved operation running test to cover also reload operations.

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4863 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent bb84c46c
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
static gboolean refresh_message_list = TRUE; static gboolean refresh_message_list = TRUE;
static gboolean filters_changed = FALSE; static gboolean filters_changed = FALSE;
static gboolean operation_running = FALSE;
gboolean ui_callback_on_open_messages(GtkWidget *widget, gpointer data) gboolean ui_callback_on_open_messages(GtkWidget *widget, gpointer data)
{ {
...@@ -38,6 +39,9 @@ gboolean ui_callback_on_open_messages(GtkWidget *widget, gpointer data) ...@@ -38,6 +39,9 @@ gboolean ui_callback_on_open_messages(GtkWidget *widget, gpointer data)
g_message("Open messages event occurred %d", refresh); g_message("Open messages event occurred %d", refresh);
if (operation_running == FALSE)
{
operation_running = TRUE;
if (refresh && (ui_main_data.messages_file_name != NULL)) if (refresh && (ui_main_data.messages_file_name != NULL))
{ {
CHECK_FCT(ui_messages_read (ui_main_data.messages_file_name)); CHECK_FCT(ui_messages_read (ui_main_data.messages_file_name));
...@@ -46,6 +50,8 @@ gboolean ui_callback_on_open_messages(GtkWidget *widget, gpointer data) ...@@ -46,6 +50,8 @@ gboolean ui_callback_on_open_messages(GtkWidget *widget, gpointer data)
{ {
CHECK_FCT(ui_messages_open_file_chooser()); CHECK_FCT(ui_messages_open_file_chooser());
} }
operation_running = FALSE;
}
return TRUE; return TRUE;
} }
...@@ -54,7 +60,12 @@ gboolean ui_callback_on_save_messages(GtkWidget *widget, gpointer data) ...@@ -54,7 +60,12 @@ gboolean ui_callback_on_save_messages(GtkWidget *widget, gpointer data)
{ {
g_message("Save messages event occurred"); g_message("Save messages event occurred");
if (operation_running == FALSE)
{
operation_running = TRUE;
CHECK_FCT(ui_messages_save_file_chooser()); CHECK_FCT(ui_messages_save_file_chooser());
operation_running = FALSE;
}
return TRUE; return TRUE;
} }
...@@ -93,22 +104,34 @@ gboolean ui_callback_on_open_filters(GtkWidget *widget, gpointer data) ...@@ -93,22 +104,34 @@ gboolean ui_callback_on_open_filters(GtkWidget *widget, gpointer data)
g_message("Open filters event occurred"); g_message("Open filters event occurred");
if (operation_running == FALSE)
{
operation_running = TRUE;
if (refresh && (ui_main_data.filters_file_name != NULL)) if (refresh && (ui_main_data.filters_file_name != NULL))
{ {
CHECK_FCT(ui_filters_read (ui_main_data.filters_file_name)); CHECK_FCT(ui_filters_read (ui_main_data.filters_file_name));
} }
else else
{ {
CHECK_FCT(ui_filters_open_file_chooser()); CHECK_FCT(ui_filters_open_file_chooser());
} }
operation_running = FALSE;
}
return TRUE; return TRUE;
} }
gboolean ui_callback_on_save_filters(GtkWidget *widget, gpointer data) gboolean ui_callback_on_save_filters(GtkWidget *widget, gpointer data)
{ {
if (operation_running == FALSE)
{
operation_running = TRUE;
g_message("Save filters event occurred"); g_message("Save filters event occurred");
CHECK_FCT(ui_filters_save_file_chooser()); CHECK_FCT(ui_filters_save_file_chooser());
operation_running = FALSE;
}
return TRUE; return TRUE;
} }
......
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
static const itti_message_types_t itti_dump_xml_definition_end = ITTI_DUMP_XML_DEFINITION_END; static const itti_message_types_t itti_dump_xml_definition_end = ITTI_DUMP_XML_DEFINITION_END;
static const itti_message_types_t itti_dump_message_type_end = ITTI_DUMP_MESSAGE_TYPE_END; static const itti_message_types_t itti_dump_message_type_end = ITTI_DUMP_MESSAGE_TYPE_END;
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; static gboolean ui_abort;
...@@ -357,13 +356,10 @@ int ui_messages_open_file_chooser(void) ...@@ -357,13 +356,10 @@ int ui_messages_open_file_chooser(void)
{ {
int result = RC_OK; int result = RC_OK;
if (chooser_running == FALSE)
{
GtkWidget *filechooser; GtkWidget *filechooser;
gboolean accept; gboolean accept;
char *filename; char *filename;
chooser_running = TRUE;
filechooser = gtk_file_chooser_dialog_new ("Select file", GTK_WINDOW (ui_main_data.window), filechooser = gtk_file_chooser_dialog_new ("Select file", GTK_WINDOW (ui_main_data.window),
GTK_FILE_CHOOSER_ACTION_OPEN, GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, GTK_FILE_CHOOSER_ACTION_OPEN, GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL); GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL);
...@@ -395,21 +391,14 @@ int ui_messages_open_file_chooser(void) ...@@ -395,21 +391,14 @@ int ui_messages_open_file_chooser(void)
g_free (filename); g_free (filename);
} }
} }
chooser_running = FALSE;
}
return result; return result;
} }
int ui_messages_save_file_chooser(void) int ui_messages_save_file_chooser(void)
{ {
int result = RC_OK; int result = RC_OK;
if (chooser_running == FALSE)
{
GtkWidget *filechooser; GtkWidget *filechooser;
chooser_running = TRUE;
/* Check if there is something to save */ /* Check if there is something to save */
if (xml_raw_data_size > 0) if (xml_raw_data_size > 0)
{ {
...@@ -453,8 +442,6 @@ int ui_messages_save_file_chooser(void) ...@@ -453,8 +442,6 @@ int ui_messages_save_file_chooser(void)
} }
gtk_widget_destroy (filechooser); gtk_widget_destroy (filechooser);
} }
chooser_running = FALSE;
}
return result; return result;
} }
...@@ -462,15 +449,10 @@ int ui_messages_save_file_chooser(void) ...@@ -462,15 +449,10 @@ int ui_messages_save_file_chooser(void)
int ui_filters_open_file_chooser(void) int ui_filters_open_file_chooser(void)
{ {
int result = RC_OK; int result = RC_OK;
if (chooser_running == FALSE)
{
GtkWidget *filechooser; GtkWidget *filechooser;
gboolean accept; gboolean accept;
char *filename; char *filename;
chooser_running = TRUE;
filechooser = gtk_file_chooser_dialog_new ("Select file", GTK_WINDOW (ui_main_data.window), filechooser = gtk_file_chooser_dialog_new ("Select file", GTK_WINDOW (ui_main_data.window),
GTK_FILE_CHOOSER_ACTION_OPEN, GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, GTK_FILE_CHOOSER_ACTION_OPEN, GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL); GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL);
...@@ -502,8 +484,6 @@ int ui_filters_open_file_chooser(void) ...@@ -502,8 +484,6 @@ int ui_filters_open_file_chooser(void)
g_free (filename); g_free (filename);
} }
} }
chooser_running = FALSE;
}
return result; return result;
} }
...@@ -511,13 +491,8 @@ int ui_filters_open_file_chooser(void) ...@@ -511,13 +491,8 @@ int ui_filters_open_file_chooser(void)
int ui_filters_save_file_chooser(void) int ui_filters_save_file_chooser(void)
{ {
int result = RC_OK; int result = RC_OK;
if (chooser_running == FALSE)
{
GtkWidget *filechooser; GtkWidget *filechooser;
chooser_running = TRUE;
filechooser = gtk_file_chooser_dialog_new ("Save file", GTK_WINDOW (ui_main_data.window), filechooser = gtk_file_chooser_dialog_new ("Save file", GTK_WINDOW (ui_main_data.window),
GTK_FILE_CHOOSER_ACTION_SAVE, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_FILE_CHOOSER_ACTION_SAVE, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL); GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL);
...@@ -557,8 +532,6 @@ int ui_filters_save_file_chooser(void) ...@@ -557,8 +532,6 @@ int ui_filters_save_file_chooser(void)
} }
} }
gtk_widget_destroy (filechooser); gtk_widget_destroy (filechooser);
chooser_running = FALSE;
}
return result; return result;
} }
......
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