~ubuntu-branches/ubuntu/hardy/bygfoot/hardy

« back to all changes in this revision

Viewing changes to src/callbacks.c

  • Committer: Bazaar Package Importer
  • Author(s): Isaac Clerencia
  • Date: 2006-06-04 17:51:19 UTC
  • mfrom: (1.2.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20060604175119-0pbfuhr617031qa9
Tags: 2.0.0-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
   callbacks.c
 
3
 
 
4
   Bygfoot Football Manager -- a small and simple GTK2-based
 
5
   football management game.
 
6
 
 
7
   http://bygfoot.sourceforge.net
 
8
 
 
9
   Copyright (C) 2005  Gyözö Both (gyboth@bygfoot.com)
 
10
 
 
11
   This program is free software; you can redistribute it and/or
 
12
   modify it under the terms of the GNU General Public License
 
13
   as published by the Free Software Foundation; either version 2
 
14
   of the License, or (at your option) any later version.
 
15
 
 
16
   This program is distributed in the hope that it will be useful,
 
17
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
18
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
19
   GNU General Public License for more details.
 
20
 
 
21
   You should have received a copy of the GNU General Public License
 
22
   along with this program; if not, write to the Free Software
 
23
   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
24
*/
 
25
 
1
26
#include "callbacks.h"
2
27
#include "callback_func.h"
3
28
#include "debug.h"
5
30
#include "game.h"
6
31
#include "game_gui.h"
7
32
#include "gui.h"
 
33
#include "job.h"
8
34
#include "league.h"
9
35
#include "load_save.h"
10
36
#include "main.h"
 
37
#include "misc2_callback_func.h"
11
38
#include "option.h"
12
39
#include "player.h"
13
40
#include "table.h"
34
61
on_menu_new_activate                   (GtkMenuItem     *menuitem,
35
62
                                        gpointer         user_data)
36
63
{
37
 
    window_destroy(&window.main, FALSE);
 
64
    window_destroy(&window.main);
38
65
    free_memory();
39
66
    
40
67
    main_init(NULL, NULL);
149
176
        game_gui_print_message(_("Transfers are disabled in this country definition."));
150
177
    else if(week < transfer_get_deadline() || transfer_list->len > 0)
151
178
    {
152
 
        stat0 = STATUS_SHOW_TRANSFER_LIST;
153
 
        game_gui_print_message(_("Left click to make an offer. Right click to remove offer."));
154
 
        game_gui_print_message_with_delay(_("Transfer deadline is Week %d"), transfer_get_deadline());
155
 
        treeview_show_transfer_list(GTK_TREE_VIEW(lookup_widget(window.main, "treeview_right")));
156
 
        gtk_notebook_set_current_page(GTK_NOTEBOOK(lookup_widget(window.main, "notebook_player")), 1);
 
179
        if(stat0 != STATUS_SHOW_TRANSFER_LIST)
 
180
        {
 
181
            stat0 = STATUS_SHOW_TRANSFER_LIST;
 
182
            game_gui_print_message(
 
183
                _("Left click to make an offer. Right click to remove offer."));
 
184
            game_gui_print_message_with_delay(
 
185
                _("Transfer deadline is Week %d"), transfer_get_deadline());
 
186
        }
 
187
 
 
188
        treeview_show_transfer_list(
 
189
            GTK_TREE_VIEW(lookup_widget(window.main, "treeview_right")));
 
190
        gtk_notebook_set_current_page(
 
191
            GTK_NOTEBOOK(lookup_widget(window.main, "notebook_player")), 1);
157
192
        
158
193
        gui_set_arrows();
159
194
    }
394
429
on_menu_season_history_activate        (GtkMenuItem     *menuitem,
395
430
                                        gpointer         user_data)
396
431
{
397
 
    if(season == 1)
 
432
    if(season_stats->len == 0)
398
433
    {
399
 
        game_gui_print_message(_("This is your first season."));
 
434
        game_gui_print_message(
 
435
            _("There are no season history elements stored yet."));
400
436
        return;
401
437
    }
402
438
 
505
541
        if(pl->age > const_float("float_player_age_lower"))
506
542
            game_gui_print_message(_("The player is too old for the youth academy."));
507
543
        else if(current_user.tm->players->len <= 11)
508
 
            game_gui_print_message(_("You can't move the player, there are too few players in your team."));
 
544
            game_gui_print_message(
 
545
                _("You can't move the player, there are too few players in your team."));
509
546
        else if(current_user.youth_academy.players->len ==
510
547
                const_int("int_youth_academy_max_youths"))
511
548
            game_gui_print_message(_("There is no room in your youth academy."));
588
625
    {
589
626
        case STATUS_SHOW_TRANSFER_LIST:
590
627
            if(trans(idx - 1).tm == current_user.tm ||
591
 
               (trans(idx - 1).offers->len > 0 && transoff(idx - 1, 0).status == TRANSFER_OFFER_ACCEPTED) ||
 
628
               (trans(idx - 1).offers->len > 0 && 
 
629
                transoff(idx - 1, 0).status == TRANSFER_OFFER_ACCEPTED) ||
592
630
               event->button == 1)
593
631
                callback_transfer_list_clicked(event->button, idx - 1);
594
632
            else if(event->button == 3)
596
634
                if(transfer_remove_offer(idx - 1, current_user.tm))
597
635
                    game_gui_print_message(_("Your offer has been removed."));
598
636
                else
599
 
                    game_gui_print_message(_("You haven't made an offer for the player."));
 
637
                    game_gui_print_message(
 
638
                        _("You haven't made an offer for the player."));
600
639
                return TRUE;
601
640
            }
602
641
            break;
611
650
            break;
612
651
        case STATUS_SHOW_YA:
613
652
            selected_row = idx - 1;
614
 
            if(event->button == 3)
 
653
            if(event->button == 1)
615
654
                on_menu_youth_move_to_team_activate(NULL, NULL);
616
 
            else
 
655
            else if(event->button == 3)
617
656
                window_show_menu_youth((GdkEvent*)event);
618
657
            break;
 
658
        case STATUS_SHOW_JOB_EXCHANGE:
 
659
            if(g_array_index(jobs, Job, idx - 1).type != JOB_TYPE_NATIONAL &&
 
660
               users->len > 1)
 
661
                game_gui_show_warning(_("You can't apply for a job from abroad if there's more than one user."));
 
662
            else if(event->button == 1)
 
663
                game_gui_show_job_offer(NULL, 
 
664
                                        &g_array_index(jobs, Job, idx - 1),
 
665
                                        STATUS_JOB_EXCHANGE_SHOW_TEAM);
 
666
            else if(event->button == 3)
 
667
                if(misc2_callback_evaluate_job_application(
 
668
                       &g_array_index(jobs, Job, idx - 1), &current_user))
 
669
                {
 
670
                    stat0 = STATUS_MAIN;
 
671
                    game_gui_show_main();
 
672
                    setsav0;
 
673
                }
 
674
            break;
619
675
    }
620
676
 
621
677
    gui_set_arrows();
1151
1207
{
1152
1208
    window_main_save_geometry();
1153
1209
}
 
1210
 
 
1211
void
 
1212
on_menu_betting_activate               (GtkMenuItem     *menuitem,
 
1213
                                        gpointer         user_data)
 
1214
{
 
1215
    on_button_back_to_main_clicked(NULL, NULL);
 
1216
    window_show_bets();
 
1217
}
 
1218
 
 
1219
void
 
1220
on_menu_show_job_exchange_activate     (GtkMenuItem     *menuitem,
 
1221
                                        gpointer         user_data)
 
1222
{
 
1223
    stat0 = STATUS_SHOW_JOB_EXCHANGE;
 
1224
 
 
1225
    gui_set_arrows();
 
1226
 
 
1227
    treeview2_show_job_exchange();
 
1228
 
 
1229
    game_gui_print_message(
 
1230
        _("Right click to apply for job at once, left click to see team info."));
 
1231
    game_gui_print_message_with_delay(
 
1232
        _("The job exchange update interval is %d weeks."),
 
1233
        const_int("int_job_update_interval"));
 
1234
}
 
1235
 
 
1236
gboolean
 
1237
on_hpaned2_button_release_event        (GtkWidget       *widget,
 
1238
                                        GdkEventButton  *event,
 
1239
                                        gpointer         user_data)
 
1240
{
 
1241
    window.paned_pos = 
 
1242
        gtk_paned_get_position(GTK_PANED(widget));
 
1243
 
 
1244
    return FALSE;
 
1245
}