Revision 1082 branches/simulator/projects/simulator/simulator/gui/gtk_gui.c

View differences:

gtk_gui.c
7 7

  
8 8
#include "robot.h"
9 9

  
10
#define NEW_ROBOT 1
11
#define PAUSE 2
12
#define RESUME 3
10
#define NEW_ROBOT	1
11
#define PAUSE		2
12
#define QUIT		3
13 13

  
14 14
GtkWidget* window;
15 15
GtkWidget* view = NULL;
......
46 46
	}
47 47
	gtk_widget_destroy (dialog);
48 48
	
49
	gdk_threads_leave();
50
	robots_resume();
51
	gdk_threads_enter();
49
	if (!robots_paused)
50
	{
51
		gdk_threads_leave();
52
		robots_resume();
53
		gdk_threads_enter();
54
	}
52 55
}
53 56

  
54 57
static gboolean menuhandler(int type)
......
67 70
			robots_paused = !robots_paused;
68 71
			gdk_threads_enter();
69 72
			break;
70
		case RESUME:
71
			gdk_threads_leave();
72
			robots_resume();
73
			gdk_threads_enter();
73
		case QUIT:
74
			destroy_callback(0);
74 75
			break;
75 76
	}
76 77

  
......
101 102
	g_signal_connect_swapped(G_OBJECT(menu_item), "activate",
102 103
		G_CALLBACK(menuhandler), (gint*)PAUSE);
103 104
	
105
	menu_item = gtk_menu_item_new_with_label("Quit");
106
	gtk_widget_show(menu_item);
107
	gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), menu_item);
108
	g_signal_connect_swapped(G_OBJECT(menu_item), "activate",
109
		G_CALLBACK(menuhandler), (gint*)QUIT);
110
	
104 111
	file_item = gtk_menu_item_new_with_label("File");
105 112
	gtk_widget_show(file_item);
106 113
	gtk_menu_item_set_submenu(GTK_MENU_ITEM(file_item), file_menu);

Also available in: Unified diff