Crossfire Client, Branch
R11627
|
00001 const char * const rcsid_gtk2_menubar_c = 00002 "$Id: menubar.c 9193 2008-06-01 14:26:32Z anmaster $"; 00003 /* 00004 Crossfire client, a client program for the crossfire program. 00005 00006 Copyright (C) 2005 Mark Wedel & Crossfire Development Team 00007 00008 This program is free software; you can redistribute it and/or modify 00009 it under the terms of the GNU General Public License as published by 00010 the Free Software Foundation; either version 2 of the License, or 00011 (at your option) any later version. 00012 00013 This program is distributed in the hope that it will be useful, 00014 but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 GNU General Public License for more details. 00017 00018 You should have received a copy of the GNU General Public License 00019 along with this program; if not, write to the Free Software 00020 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00021 00022 The author can be reached via e-mail to crossfire@metalforge.org 00023 */ 00024 00035 #ifdef HAVE_CONFIG_H 00036 # include <config.h> 00037 #endif 00038 00039 #ifdef WIN32 00040 #include <windows.h> 00041 #endif 00042 #include <gtk/gtk.h> 00043 #include <glade/glade.h> 00044 00045 #include "client.h" 00046 00047 #include "p_cmd.h" 00048 #include "main.h" 00049 #include "image.h" 00050 #include "gtk2proto.h" 00051 00059 void 00060 on_disconnect_activate (GtkMenuItem *menuitem, 00061 gpointer user_data) 00062 { 00063 extern gint csocket_fd; 00064 00065 #ifdef WIN32 00066 closesocket(csocket.fd); 00067 #else 00068 close(csocket.fd); 00069 #endif 00070 csocket.fd = -1; 00071 if (csocket_fd) { 00072 gdk_input_remove(csocket_fd); 00073 csocket_fd=0; 00074 gtk_main_quit(); 00075 } 00076 } 00077 00085 void 00086 menu_quit_program (GtkMenuItem *menuitem, 00087 gpointer user_data) 00088 { 00089 #ifdef WIN32 00090 script_killall(); 00091 #endif 00092 00093 LOG(LOG_INFO,"gtk::client_exit","Exiting with return value 0."); 00094 exit(0); 00095 00096 } 00097 00105 void 00106 menu_quit_character (GtkMenuItem *menuitem, 00107 gpointer user_data) 00108 { 00109 extended_command("quit"); 00110 } 00111 00121 void enable_menu_items(int enable) 00122 { 00123 GladeXML *xml_tree; 00124 GtkWidget *widget; 00125 00126 xml_tree = glade_get_widget_tree(GTK_WIDGET(window_root)); 00127 00128 widget = glade_xml_get_widget(xml_tree, "quit_character1"); 00129 g_signal_connect ((gpointer) widget, "activate", 00130 G_CALLBACK (menu_quit_character), NULL); 00131 00132 widget = glade_xml_get_widget(xml_tree, "quit2"); 00133 g_signal_connect ((gpointer) widget, "activate", 00134 G_CALLBACK (menu_quit_program), NULL); 00135 00136 widget = glade_xml_get_widget(xml_tree, "configure1"); 00137 g_signal_connect ((gpointer) widget, "activate", 00138 G_CALLBACK (on_configure_activate), NULL); 00139 00140 widget = glade_xml_get_widget(xml_tree, "disconnect"); 00141 g_signal_connect ((gpointer) widget, "activate", 00142 G_CALLBACK (on_disconnect_activate), NULL); 00143 00144 widget = glade_xml_get_widget(xml_tree, "keybindings"); 00145 g_signal_connect ((gpointer) widget, "activate", 00146 G_CALLBACK (on_keybindings_activate), NULL); 00147 00148 widget = glade_xml_get_widget(xml_tree, "save_window_position"); 00149 g_signal_connect ((gpointer) widget, "activate", 00150 G_CALLBACK (on_save_window_position_activate), NULL); 00151 00152 widget = glade_xml_get_widget(xml_tree, "spells"); 00153 g_signal_connect ((gpointer) widget, "activate", 00154 G_CALLBACK (on_spells_activate), NULL); 00155 00156 widget = glade_xml_get_widget(xml_tree, "do_not_pickup"); 00157 g_signal_connect ((gpointer) widget, "activate", 00158 G_CALLBACK (on_menu_dont_pickup_activate), NULL); 00159 00160 widget = glade_xml_get_widget(xml_tree, "stop_before_pickup1"); 00161 g_signal_connect ((gpointer) widget, "activate", 00162 G_CALLBACK (on_menu_stop_before_pickup_activate), NULL); 00163 00164 widget = glade_xml_get_widget(xml_tree, "body_armor1"); 00165 g_signal_connect ((gpointer) widget, "activate", 00166 G_CALLBACK (on_menu_body_armor_activate), NULL); 00167 00168 widget = glade_xml_get_widget(xml_tree, "boots1"); 00169 g_signal_connect ((gpointer) widget, "activate", 00170 G_CALLBACK (on_menu_boots_activate), NULL); 00171 00172 widget = glade_xml_get_widget(xml_tree, "cloaks1"); 00173 g_signal_connect ((gpointer) widget, "activate", 00174 G_CALLBACK (on_menu_cloaks_activate), NULL); 00175 00176 widget = glade_xml_get_widget(xml_tree, "gloves1"); 00177 g_signal_connect ((gpointer) widget, "activate", 00178 G_CALLBACK (on_menu_gloves_activate), NULL); 00179 00180 widget = glade_xml_get_widget(xml_tree, "helmets1"); 00181 g_signal_connect ((gpointer) widget, "activate", 00182 G_CALLBACK (on_menu_helmets_activate), NULL); 00183 00184 widget = glade_xml_get_widget(xml_tree, "shields1"); 00185 g_signal_connect ((gpointer) widget, "activate", 00186 G_CALLBACK (on_menu_shields_activate), NULL); 00187 00188 widget = glade_xml_get_widget(xml_tree, "skillscrolls1"); 00189 g_signal_connect ((gpointer) widget, "activate", 00190 G_CALLBACK (on_menu_skillscrolls_activate), NULL); 00191 00192 widget = glade_xml_get_widget(xml_tree, "normal_book_scrolls1"); 00193 g_signal_connect ((gpointer) widget, "activate", 00194 G_CALLBACK (on_menu_normal_book_scrolls_activate), NULL); 00195 00196 widget = glade_xml_get_widget(xml_tree, "spellbooks1"); 00197 g_signal_connect ((gpointer) widget, "activate", 00198 G_CALLBACK (on_menu_spellbooks_activate), NULL); 00199 00200 widget = glade_xml_get_widget(xml_tree, "drinks1"); 00201 g_signal_connect ((gpointer) widget, "activate", 00202 G_CALLBACK (on_menu_drinks_activate), NULL); 00203 00204 widget = glade_xml_get_widget(xml_tree, "food1"); 00205 g_signal_connect ((gpointer) widget, "activate", 00206 G_CALLBACK (on_menu_food_activate), NULL); 00207 00208 widget = glade_xml_get_widget(xml_tree, "flesh1"); 00209 g_signal_connect ((gpointer) widget, "activate", 00210 G_CALLBACK (on_menu_flesh_activate), NULL); 00211 00212 widget = glade_xml_get_widget(xml_tree, "keys1"); 00213 g_signal_connect ((gpointer) widget, "activate", 00214 G_CALLBACK (on_menu_keys_activate), NULL); 00215 00216 widget = glade_xml_get_widget(xml_tree, "magical_items"); 00217 g_signal_connect ((gpointer) widget, "activate", 00218 G_CALLBACK (on_menu_magical_items_activate), NULL); 00219 00220 widget = glade_xml_get_widget(xml_tree, "potions"); 00221 g_signal_connect ((gpointer) widget, "activate", 00222 G_CALLBACK (on_menu_potions_activate), NULL); 00223 00224 widget = glade_xml_get_widget(xml_tree, "valuables"); 00225 g_signal_connect ((gpointer) widget, "activate", 00226 G_CALLBACK (on_menu_valuables_activate), NULL); 00227 00228 widget = glade_xml_get_widget(xml_tree, "wands_rods_horns"); 00229 g_signal_connect ((gpointer) widget, "activate", 00230 G_CALLBACK (on_menu_wands_rods_horns_activate), NULL); 00231 00232 widget = glade_xml_get_widget(xml_tree, "jewels1"); 00233 g_signal_connect ((gpointer) widget, "activate", 00234 G_CALLBACK (on_menu_jewels_activate), NULL); 00235 00236 widget = glade_xml_get_widget(xml_tree, "all_weapons"); 00237 g_signal_connect ((gpointer) widget, "activate", 00238 G_CALLBACK (on_menu_all_weapons_activate), NULL); 00239 00240 widget = glade_xml_get_widget(xml_tree, "missile_weapons1"); 00241 g_signal_connect ((gpointer) widget, "activate", 00242 G_CALLBACK (on_menu_missile_weapons_activate), NULL); 00243 00244 widget = glade_xml_get_widget(xml_tree, "bows1"); 00245 g_signal_connect ((gpointer) widget, "activate", 00246 G_CALLBACK (on_menu_bows_activate), NULL); 00247 00248 widget = glade_xml_get_widget(xml_tree, "arrows1"); 00249 g_signal_connect ((gpointer) widget, "activate", 00250 G_CALLBACK (on_menu_arrows_activate), NULL); 00251 00252 widget = glade_xml_get_widget(xml_tree, "ratio_pickup_off1"); 00253 g_signal_connect ((gpointer) widget, "activate", 00254 G_CALLBACK (on_menu_ratio_pickup_off_activate), NULL); 00255 00256 widget = glade_xml_get_widget(xml_tree, "ratio_5"); 00257 g_signal_connect ((gpointer) widget, "activate", 00258 G_CALLBACK (on_menu_ratio_5_activate), NULL); 00259 00260 widget = glade_xml_get_widget(xml_tree, "ratio_10"); 00261 g_signal_connect ((gpointer) widget, "activate", 00262 G_CALLBACK (on_menu_ratio_10_activate), NULL); 00263 00264 widget = glade_xml_get_widget(xml_tree, "ratio_15"); 00265 g_signal_connect ((gpointer) widget, "activate", 00266 G_CALLBACK (on_menu_ratio_15_activate), NULL); 00267 00268 widget = glade_xml_get_widget(xml_tree, "ratio_20"); 00269 g_signal_connect ((gpointer) widget, "activate", 00270 G_CALLBACK (on_menu_ratio_20_activate), NULL); 00271 00272 widget = glade_xml_get_widget(xml_tree, "ratio_25"); 00273 g_signal_connect ((gpointer) widget, "activate", 00274 G_CALLBACK (on_menu_ratio_25_activate), NULL); 00275 00276 widget = glade_xml_get_widget(xml_tree, "ratio_30"); 00277 g_signal_connect ((gpointer) widget, "activate", 00278 G_CALLBACK (on_menu_ratio_35_activate), NULL); 00279 00280 widget = glade_xml_get_widget(xml_tree, "ratio_35"); 00281 g_signal_connect ((gpointer) widget, "activate", 00282 G_CALLBACK (on_menu_ratio_35_activate), NULL); 00283 00284 widget = glade_xml_get_widget(xml_tree, "ratio_40"); 00285 g_signal_connect ((gpointer) widget, "activate", 00286 G_CALLBACK (on_menu_ratio_40_activate), NULL); 00287 00288 widget = glade_xml_get_widget(xml_tree, "ratio_45"); 00289 g_signal_connect ((gpointer) widget, "activate", 00290 G_CALLBACK (on_menu_ratio_45_activate), NULL); 00291 00292 widget = glade_xml_get_widget(xml_tree, "ratio_50"); 00293 g_signal_connect ((gpointer) widget, "activate", 00294 G_CALLBACK (on_menu_ratio_50_activate), NULL); 00295 00296 widget = glade_xml_get_widget(xml_tree, "not_cursed1"); 00297 g_signal_connect ((gpointer) widget, "activate", 00298 G_CALLBACK (on_menu_not_cursed_activate), NULL); 00299 00300 widget = glade_xml_get_widget(xml_tree, "about1"); 00301 g_signal_connect ((gpointer) widget, "activate", 00302 G_CALLBACK (menu_about), NULL); 00303 }