1
0
mirror of https://github.com/cclassic/model-ghdl synced 2024-11-29 09:13:28 +01:00

GUI: Fixed an error where an error message would re-show the simulation time box

This commit is contained in:
Makise Kurisu 2016-05-08 16:17:11 +02:00
parent a62951aed2
commit 59e3a4855c

8
gui.c
View File

@ -16,8 +16,11 @@ int showMessage(int message_type, char *text, char *defaultText, char **reply) {
GtkWidget *buttonBox; GtkWidget *buttonBox;
GtkWidget *mainBox; GtkWidget *mainBox;
GtkWidget *label; GtkWidget *label;
gboolean ret;
char *entryText; char *entryText;
ret = true;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL); window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(window), "model-ghdl"); gtk_window_set_title(GTK_WINDOW(window), "model-ghdl");
@ -71,17 +74,18 @@ int showMessage(int message_type, char *text, char *defaultText, char **reply) {
if (MESSAGE_IS_INPUT(message_type)) { if (MESSAGE_IS_INPUT(message_type)) {
entryText = (char*) gtk_entry_get_text(GTK_ENTRY(entry)); entryText = (char*) gtk_entry_get_text(GTK_ENTRY(entry));
if (entryText[0] == 0) { if (entryText[0] == 0) {
return false; ret = false;
} }
else { else {
*reply = realloc(*reply, sizeof(char)*strlen(entryText)); *reply = realloc(*reply, sizeof(char)*strlen(entryText));
if (*reply != NULL) if (*reply != NULL)
strcpy(*reply, entryText); strcpy(*reply, entryText);
return true; ret = true;
} }
} }
gtk_widget_destroy(window); gtk_widget_destroy(window);
return ret;
} }
static void okay( GtkWidget *widget, static void okay( GtkWidget *widget,