diff --git a/src/misc_interface.c b/src/misc_interface.c index 9484f09d..7201e5b3 100644 --- a/src/misc_interface.c +++ b/src/misc_interface.c @@ -1,7 +1,3 @@ -/* - * DO NOT EDIT THIS FILE - it is generated by Glade. - */ - #ifdef HAVE_CONFIG_H # include #endif @@ -18,6 +14,7 @@ #include "misc_callbacks.h" #include "misc_interface.h" #include "support.h" +#include "file.h" #define GLADE_HOOKUP_OBJECT(component,widget,name) \ g_object_set_data_full (G_OBJECT (component), name, \ @@ -30,347 +27,25 @@ GtkWidget* create_window_startup (void) { GtkWidget *window_startup; - GtkWidget *vbox2; - GtkWidget *vbox34; - GtkWidget *label69; - GtkWidget *combo_country; - GtkWidget *label121; - GtkWidget *hpaned1; - GtkWidget *scrolledwindow10; - GtkWidget *treeview_users; - GtkWidget *scrolledwindow1; - GtkWidget *treeview_startup; - GtkWidget *hseparator11; - GtkWidget *label4; - GtkWidget *combobox_start_league; - GtkWidget *hseparator12; - GtkWidget *label75; - GtkWidget *hbox54; - GtkWidget *entry_player_name; - GtkWidget *button_add_player; - GtkWidget *alignment19; - GtkWidget *hbox55; - GtkWidget *image59; - GtkWidget *label76; - GtkWidget *hseparator13; - GtkWidget *hbox74; - GtkWidget *radiobutton_team_def_load; - GSList *radiobutton_team_def_load_group = NULL; - GtkWidget *radiobutton_team_def_names; - GtkWidget *radiobutton_team_def_dont; - GtkWidget *vseparator2; - GtkWidget *checkbutton_randomise_teams; - GtkWidget *hseparator16; - GtkWidget *hbox3; - GtkWidget *team_selection_ok; - GtkWidget *alignment18; - GtkWidget *hbox53; - GtkWidget *image58; - GtkWidget *label74; - GtkWidget *button_team_selection_back; - GtkWidget *alignment24; - GtkWidget *hbox77; - GtkWidget *image64; - GtkWidget *label122; - GtkWidget *team_selection_cancel; - GtkAccelGroup *accel_group; - GtkTooltips *tooltips; - - tooltips = gtk_tooltips_new (); - - accel_group = gtk_accel_group_new (); - - window_startup = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_container_set_border_width (GTK_CONTAINER (window_startup), 6); - gtk_window_set_position (GTK_WINDOW (window_startup), GTK_WIN_POS_CENTER); - gtk_window_set_modal (GTK_WINDOW (window_startup), TRUE); - gtk_window_set_default_size (GTK_WINDOW (window_startup), 550, 600); - - vbox2 = gtk_vbox_new (FALSE, 0); - gtk_widget_show (vbox2); - gtk_container_add (GTK_CONTAINER (window_startup), vbox2); - - vbox34 = gtk_vbox_new (FALSE, 0); - gtk_widget_show (vbox34); - gtk_box_pack_start (GTK_BOX (vbox2), vbox34, FALSE, TRUE, 0); - - label69 = gtk_label_new (_("Choose country")); - gtk_widget_show (label69); - gtk_box_pack_start (GTK_BOX (vbox34), label69, FALSE, FALSE, 0); - gtk_label_set_justify (GTK_LABEL (label69), GTK_JUSTIFY_CENTER); - gtk_misc_set_padding (GTK_MISC (label69), 0, 1); - - combo_country = gtk_combo_box_new_text (); - gtk_widget_show (combo_country); - gtk_box_pack_start (GTK_BOX (vbox34), combo_country, TRUE, TRUE, 0); - - label121 = gtk_label_new (_("Choose team")); - gtk_widget_show (label121); - gtk_box_pack_start (GTK_BOX (vbox2), label121, FALSE, FALSE, 0); - gtk_misc_set_padding (GTK_MISC (label121), 0, 5); - - hpaned1 = gtk_hpaned_new (); - gtk_widget_show (hpaned1); - gtk_box_pack_start (GTK_BOX (vbox2), hpaned1, TRUE, TRUE, 0); - gtk_paned_set_position (GTK_PANED (hpaned1), 200); - - scrolledwindow10 = gtk_scrolled_window_new (NULL, NULL); - gtk_widget_show (scrolledwindow10); - gtk_paned_pack1 (GTK_PANED (hpaned1), scrolledwindow10, FALSE, TRUE); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow10), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow10), GTK_SHADOW_IN); - - treeview_users = gtk_tree_view_new (); - gtk_widget_show (treeview_users); - gtk_container_add (GTK_CONTAINER (scrolledwindow10), treeview_users); - gtk_tooltips_set_tip (tooltips, treeview_users, _("Click on a user to remove him."), NULL); - - scrolledwindow1 = gtk_scrolled_window_new (NULL, NULL); - gtk_widget_show (scrolledwindow1); - gtk_paned_pack2 (GTK_PANED (hpaned1), scrolledwindow1, TRUE, TRUE); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow1), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow1), GTK_SHADOW_IN); - - treeview_startup = gtk_tree_view_new (); - gtk_widget_show (treeview_startup); - gtk_container_add (GTK_CONTAINER (scrolledwindow1), treeview_startup); - gtk_container_set_border_width (GTK_CONTAINER (treeview_startup), 2); - gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (treeview_startup), TRUE); - gtk_tree_view_set_reorderable (GTK_TREE_VIEW (treeview_startup), TRUE); - - hseparator11 = gtk_hseparator_new (); - gtk_widget_show (hseparator11); - gtk_box_pack_start (GTK_BOX (vbox2), hseparator11, FALSE, FALSE, 0); - gtk_widget_set_size_request (hseparator11, 1, 10); - - label4 = gtk_label_new (_("Choose league to start in")); - gtk_widget_show (label4); - gtk_box_pack_start (GTK_BOX (vbox2), label4, FALSE, FALSE, 0); - - combobox_start_league = gtk_combo_box_new_text (); - gtk_widget_show (combobox_start_league); - gtk_box_pack_start (GTK_BOX (vbox2), combobox_start_league, FALSE, FALSE, 0); - - hseparator12 = gtk_hseparator_new (); - gtk_widget_show (hseparator12); - gtk_box_pack_start (GTK_BOX (vbox2), hseparator12, FALSE, FALSE, 0); - gtk_widget_set_size_request (hseparator12, 1, 5); - - label75 = gtk_label_new (_("Choose username")); - gtk_widget_show (label75); - gtk_box_pack_start (GTK_BOX (vbox2), label75, FALSE, FALSE, 0); - - hbox54 = gtk_hbox_new (FALSE, 5); - gtk_widget_show (hbox54); - gtk_box_pack_start (GTK_BOX (vbox2), hbox54, FALSE, TRUE, 0); - - entry_player_name = gtk_entry_new (); - gtk_widget_show (entry_player_name); - gtk_box_pack_start (GTK_BOX (hbox54), entry_player_name, TRUE, TRUE, 0); - gtk_entry_set_max_length (GTK_ENTRY (entry_player_name), 12); - gtk_entry_set_width_chars (GTK_ENTRY (entry_player_name), 12); - - button_add_player = gtk_button_new (); - gtk_widget_show (button_add_player); - gtk_box_pack_start (GTK_BOX (vbox2), button_add_player, FALSE, FALSE, 0); - gtk_widget_set_sensitive (button_add_player, FALSE); - GTK_WIDGET_UNSET_FLAGS (button_add_player, GTK_CAN_FOCUS); - - alignment19 = gtk_alignment_new (0.5, 0.5, 0, 0); - gtk_widget_show (alignment19); - gtk_container_add (GTK_CONTAINER (button_add_player), alignment19); - - hbox55 = gtk_hbox_new (FALSE, 2); - gtk_widget_show (hbox55); - gtk_container_add (GTK_CONTAINER (alignment19), hbox55); - - image59 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_BUTTON); - gtk_widget_show (image59); - gtk_box_pack_start (GTK_BOX (hbox55), image59, FALSE, FALSE, 0); - - label76 = gtk_label_new_with_mnemonic (_("Add user")); - gtk_widget_show (label76); - gtk_box_pack_start (GTK_BOX (hbox55), label76, FALSE, FALSE, 0); - - hseparator13 = gtk_hseparator_new (); - gtk_widget_show (hseparator13); - gtk_box_pack_start (GTK_BOX (vbox2), hseparator13, FALSE, TRUE, 0); - gtk_widget_set_size_request (hseparator13, 1, 10); - - hbox74 = gtk_hbox_new (FALSE, 0); - gtk_widget_show (hbox74); - gtk_box_pack_start (GTK_BOX (vbox2), hbox74, FALSE, FALSE, 0); - - radiobutton_team_def_load = gtk_radio_button_new_with_mnemonic (NULL, _("Load team definitions")); - gtk_widget_show (radiobutton_team_def_load); - gtk_box_pack_start (GTK_BOX (hbox74), radiobutton_team_def_load, FALSE, FALSE, 0); - gtk_tooltips_set_tip (tooltips, radiobutton_team_def_load, _("Load teams from definition files (note that the official Bygfoot package doesn't contain team definition files, you have to get them from the homepage or via the bygfoot-update script)"), NULL); - gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton_team_def_load), radiobutton_team_def_load_group); - radiobutton_team_def_load_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton_team_def_load)); - - radiobutton_team_def_names = gtk_radio_button_new_with_mnemonic (NULL, _("Only names")); - gtk_widget_show (radiobutton_team_def_names); - gtk_box_pack_start (GTK_BOX (hbox74), radiobutton_team_def_names, FALSE, FALSE, 0); - gtk_tooltips_set_tip (tooltips, radiobutton_team_def_names, _("Load only the player names in the definition files"), NULL); - gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton_team_def_names), radiobutton_team_def_load_group); - radiobutton_team_def_load_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton_team_def_names)); - - radiobutton_team_def_dont = gtk_radio_button_new_with_mnemonic (NULL, _("Don't load definitions")); - gtk_widget_show (radiobutton_team_def_dont); - gtk_box_pack_start (GTK_BOX (hbox74), radiobutton_team_def_dont, FALSE, FALSE, 0); - gtk_tooltips_set_tip (tooltips, radiobutton_team_def_dont, _("Don't load team definitions at all"), NULL); - gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton_team_def_dont), radiobutton_team_def_load_group); - radiobutton_team_def_load_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton_team_def_dont)); - - vseparator2 = gtk_vseparator_new (); - gtk_widget_show (vseparator2); - gtk_box_pack_start (GTK_BOX (hbox74), vseparator2, FALSE, FALSE, 0); - gtk_widget_set_size_request (vseparator2, 10, 1); - - checkbutton_randomise_teams = gtk_check_button_new_with_mnemonic (_("Randomise teams in cups")); - gtk_widget_show (checkbutton_randomise_teams); - gtk_box_pack_start (GTK_BOX (hbox74), checkbutton_randomise_teams, FALSE, FALSE, 0); - gtk_tooltips_set_tip (tooltips, checkbutton_randomise_teams, _("Randomise the order of teams in cups. This only makes sense in supernational definitions like the World Cup where the order of teams is fixed."), NULL); - - hseparator16 = gtk_hseparator_new (); - gtk_widget_show (hseparator16); - gtk_box_pack_start (GTK_BOX (vbox2), hseparator16, FALSE, FALSE, 0); - gtk_widget_set_size_request (hseparator16, 1, 5); - - hbox3 = gtk_hbox_new (FALSE, 0); - gtk_widget_show (hbox3); - gtk_box_pack_start (GTK_BOX (vbox2), hbox3, FALSE, TRUE, 0); - - team_selection_ok = gtk_button_new (); - gtk_widget_show (team_selection_ok); - gtk_box_pack_start (GTK_BOX (hbox3), team_selection_ok, TRUE, TRUE, 0); - gtk_container_set_border_width (GTK_CONTAINER (team_selection_ok), 2); - gtk_widget_set_sensitive (team_selection_ok, FALSE); - gtk_tooltips_set_tip (tooltips, team_selection_ok, _("Space"), NULL); - gtk_widget_add_accelerator (team_selection_ok, "clicked", accel_group, - GDK_space, (GdkModifierType) 0, - GTK_ACCEL_VISIBLE); - - alignment18 = gtk_alignment_new (0.5, 0.5, 0, 0); - gtk_widget_show (alignment18); - gtk_container_add (GTK_CONTAINER (team_selection_ok), alignment18); - - hbox53 = gtk_hbox_new (FALSE, 2); - gtk_widget_show (hbox53); - gtk_container_add (GTK_CONTAINER (alignment18), hbox53); - - image58 = gtk_image_new_from_stock ("gtk-apply", GTK_ICON_SIZE_BUTTON); - gtk_widget_show (image58); - gtk_box_pack_start (GTK_BOX (hbox53), image58, FALSE, FALSE, 0); - - label74 = gtk_label_new_with_mnemonic (_("Start")); - gtk_widget_show (label74); - gtk_box_pack_start (GTK_BOX (hbox53), label74, FALSE, FALSE, 0); - - button_team_selection_back = gtk_button_new (); - gtk_widget_show (button_team_selection_back); - gtk_box_pack_start (GTK_BOX (hbox3), button_team_selection_back, FALSE, FALSE, 0); - gtk_container_set_border_width (GTK_CONTAINER (button_team_selection_back), 2); - gtk_tooltips_set_tip (tooltips, button_team_selection_back, _("Go back to the splash screen"), NULL); - - alignment24 = gtk_alignment_new (0.5, 0.5, 0, 0); - gtk_widget_show (alignment24); - gtk_container_add (GTK_CONTAINER (button_team_selection_back), alignment24); - - hbox77 = gtk_hbox_new (FALSE, 2); - gtk_widget_show (hbox77); - gtk_container_add (GTK_CONTAINER (alignment24), hbox77); - - image64 = gtk_image_new_from_stock ("gtk-go-back", GTK_ICON_SIZE_BUTTON); - gtk_widget_show (image64); - gtk_box_pack_start (GTK_BOX (hbox77), image64, FALSE, FALSE, 0); - - label122 = gtk_label_new_with_mnemonic (_("Back to splash")); - gtk_widget_show (label122); - gtk_box_pack_start (GTK_BOX (hbox77), label122, FALSE, FALSE, 0); - - team_selection_cancel = gtk_button_new_from_stock ("gtk-quit"); - gtk_widget_show (team_selection_cancel); - gtk_box_pack_start (GTK_BOX (hbox3), team_selection_cancel, TRUE, TRUE, 0); - gtk_container_set_border_width (GTK_CONTAINER (team_selection_cancel), 2); - gtk_tooltips_set_tip (tooltips, team_selection_cancel, _("Esc"), NULL); - gtk_widget_add_accelerator (team_selection_cancel, "clicked", accel_group, - GDK_Escape, (GdkModifierType) 0, - GTK_ACCEL_VISIBLE); - - g_signal_connect ((gpointer) window_startup, "delete_event", - G_CALLBACK (on_team_selection_cancel_clicked), - NULL); - g_signal_connect ((gpointer) combo_country, "changed", - G_CALLBACK (on_combo_country_changed), - NULL); - g_signal_connect ((gpointer) treeview_users, "button_press_event", - G_CALLBACK (on_treeview_users_button_press_event), - NULL); - g_signal_connect ((gpointer) entry_player_name, "activate", - G_CALLBACK (on_entry_player_name_activate), - NULL); - g_signal_connect ((gpointer) button_add_player, "clicked", - G_CALLBACK (on_button_add_player_clicked), - NULL); - g_signal_connect ((gpointer) team_selection_ok, "clicked", - G_CALLBACK (on_team_selection_ok_clicked), - NULL); - g_signal_connect ((gpointer) button_team_selection_back, "clicked", - G_CALLBACK (on_button_team_selection_back_clicked), - NULL); - g_signal_connect ((gpointer) team_selection_cancel, "clicked", - G_CALLBACK (on_team_selection_cancel_clicked), - NULL); + GtkBuilder *builder; + builder = load_ui(file_find_support_file("bygfoot_misc.ui", TRUE)); + window_startup = GTK_WIDGET (gtk_builder_get_object (builder, "window_startup")); /* Store pointers to all widgets, for use by lookup_widget(). */ - GLADE_HOOKUP_OBJECT_NO_REF (window_startup, window_startup, "window_startup"); - GLADE_HOOKUP_OBJECT (window_startup, vbox2, "vbox2"); - GLADE_HOOKUP_OBJECT (window_startup, vbox34, "vbox34"); - GLADE_HOOKUP_OBJECT (window_startup, label69, "label69"); - GLADE_HOOKUP_OBJECT (window_startup, combo_country, "combo_country"); - GLADE_HOOKUP_OBJECT (window_startup, label121, "label121"); - GLADE_HOOKUP_OBJECT (window_startup, hpaned1, "hpaned1"); - GLADE_HOOKUP_OBJECT (window_startup, scrolledwindow10, "scrolledwindow10"); - GLADE_HOOKUP_OBJECT (window_startup, treeview_users, "treeview_users"); - GLADE_HOOKUP_OBJECT (window_startup, scrolledwindow1, "scrolledwindow1"); - GLADE_HOOKUP_OBJECT (window_startup, treeview_startup, "treeview_startup"); - GLADE_HOOKUP_OBJECT (window_startup, hseparator11, "hseparator11"); - GLADE_HOOKUP_OBJECT (window_startup, label4, "label4"); - GLADE_HOOKUP_OBJECT (window_startup, combobox_start_league, "combobox_start_league"); - GLADE_HOOKUP_OBJECT (window_startup, hseparator12, "hseparator12"); - GLADE_HOOKUP_OBJECT (window_startup, label75, "label75"); - GLADE_HOOKUP_OBJECT (window_startup, hbox54, "hbox54"); - GLADE_HOOKUP_OBJECT (window_startup, entry_player_name, "entry_player_name"); - GLADE_HOOKUP_OBJECT (window_startup, button_add_player, "button_add_player"); - GLADE_HOOKUP_OBJECT (window_startup, alignment19, "alignment19"); - GLADE_HOOKUP_OBJECT (window_startup, hbox55, "hbox55"); - GLADE_HOOKUP_OBJECT (window_startup, image59, "image59"); - GLADE_HOOKUP_OBJECT (window_startup, label76, "label76"); - GLADE_HOOKUP_OBJECT (window_startup, hseparator13, "hseparator13"); - GLADE_HOOKUP_OBJECT (window_startup, hbox74, "hbox74"); - GLADE_HOOKUP_OBJECT (window_startup, radiobutton_team_def_load, "radiobutton_team_def_load"); - GLADE_HOOKUP_OBJECT (window_startup, radiobutton_team_def_names, "radiobutton_team_def_names"); - GLADE_HOOKUP_OBJECT (window_startup, radiobutton_team_def_dont, "radiobutton_team_def_dont"); - GLADE_HOOKUP_OBJECT (window_startup, vseparator2, "vseparator2"); - GLADE_HOOKUP_OBJECT (window_startup, checkbutton_randomise_teams, "checkbutton_randomise_teams"); - GLADE_HOOKUP_OBJECT (window_startup, hseparator16, "hseparator16"); - GLADE_HOOKUP_OBJECT (window_startup, hbox3, "hbox3"); - GLADE_HOOKUP_OBJECT (window_startup, team_selection_ok, "team_selection_ok"); - GLADE_HOOKUP_OBJECT (window_startup, alignment18, "alignment18"); - GLADE_HOOKUP_OBJECT (window_startup, hbox53, "hbox53"); - GLADE_HOOKUP_OBJECT (window_startup, image58, "image58"); - GLADE_HOOKUP_OBJECT (window_startup, label74, "label74"); - GLADE_HOOKUP_OBJECT (window_startup, button_team_selection_back, "button_team_selection_back"); - GLADE_HOOKUP_OBJECT (window_startup, alignment24, "alignment24"); - GLADE_HOOKUP_OBJECT (window_startup, hbox77, "hbox77"); - GLADE_HOOKUP_OBJECT (window_startup, image64, "image64"); - GLADE_HOOKUP_OBJECT (window_startup, label122, "label122"); - GLADE_HOOKUP_OBJECT (window_startup, team_selection_cancel, "team_selection_cancel"); - GLADE_HOOKUP_OBJECT_NO_REF (window_startup, tooltips, "tooltips"); + //GLADE_HOOKUP_OBJECT_NO_REF (window_startup, window_startup, "window_startup"); + GTK_HOOKUP_OBJECT (window_startup, builder, "combo_country"); + GTK_HOOKUP_OBJECT (window_startup, builder, "treeview_startup"); + GTK_HOOKUP_OBJECT (window_startup, builder, "combobox_start_league"); + GTK_HOOKUP_OBJECT (window_startup, builder, "button_add_player"); + GTK_HOOKUP_OBJECT (window_startup, builder, "treeview_users"); + GTK_HOOKUP_OBJECT (window_startup, builder, "entry_player_name"); + GTK_HOOKUP_OBJECT (window_startup, builder, "team_selection_ok"); + GTK_HOOKUP_OBJECT (window_startup, builder, "radiobutton_team_def_load"); + GTK_HOOKUP_OBJECT (window_startup, builder, "radiobutton_team_def_names"); + GTK_HOOKUP_OBJECT (window_startup, builder, "checkbutton_randomise_teams"); - gtk_widget_grab_focus (treeview_startup); - gtk_window_add_accel_group (GTK_WINDOW (window_startup), accel_group); + /* free memory used by GtkBuilder object */ + g_object_unref (G_OBJECT (builder)); return window_startup; } diff --git a/src/training_interface.c b/src/training_interface.c index 0da09f53..723679cc 100755 --- a/src/training_interface.c +++ b/src/training_interface.c @@ -1,6 +1,3 @@ -/* - * DO NOT EDIT THIS FILE - it is generated by Glade. - */ #ifdef HAVE_CONFIG_H # include #endif @@ -16,249 +13,34 @@ #include "training_callbacks.h" #include "training_interface.h" +#include "file.h" #include "support.h" -#define GLADE_HOOKUP_OBJECT(component,widget,name) \ - g_object_set_data_full (G_OBJECT (component), name, \ - gtk_widget_ref (widget), (GDestroyNotify) gtk_widget_unref) - -#define GLADE_HOOKUP_OBJECT_NO_REF(component,widget,name) \ - g_object_set_data (G_OBJECT (component), name, widget) - GtkWidget* create_window_training_camp (void) { GtkWidget *window_training_camp; - GtkWidget *panel_camp; - GtkWidget *tf_costs; - GtkWidget *hs_camp2; - GtkWidget *l_camp_points; - GtkWidget *b_inc_recreation; - GtkWidget *image2; - GtkWidget *l_recreation; - GtkWidget *l_costs; - GtkWidget *b_dec_training; - GtkWidget *image3; - GtkWidget *l_training; - GtkWidget *b_inc_training; - GtkWidget *image4; - GtkWidget *hs_camp_points; - GtkWidget *hs_training; - GtkWidget *b_dec_recreation; - GtkWidget *image1; - GtkWidget *hs_recreation; - GtkWidget *rb_camp1; - GSList *rb_camp1_group = NULL; - GtkWidget *rb_camp2; - GtkWidget *rb_camp3; - GtkWidget *hs_camp1; - GtkWidget *b_ok; - GtkWidget *b_cancel; - GtkWidget *checkbutton_save; - - window_training_camp = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_window_set_title (GTK_WINDOW (window_training_camp), _("Training camp")); - gtk_window_set_position (GTK_WINDOW (window_training_camp), GTK_WIN_POS_CENTER); - gtk_window_set_modal (GTK_WINDOW (window_training_camp), TRUE); - gtk_window_set_resizable (GTK_WINDOW (window_training_camp), FALSE); - - panel_camp = gtk_fixed_new (); - gtk_widget_show (panel_camp); - gtk_container_add (GTK_CONTAINER (window_training_camp), panel_camp); - gtk_widget_set_size_request (panel_camp, 500, 290); - - tf_costs = gtk_entry_new (); - gtk_widget_show (tf_costs); - gtk_fixed_put (GTK_FIXED (panel_camp), tf_costs, 336, 40); - gtk_widget_set_size_request (tf_costs, 130, 22); - GTK_WIDGET_UNSET_FLAGS (tf_costs, GTK_CAN_FOCUS); - gtk_editable_set_editable (GTK_EDITABLE (tf_costs), FALSE); - gtk_entry_set_has_frame (GTK_ENTRY (tf_costs), FALSE); - gtk_entry_set_invisible_char (GTK_ENTRY (tf_costs), 9679); - - hs_camp2 = gtk_hseparator_new (); - gtk_widget_show (hs_camp2); - gtk_fixed_put (GTK_FIXED (panel_camp), hs_camp2, 25, 90); - gtk_widget_set_size_request (hs_camp2, 450, 16); - - l_camp_points = gtk_label_new (_("Camp points")); - gtk_widget_show (l_camp_points); - gtk_fixed_put (GTK_FIXED (panel_camp), l_camp_points, 24, 192); - gtk_widget_set_size_request (l_camp_points, 140, 20); - - b_inc_recreation = gtk_button_new (); - gtk_widget_show (b_inc_recreation); - gtk_fixed_put (GTK_FIXED (panel_camp), b_inc_recreation, 425, 125); - gtk_widget_set_size_request (b_inc_recreation, 30, 26); - - image2 = create_pixmap (window_training_camp, "increase_green.png"); - gtk_widget_show (image2); - gtk_container_add (GTK_CONTAINER (b_inc_recreation), image2); - - l_recreation = gtk_label_new (_("Recreation")); - gtk_widget_show (l_recreation); - gtk_fixed_put (GTK_FIXED (panel_camp), l_recreation, 24, 128); - gtk_widget_set_size_request (l_recreation, 140, 20); - - l_costs = gtk_label_new (_("Costs")); - gtk_widget_show (l_costs); - gtk_fixed_put (GTK_FIXED (panel_camp), l_costs, 255, 41); - gtk_widget_set_size_request (l_costs, 90, 20); - - b_dec_training = gtk_button_new (); - gtk_widget_show (b_dec_training); - gtk_fixed_put (GTK_FIXED (panel_camp), b_dec_training, 176, 157); - gtk_widget_set_size_request (b_dec_training, 30, 26); - - image3 = create_pixmap (window_training_camp, "decrease_red.png"); - gtk_widget_show (image3); - gtk_container_add (GTK_CONTAINER (b_dec_training), image3); - - l_training = gtk_label_new (_("Training")); - gtk_widget_show (l_training); - gtk_fixed_put (GTK_FIXED (panel_camp), l_training, 24, 160); - gtk_widget_set_size_request (l_training, 140, 20); - - b_inc_training = gtk_button_new (); - gtk_widget_show (b_inc_training); - gtk_fixed_put (GTK_FIXED (panel_camp), b_inc_training, 425, 157); - gtk_widget_set_size_request (b_inc_training, 30, 26); - - image4 = create_pixmap (window_training_camp, "increase_green.png"); - gtk_widget_show (image4); - gtk_container_add (GTK_CONTAINER (b_inc_training), image4); - - hs_camp_points = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (0, 1, 10, 1, 0, 0))); - gtk_widget_show (hs_camp_points); - gtk_fixed_put (GTK_FIXED (panel_camp), hs_camp_points, 220, 184); - gtk_widget_set_size_request (hs_camp_points, 200, 36); - GTK_WIDGET_UNSET_FLAGS (hs_camp_points, GTK_CAN_FOCUS); - gtk_scale_set_value_pos (GTK_SCALE (hs_camp_points), GTK_POS_RIGHT); - - hs_training = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (0, 1, 10, 1, 0, 0))); - gtk_widget_show (hs_training); - gtk_fixed_put (GTK_FIXED (panel_camp), hs_training, 220, 152); - gtk_widget_set_size_request (hs_training, 200, 36); - GTK_WIDGET_UNSET_FLAGS (hs_training, GTK_CAN_FOCUS); - gtk_scale_set_value_pos (GTK_SCALE (hs_training), GTK_POS_RIGHT); - - b_dec_recreation = gtk_button_new (); - gtk_widget_show (b_dec_recreation); - gtk_fixed_put (GTK_FIXED (panel_camp), b_dec_recreation, 176, 125); - gtk_widget_set_size_request (b_dec_recreation, 30, 26); - - image1 = create_pixmap (window_training_camp, "decrease_red.png"); - gtk_widget_show (image1); - gtk_container_add (GTK_CONTAINER (b_dec_recreation), image1); - - hs_recreation = gtk_hscale_new (GTK_ADJUSTMENT (gtk_adjustment_new (0, 1, 10, 1, 0, 0))); - gtk_widget_show (hs_recreation); - gtk_fixed_put (GTK_FIXED (panel_camp), hs_recreation, 220, 120); - gtk_widget_set_size_request (hs_recreation, 200, 36); - GTK_WIDGET_UNSET_FLAGS (hs_recreation, GTK_CAN_FOCUS); - gtk_scale_set_value_pos (GTK_SCALE (hs_recreation), GTK_POS_RIGHT); - - rb_camp1 = gtk_radio_button_new_with_mnemonic (NULL, _("Good Hotel")); - gtk_widget_show (rb_camp1); - gtk_fixed_put (GTK_FIXED (panel_camp), rb_camp1, 24, 16); - gtk_widget_set_size_request (rb_camp1, 200, 21); - gtk_radio_button_set_group (GTK_RADIO_BUTTON (rb_camp1), rb_camp1_group); - rb_camp1_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (rb_camp1)); - - rb_camp2 = gtk_radio_button_new_with_mnemonic (NULL, _("First-Class Hotel")); - gtk_widget_show (rb_camp2); - gtk_fixed_put (GTK_FIXED (panel_camp), rb_camp2, 24, 40); - gtk_widget_set_size_request (rb_camp2, 200, 21); - gtk_radio_button_set_group (GTK_RADIO_BUTTON (rb_camp2), rb_camp1_group); - rb_camp1_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (rb_camp2)); - - rb_camp3 = gtk_radio_button_new_with_mnemonic (NULL, _("Premium Hotel")); - gtk_widget_show (rb_camp3); - gtk_fixed_put (GTK_FIXED (panel_camp), rb_camp3, 24, 64); - gtk_widget_set_size_request (rb_camp3, 200, 21); - gtk_radio_button_set_group (GTK_RADIO_BUTTON (rb_camp3), rb_camp1_group); - rb_camp1_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (rb_camp3)); - - hs_camp1 = gtk_hseparator_new (); - gtk_widget_show (hs_camp1); - gtk_fixed_put (GTK_FIXED (panel_camp), hs_camp1, 25, 232); - gtk_widget_set_size_request (hs_camp1, 450, 16); - - b_ok = gtk_button_new_from_stock ("gtk-apply"); - gtk_widget_show (b_ok); - gtk_fixed_put (GTK_FIXED (panel_camp), b_ok, 256, 254); - gtk_widget_set_size_request (b_ok, 110, 35); - - b_cancel = gtk_button_new_from_stock ("gtk-cancel"); - gtk_widget_show (b_cancel); - gtk_fixed_put (GTK_FIXED (panel_camp), b_cancel, 376, 254); - gtk_widget_set_size_request (b_cancel, 110, 35); - - checkbutton_save = gtk_check_button_new_with_mnemonic (_("Save settings as default")); - gtk_widget_show (checkbutton_save); - gtk_fixed_put (GTK_FIXED (panel_camp), checkbutton_save, 24, 264); - gtk_widget_set_size_request (checkbutton_save, 208, 21); - - g_signal_connect ((gpointer) window_training_camp, "delete_event", - G_CALLBACK (on_window_training_camp_delete_event), - NULL); - g_signal_connect ((gpointer) b_inc_recreation, "clicked", - G_CALLBACK (on_b_inc_recreation_clicked), - NULL); - g_signal_connect ((gpointer) b_dec_training, "clicked", - G_CALLBACK (on_b_dec_training_clicked), - NULL); - g_signal_connect ((gpointer) b_inc_training, "clicked", - G_CALLBACK (on_b_inc_training_clicked), - NULL); - g_signal_connect ((gpointer) b_dec_recreation, "clicked", - G_CALLBACK (on_b_dec_recreation_clicked), - NULL); - g_signal_connect ((gpointer) rb_camp1, "clicked", - G_CALLBACK (on_rb_camp1_clicked), - NULL); - g_signal_connect ((gpointer) rb_camp2, "clicked", - G_CALLBACK (on_rb_camp2_clicked), - NULL); - g_signal_connect ((gpointer) rb_camp3, "clicked", - G_CALLBACK (on_rb_camp3_clicked), - NULL); - g_signal_connect ((gpointer) b_ok, "clicked", - G_CALLBACK (on_b_ok_clicked), - NULL); - g_signal_connect ((gpointer) b_cancel, "clicked", - G_CALLBACK (on_b_cancel_clicked), - NULL); + GtkBuilder *builder; + builder = load_ui(file_find_support_file("bygfoot_training.ui", TRUE)); + window_training_camp = GTK_WIDGET (gtk_builder_get_object (builder, "window_training_camp")); /* Store pointers to all widgets, for use by lookup_widget(). */ - GLADE_HOOKUP_OBJECT_NO_REF (window_training_camp, window_training_camp, "window_training_camp"); - GLADE_HOOKUP_OBJECT (window_training_camp, panel_camp, "panel_camp"); - GLADE_HOOKUP_OBJECT (window_training_camp, tf_costs, "tf_costs"); - GLADE_HOOKUP_OBJECT (window_training_camp, hs_camp2, "hs_camp2"); - GLADE_HOOKUP_OBJECT (window_training_camp, l_camp_points, "l_camp_points"); - GLADE_HOOKUP_OBJECT (window_training_camp, b_inc_recreation, "b_inc_recreation"); - GLADE_HOOKUP_OBJECT (window_training_camp, image2, "image2"); - GLADE_HOOKUP_OBJECT (window_training_camp, l_recreation, "l_recreation"); - GLADE_HOOKUP_OBJECT (window_training_camp, l_costs, "l_costs"); - GLADE_HOOKUP_OBJECT (window_training_camp, b_dec_training, "b_dec_training"); - GLADE_HOOKUP_OBJECT (window_training_camp, image3, "image3"); - GLADE_HOOKUP_OBJECT (window_training_camp, l_training, "l_training"); - GLADE_HOOKUP_OBJECT (window_training_camp, b_inc_training, "b_inc_training"); - GLADE_HOOKUP_OBJECT (window_training_camp, image4, "image4"); - GLADE_HOOKUP_OBJECT (window_training_camp, hs_camp_points, "hs_camp_points"); - GLADE_HOOKUP_OBJECT (window_training_camp, hs_training, "hs_training"); - GLADE_HOOKUP_OBJECT (window_training_camp, b_dec_recreation, "b_dec_recreation"); - GLADE_HOOKUP_OBJECT (window_training_camp, image1, "image1"); - GLADE_HOOKUP_OBJECT (window_training_camp, hs_recreation, "hs_recreation"); - GLADE_HOOKUP_OBJECT (window_training_camp, rb_camp1, "rb_camp1"); - GLADE_HOOKUP_OBJECT (window_training_camp, rb_camp2, "rb_camp2"); - GLADE_HOOKUP_OBJECT (window_training_camp, rb_camp3, "rb_camp3"); - GLADE_HOOKUP_OBJECT (window_training_camp, hs_camp1, "hs_camp1"); - GLADE_HOOKUP_OBJECT (window_training_camp, b_ok, "b_ok"); - GLADE_HOOKUP_OBJECT (window_training_camp, b_cancel, "b_cancel"); - GLADE_HOOKUP_OBJECT (window_training_camp, checkbutton_save, "checkbutton_save"); + GTK_HOOKUP_OBJECT (window_training_camp, builder, "tf_costs"); + GTK_HOOKUP_OBJECT (window_training_camp, builder, "rb_camp1"); + GTK_HOOKUP_OBJECT (window_training_camp, builder, "rb_camp2"); + GTK_HOOKUP_OBJECT (window_training_camp, builder, "rb_camp3"); + GTK_HOOKUP_OBJECT (window_training_camp, builder, "l_costs"); + GTK_HOOKUP_OBJECT (window_training_camp, builder, "l_recreation"); + GTK_HOOKUP_OBJECT (window_training_camp, builder, "l_training"); + GTK_HOOKUP_OBJECT (window_training_camp, builder, "l_camp_points"); + GTK_HOOKUP_OBJECT (window_training_camp, builder, "hs_recreation"); + GTK_HOOKUP_OBJECT (window_training_camp, builder, "hs_training"); + GTK_HOOKUP_OBJECT (window_training_camp, builder, "hs_camp_points"); + GTK_HOOKUP_OBJECT (window_training_camp, builder, "checkbutton_save"); + + /* free memory used by GtkBuilder object */ + g_object_unref (G_OBJECT (builder)); - gtk_widget_grab_focus (rb_camp1); return window_training_camp; } diff --git a/bygfoot_misc.ui b/support_files/bygfoot_misc.ui similarity index 99% rename from bygfoot_misc.ui rename to support_files/bygfoot_misc.ui index e2164e69..de72d65f 100644 --- a/bygfoot_misc.ui +++ b/support_files/bygfoot_misc.ui @@ -3,7 +3,6 @@ - True 6 True center @@ -480,7 +479,6 @@ - True 5 Select font True @@ -542,7 +540,6 @@ - True 6 Live game True @@ -635,7 +632,6 @@ True True - False @@ -955,7 +951,7 @@ True - style_bal.png + pixmaps/style_bal.png @@ -974,7 +970,7 @@ True - boost_off.png + pixmaps/boost_off.png @@ -1010,7 +1006,6 @@ True True Change live game speed. The higher the value the faster the live game. - 1 True @@ -1052,7 +1047,6 @@ True True Change commentary verbosity. The higher this value the more events you can see. - 1 True @@ -1081,7 +1075,6 @@ - True 5 True center @@ -1280,7 +1273,6 @@ True True - 1 2 True @@ -1375,7 +1367,6 @@ True True Right-click to set to 0 - 1 @@ -1466,7 +1457,6 @@ True True Right-click to set to 0 - 1 @@ -1635,7 +1625,6 @@ - True 5 Choose file center @@ -1695,7 +1684,6 @@ - True 5 True center diff --git a/bygfoot_training.ui b/support_files/bygfoot_training.ui similarity index 96% rename from bygfoot_training.ui rename to support_files/bygfoot_training.ui index dd8221ba..66b24338 100755 --- a/bygfoot_training.ui +++ b/support_files/bygfoot_training.ui @@ -62,7 +62,7 @@ True - increase_green.png + pixmaps/increase_green.png @@ -106,7 +106,7 @@ True - decrease_red.png + pixmaps/decrease_red.png @@ -138,7 +138,7 @@ True - increase_green.png + pixmaps/increase_green.png @@ -152,7 +152,6 @@ 200 36 True - right @@ -165,7 +164,6 @@ 200 36 True - right @@ -184,7 +182,7 @@ True - decrease_red.png + pixmaps/decrease_red.png @@ -198,7 +196,6 @@ 200 36 True - right