Crossfire Client, Trunk  R20693
menubar.c
Go to the documentation of this file.
1 /*
2  * Crossfire -- cooperative multi-player graphical RPG and adventure game
3  *
4  * Copyright (c) 1999-2013 Mark Wedel and the Crossfire Development Team
5  * Copyright (c) 1992 Frank Tore Johansen
6  *
7  * Crossfire is free software and comes with ABSOLUTELY NO WARRANTY. You are
8  * welcome to redistribute it under certain conditions. For details, see the
9  * 'LICENSE' and 'COPYING' files.
10  *
11  * The authors can be reached via e-mail to crossfire-devel@real-time.com
12  */
13 
24 #include "client.h"
25 
26 #include <gtk/gtk.h>
27 
28 #ifdef WIN32
29 # include <windows.h>
30 # include "script.h"
31 #endif
32 
33 #include "p_cmd.h"
34 #include "main.h"
35 #include "image.h"
36 #include "gtk2proto.h"
37 
45 static void on_disconnect_activate(GtkMenuItem *menuitem, gpointer user_data) {
46  if (client_is_connected()) {
48  }
49 }
50 
58 static void menu_quit_program(GtkMenuItem *menuitem, gpointer user_data) {
59 #ifdef WIN32
60  script_killall();
61 #endif
62 
63  LOG(LOG_INFO,"gtk-v2::client_exit","Exiting with return value 0.");
64  exit(0);
65 }
66 
74 static void menu_quit_character(GtkMenuItem *menuitem, gpointer user_data) {
75  extended_command("quit");
76 }
77 
81 static void menu_about(GtkMenuItem *menuitem, gpointer user_data) {
82  GtkWidget *about_window;
83  about_window = GTK_WIDGET(gtk_builder_get_object(dialog_xml, "about_window"));
84  gtk_dialog_run(GTK_DIALOG(about_window));
85  gtk_widget_hide(about_window);
86 }
87 
92  GtkWidget *widget;
93 
94  widget = GTK_WIDGET(gtk_builder_get_object(window_xml, "quit_character"));
95  g_signal_connect ((gpointer) widget, "activate",
96  G_CALLBACK (menu_quit_character), NULL);
97 
98  widget = GTK_WIDGET(gtk_builder_get_object(window_xml, "quit"));
99  g_signal_connect ((gpointer) widget, "activate",
100  G_CALLBACK (menu_quit_program), NULL);
101 
102  widget = GTK_WIDGET(gtk_builder_get_object(window_xml, "configure"));
103  g_signal_connect ((gpointer) widget, "activate",
104  G_CALLBACK (on_configure_activate), NULL);
105 
106  widget = GTK_WIDGET(gtk_builder_get_object(window_xml, "disconnect"));
107  g_signal_connect ((gpointer) widget, "activate",
108  G_CALLBACK (on_disconnect_activate), NULL);
109 
110  widget = GTK_WIDGET(gtk_builder_get_object(window_xml, "keybindings"));
111  g_signal_connect ((gpointer) widget, "activate",
112  G_CALLBACK (on_keybindings_activate), NULL);
113 
114  widget = GTK_WIDGET(gtk_builder_get_object(window_xml, "msgctrl"));
115  g_signal_connect ((gpointer) widget, "activate",
116  G_CALLBACK (on_msgctrl_activate), NULL);
117 
118  widget = GTK_WIDGET(gtk_builder_get_object(window_xml, "save_window_position"));
119  g_signal_connect ((gpointer) widget, "activate",
120  G_CALLBACK (on_save_window_position_activate), NULL);
121 
122  widget = GTK_WIDGET(gtk_builder_get_object(window_xml, "spells"));
123  g_signal_connect ((gpointer) widget, "activate",
124  G_CALLBACK (on_spells_activate), NULL);
125 
126  widget = GTK_WIDGET(gtk_builder_get_object(window_xml, "skills"));
127  g_signal_connect ((gpointer) widget, "activate",
128  G_CALLBACK (on_skills_activate), NULL);
129 
130  widget = GTK_WIDGET(gtk_builder_get_object(window_xml, "do_not_pickup"));
131  g_signal_connect ((gpointer) widget, "activate",
132  G_CALLBACK (on_menu_dont_pickup_activate), NULL);
133 
134  widget = GTK_WIDGET(gtk_builder_get_object(window_xml, "stop_before_pickup"));
135  g_signal_connect ((gpointer) widget, "activate",
136  G_CALLBACK (on_menu_stop_before_pickup_activate), NULL);
137 
138  widget = GTK_WIDGET(gtk_builder_get_object(window_xml, "body_armor"));
139  g_signal_connect ((gpointer) widget, "activate",
140  G_CALLBACK (on_menu_body_armor_activate), NULL);
141 
142  widget = GTK_WIDGET(gtk_builder_get_object(window_xml, "boots"));
143  g_signal_connect ((gpointer) widget, "activate",
144  G_CALLBACK (on_menu_boots_activate), NULL);
145 
146  widget = GTK_WIDGET(gtk_builder_get_object(window_xml, "cloaks"));
147  g_signal_connect ((gpointer) widget, "activate",
148  G_CALLBACK (on_menu_cloaks_activate), NULL);
149 
150  widget = GTK_WIDGET(gtk_builder_get_object(window_xml, "gloves"));
151  g_signal_connect ((gpointer) widget, "activate",
152  G_CALLBACK (on_menu_gloves_activate), NULL);
153 
154  widget = GTK_WIDGET(gtk_builder_get_object(window_xml, "helmets"));
155  g_signal_connect ((gpointer) widget, "activate",
156  G_CALLBACK (on_menu_helmets_activate), NULL);
157 
158  widget = GTK_WIDGET(gtk_builder_get_object(window_xml, "shields"));
159  g_signal_connect ((gpointer) widget, "activate",
160  G_CALLBACK (on_menu_shields_activate), NULL);
161 
162  widget = GTK_WIDGET(gtk_builder_get_object(window_xml, "skillscrolls"));
163  g_signal_connect ((gpointer) widget, "activate",
164  G_CALLBACK (on_menu_skillscrolls_activate), NULL);
165 
166  widget = GTK_WIDGET(gtk_builder_get_object(window_xml, "normal_book_scrolls"));
167  g_signal_connect ((gpointer) widget, "activate",
168  G_CALLBACK (on_menu_normal_book_scrolls_activate), NULL);
169 
170  widget = GTK_WIDGET(gtk_builder_get_object(window_xml, "spellbooks"));
171  g_signal_connect ((gpointer) widget, "activate",
172  G_CALLBACK (on_menu_spellbooks_activate), NULL);
173 
174  widget = GTK_WIDGET(gtk_builder_get_object(window_xml, "drinks"));
175  g_signal_connect ((gpointer) widget, "activate",
176  G_CALLBACK (on_menu_drinks_activate), NULL);
177 
178  widget = GTK_WIDGET(gtk_builder_get_object(window_xml, "food"));
179  g_signal_connect ((gpointer) widget, "activate",
180  G_CALLBACK (on_menu_food_activate), NULL);
181 
182  widget = GTK_WIDGET(gtk_builder_get_object(window_xml, "flesh"));
183  g_signal_connect ((gpointer) widget, "activate",
184  G_CALLBACK (on_menu_flesh_activate), NULL);
185 
186  widget = GTK_WIDGET(gtk_builder_get_object(window_xml, "keys"));
187  g_signal_connect ((gpointer) widget, "activate",
188  G_CALLBACK (on_menu_keys_activate), NULL);
189 
190  widget = GTK_WIDGET(gtk_builder_get_object(window_xml, "magical_items"));
191  g_signal_connect ((gpointer) widget, "activate",
192  G_CALLBACK (on_menu_magical_items_activate), NULL);
193 
194  widget = GTK_WIDGET(gtk_builder_get_object(window_xml, "potions"));
195  g_signal_connect ((gpointer) widget, "activate",
196  G_CALLBACK (on_menu_potions_activate), NULL);
197 
198  widget = GTK_WIDGET(gtk_builder_get_object(window_xml, "valuables"));
199  g_signal_connect ((gpointer) widget, "activate",
200  G_CALLBACK (on_menu_valuables_activate), NULL);
201 
202  widget = GTK_WIDGET(gtk_builder_get_object(window_xml, "wands_rods_horns"));
203  g_signal_connect ((gpointer) widget, "activate",
204  G_CALLBACK (on_menu_wands_rods_horns_activate), NULL);
205 
206  widget = GTK_WIDGET(gtk_builder_get_object(window_xml, "jewels"));
207  g_signal_connect ((gpointer) widget, "activate",
208  G_CALLBACK (on_menu_jewels_activate), NULL);
209 
210  widget = GTK_WIDGET(gtk_builder_get_object(window_xml, "containers"));
211  g_signal_connect ((gpointer) widget, "activate",
212  G_CALLBACK (on_menu_containers_activate), NULL);
213 
214  widget = GTK_WIDGET(gtk_builder_get_object(window_xml, "all_weapons"));
215  g_signal_connect ((gpointer) widget, "activate",
216  G_CALLBACK (on_menu_all_weapons_activate), NULL);
217 
218  widget = GTK_WIDGET(gtk_builder_get_object(window_xml, "missile_weapons"));
219  g_signal_connect ((gpointer) widget, "activate",
220  G_CALLBACK (on_menu_missile_weapons_activate), NULL);
221 
222  widget = GTK_WIDGET(gtk_builder_get_object(window_xml, "bows"));
223  g_signal_connect ((gpointer) widget, "activate",
224  G_CALLBACK (on_menu_bows_activate), NULL);
225 
226  widget = GTK_WIDGET(gtk_builder_get_object(window_xml, "arrows"));
227  g_signal_connect ((gpointer) widget, "activate",
228  G_CALLBACK (on_menu_arrows_activate), NULL);
229 
230  widget = GTK_WIDGET(gtk_builder_get_object(window_xml, "ratio_pickup_off"));
231  g_signal_connect ((gpointer) widget, "activate",
232  G_CALLBACK (on_menu_ratio_pickup_off_activate), NULL);
233 
234  widget = GTK_WIDGET(gtk_builder_get_object(window_xml, "ratio_5"));
235  g_signal_connect ((gpointer) widget, "activate",
236  G_CALLBACK (on_menu_ratio_5_activate), NULL);
237 
238  widget = GTK_WIDGET(gtk_builder_get_object(window_xml, "ratio_10"));
239  g_signal_connect ((gpointer) widget, "activate",
240  G_CALLBACK (on_menu_ratio_10_activate), NULL);
241 
242  widget = GTK_WIDGET(gtk_builder_get_object(window_xml, "ratio_15"));
243  g_signal_connect ((gpointer) widget, "activate",
244  G_CALLBACK (on_menu_ratio_15_activate), NULL);
245 
246  widget = GTK_WIDGET(gtk_builder_get_object(window_xml, "ratio_20"));
247  g_signal_connect ((gpointer) widget, "activate",
248  G_CALLBACK (on_menu_ratio_20_activate), NULL);
249 
250  widget = GTK_WIDGET(gtk_builder_get_object(window_xml, "ratio_25"));
251  g_signal_connect ((gpointer) widget, "activate",
252  G_CALLBACK (on_menu_ratio_25_activate), NULL);
253 
254  widget = GTK_WIDGET(gtk_builder_get_object(window_xml, "ratio_30"));
255  g_signal_connect ((gpointer) widget, "activate",
256  G_CALLBACK (on_menu_ratio_35_activate), NULL);
257 
258  widget = GTK_WIDGET(gtk_builder_get_object(window_xml, "ratio_35"));
259  g_signal_connect ((gpointer) widget, "activate",
260  G_CALLBACK (on_menu_ratio_35_activate), NULL);
261 
262  widget = GTK_WIDGET(gtk_builder_get_object(window_xml, "ratio_40"));
263  g_signal_connect ((gpointer) widget, "activate",
264  G_CALLBACK (on_menu_ratio_40_activate), NULL);
265 
266  widget = GTK_WIDGET(gtk_builder_get_object(window_xml, "ratio_45"));
267  g_signal_connect ((gpointer) widget, "activate",
268  G_CALLBACK (on_menu_ratio_45_activate), NULL);
269 
270  widget = GTK_WIDGET(gtk_builder_get_object(window_xml, "ratio_50"));
271  g_signal_connect ((gpointer) widget, "activate",
272  G_CALLBACK (on_menu_ratio_50_activate), NULL);
273 
274  widget = GTK_WIDGET(gtk_builder_get_object(window_xml, "not_cursed"));
275  g_signal_connect ((gpointer) widget, "activate",
276  G_CALLBACK (on_menu_not_cursed_activate), NULL);
277 
278  widget = GTK_WIDGET(gtk_builder_get_object(window_xml, "about"));
279  g_signal_connect ((gpointer) widget, "activate",
280  G_CALLBACK (menu_about), NULL);
281 }
void on_menu_bows_activate(GtkMenuItem *menuitem, gpointer user_data)
Definition: pickup.c:301
GtkBuilder * window_xml
Definition: main.c:86
void on_menu_boots_activate(GtkMenuItem *menuitem, gpointer user_data)
Definition: pickup.c:142
void on_menu_ratio_25_activate(GtkMenuItem *menuitem, gpointer user_data)
Definition: pickup.c:354
void on_menu_ratio_5_activate(GtkMenuItem *menuitem, gpointer user_data)
Definition: pickup.c:326
void on_keybindings_activate(GtkMenuItem *menuitem, gpointer user_data)
Definition: keys.c:1912
void on_save_window_position_activate(GtkMenuItem *menuitem, gpointer user_data)
Definition: config.c:808
void on_menu_gloves_activate(GtkMenuItem *menuitem, gpointer user_data)
Definition: pickup.c:156
void on_menu_body_armor_activate(GtkMenuItem *menuitem, gpointer user_data)
Definition: pickup.c:135
void on_msgctrl_activate(GtkMenuItem *menuitem, gpointer user_data)
Definition: info.c:1896
void on_skills_activate(GtkMenuItem *menuitem, gpointer user_data)
Definition: skills.c:106
void on_menu_ratio_40_activate(GtkMenuItem *menuitem, gpointer user_data)
Definition: pickup.c:375
void on_menu_normal_book_scrolls_activate(GtkMenuItem *menuitem, gpointer user_data)
Definition: pickup.c:189
void on_menu_keys_activate(GtkMenuItem *menuitem, gpointer user_data)
Definition: pickup.c:220
void on_menu_cloaks_activate(GtkMenuItem *menuitem, gpointer user_data)
Definition: pickup.c:149
void on_menu_containers_activate(GtkMenuItem *menuitem, gpointer user_data)
Definition: pickup.c:269
void on_menu_food_activate(GtkMenuItem *menuitem, gpointer user_data)
Definition: pickup.c:213
void on_menu_skillscrolls_activate(GtkMenuItem *menuitem, gpointer user_data)
Definition: pickup.c:181
void on_menu_all_weapons_activate(GtkMenuItem *menuitem, gpointer user_data)
Definition: pickup.c:287
void on_menu_potions_activate(GtkMenuItem *menuitem, gpointer user_data)
Definition: pickup.c:234
void on_menu_ratio_50_activate(GtkMenuItem *menuitem, gpointer user_data)
Definition: pickup.c:389
void LOG(LogLevel level, const char *origin, const char *format,...)
Definition: misc.c:109
void on_menu_ratio_45_activate(GtkMenuItem *menuitem, gpointer user_data)
Definition: pickup.c:382
void client_disconnect()
Definition: client.c:180
void on_menu_shields_activate(GtkMenuItem *menuitem, gpointer user_data)
Definition: pickup.c:170
void on_menu_flesh_activate(GtkMenuItem *menuitem, gpointer user_data)
Definition: pickup.c:276
void on_menu_spellbooks_activate(GtkMenuItem *menuitem, gpointer user_data)
Definition: pickup.c:197
void on_menu_not_cursed_activate(GtkMenuItem *menuitem, gpointer user_data)
Definition: pickup.c:255
void on_menu_stop_before_pickup_activate(GtkMenuItem *menuitem, gpointer user_data)
Definition: pickup.c:124
void on_menu_dont_pickup_activate(GtkMenuItem *menuitem, gpointer user_data)
Definition: pickup.c:117
void on_menu_helmets_activate(GtkMenuItem *menuitem, gpointer user_data)
Definition: pickup.c:163
void on_spells_activate(GtkMenuItem *menuitem, gpointer user_data)
Definition: spells.c:282
void on_menu_ratio_20_activate(GtkMenuItem *menuitem, gpointer user_data)
Definition: pickup.c:347
void on_menu_jewels_activate(GtkMenuItem *menuitem, gpointer user_data)
Definition: pickup.c:262
void extended_command(const char *ocommand)
Definition: p_cmd.c:484
void on_configure_activate(GtkWidget *menuitem, gpointer user_data)
Definition: config.c:753
void on_menu_ratio_10_activate(GtkMenuItem *menuitem, gpointer user_data)
Definition: pickup.c:333
void on_menu_missile_weapons_activate(GtkMenuItem *menuitem, gpointer user_data)
Definition: pickup.c:294
void on_menu_ratio_35_activate(GtkMenuItem *menuitem, gpointer user_data)
Definition: pickup.c:368
void on_menu_ratio_pickup_off_activate(GtkMenuItem *menuitem, gpointer user_data)
Definition: pickup.c:319
void on_menu_valuables_activate(GtkMenuItem *menuitem, gpointer user_data)
Definition: pickup.c:241
void on_menu_magical_items_activate(GtkMenuItem *menuitem, gpointer user_data)
Definition: pickup.c:227
void on_menu_ratio_15_activate(GtkMenuItem *menuitem, gpointer user_data)
Definition: pickup.c:340
void on_menu_wands_rods_horns_activate(GtkMenuItem *menuitem, gpointer user_data)
Definition: pickup.c:248
void on_menu_drinks_activate(GtkMenuItem *menuitem, gpointer user_data)
Definition: pickup.c:206
void on_menu_arrows_activate(GtkMenuItem *menuitem, gpointer user_data)
Definition: pickup.c:308
GtkBuilder * dialog_xml
Definition: main.c:86
bool client_is_connected()
Definition: client.c:289
Minor, non-harmful issues.
Definition: client.h:442