2005-01-09 21:21:22 +01:00
# include "file.h"
2005-03-17 21:26:01 +01:00
# include "finance.h"
2005-01-09 21:21:22 +01:00
# include "free.h"
2005-03-03 13:46:48 +01:00
# include "game_gui.h"
2005-03-17 21:26:01 +01:00
# include "gui.h"
2004-12-30 17:48:19 +01:00
# include "interface.h"
2005-06-05 12:39:29 +02:00
# include "league.h"
# include "live_game.h"
2005-06-14 22:04:37 +02:00
# include "load_save.h"
2005-04-09 21:18:28 +02:00
# include "main.h"
2005-06-14 22:04:37 +02:00
# include "misc_callback_func.h"
2004-12-30 17:48:19 +01:00
# include "misc_interface.h"
2005-03-08 09:25:46 +01:00
# include "misc2_interface.h"
2005-03-03 13:46:48 +01:00
# include "option.h"
2005-03-23 20:03:26 +01:00
# include "option_gui.h"
# include "options_interface.h"
2004-12-30 17:48:19 +01:00
# include "support.h"
2005-05-07 16:19:52 +02:00
# include "treeview.h"
# include "treeview_helper.h"
2005-03-03 13:46:48 +01:00
# include "user.h"
2005-01-09 21:21:22 +01:00
# include "window.h"
2004-12-23 13:58:39 +01:00
2005-05-22 15:33:24 +02:00
/** Show the help/about window.
@ param page Which notebook page to display . */
void
window_show_help ( gint page )
{
gchar buf [ SMALL ] ;
gchar * help_file = file_find_support_file ( " bygfoot_help " , TRUE ) ;
OptionList help_list ;
if ( help_file = = NULL )
{
game_gui_show_warning ( " Didn't find file 'bygfoot_help'. " ) ;
return ;
}
help_list . list = NULL ;
help_list . datalist = NULL ;
file_load_opt_file ( help_file , & help_list ) ;
window_create ( WINDOW_HELP ) ;
2005-05-24 20:31:07 +02:00
sprintf ( buf , " <span %s>Bygfoot Football Manager %s</span> \n (c) 2005 Győző Both (gyboth@bygfoot.com) \n http://bygfoot.sourceforge.net " , const_app ( " string_help_window_program_name_attribute " ) , VERS ) ;
gtk_label_set_markup ( GTK_LABEL ( lookup_widget ( window . help , " label_about " ) ) , buf ) ;
2005-05-22 15:33:24 +02:00
treeview_show_contributors ( & help_list ) ;
2005-05-24 20:31:07 +02:00
game_gui_set_help_labels ( ) ;
2005-05-22 15:33:24 +02:00
gtk_notebook_set_current_page ( GTK_NOTEBOOK ( lookup_widget ( window . help , " notebook1 " ) ) , page ) ;
g_free ( help_file ) ;
free_option_list ( & help_list , FALSE ) ;
}
2004-12-23 13:58:39 +01:00
/**
Show the country selection window . All files with prefix
' country_ ' from $ HOME / . bygfoot / definitions are appended to a combo box .
*/
void
window_show_startup ( void )
{
GtkWidget * window_startup =
2004-12-30 17:48:19 +01:00
window_create ( WINDOW_STARTUP ) ;
2004-12-23 13:58:39 +01:00
GtkWidget * combo_country =
lookup_widget ( window_startup , " combo_country " ) ;
2005-04-09 21:18:28 +02:00
GPtrArray * country_files = NULL ;
2005-05-07 16:19:52 +02:00
GtkTreeModel * model = NULL ;
GtkCellRenderer * renderer = NULL ;
2004-12-23 13:58:39 +01:00
2005-04-09 21:18:28 +02:00
country_files = file_get_country_files ( ) ;
2004-12-23 13:58:39 +01:00
2005-04-09 21:18:28 +02:00
if ( country_files - > len = = 0 )
main_exit_program ( EXIT_NO_COUNTRY_FILES , " Didn't find any country definition files in the support directories. " ) ;
2004-12-23 13:58:39 +01:00
2005-05-07 16:19:52 +02:00
model = treeview_create_country_list ( country_files ) ;
gtk_combo_box_set_model ( GTK_COMBO_BOX ( combo_country ) , model ) ;
g_object_unref ( model ) ;
2004-12-23 13:58:39 +01:00
2005-05-07 16:19:52 +02:00
gtk_combo_box_entry_set_text_column ( GTK_COMBO_BOX_ENTRY ( combo_country ) , 1 ) ;
gtk_cell_layout_clear ( GTK_CELL_LAYOUT ( combo_country ) ) ;
renderer = gtk_cell_renderer_pixbuf_new ( ) ;
gtk_cell_layout_pack_start ( GTK_CELL_LAYOUT ( combo_country ) , renderer , FALSE ) ;
gtk_cell_layout_set_attributes ( GTK_CELL_LAYOUT ( combo_country ) , renderer , " pixbuf " , 0 , NULL ) ;
renderer = treeview_helper_cell_renderer_text_new ( ) ;
gtk_cell_layout_pack_start ( GTK_CELL_LAYOUT ( combo_country ) , renderer , TRUE ) ;
gtk_cell_layout_set_attributes ( GTK_CELL_LAYOUT ( combo_country ) , renderer , " text " , 1 , NULL ) ;
gtk_combo_box_set_active ( GTK_COMBO_BOX ( combo_country ) , 0 ) ;
2004-12-23 13:58:39 +01:00
2005-04-09 21:18:28 +02:00
free_g_string_array ( & country_files ) ;
2004-12-23 13:58:39 +01:00
}
2005-04-04 12:36:04 +02:00
/** Show the file selection window. */
void
window_show_file_sel ( void )
{
gchar buf [ SMALL ] ;
const gchar * home = g_get_home_dir ( ) ;
2005-06-14 22:04:37 +02:00
gchar * filename = NULL ;
2005-04-04 12:36:04 +02:00
2005-06-14 22:04:37 +02:00
window_create ( WINDOW_FILE_CHOOSER ) ;
if ( stat1 = = STATUS_SAVE_GAME )
gtk_file_chooser_set_action ( GTK_FILE_CHOOSER ( window . file_chooser ) ,
GTK_FILE_CHOOSER_ACTION_SAVE ) ;
else
gtk_file_chooser_set_action ( GTK_FILE_CHOOSER ( window . file_chooser ) ,
GTK_FILE_CHOOSER_ACTION_OPEN ) ;
2005-04-04 12:36:04 +02:00
if ( strlen ( save_file - > str ) > 0 )
2005-06-14 22:04:37 +02:00
gtk_file_chooser_set_filename ( GTK_FILE_CHOOSER ( window . file_chooser ) ,
save_file - > str ) ;
2005-04-04 12:36:04 +02:00
else
{
2005-06-14 22:04:37 +02:00
sprintf ( buf , " %s/%s/saves/. " , home , HOMEDIRNAME ) ;
gtk_file_chooser_set_filename ( GTK_FILE_CHOOSER ( window . file_chooser ) , buf ) ;
}
if ( gtk_dialog_run ( GTK_DIALOG ( window . file_chooser ) ) = = GTK_RESPONSE_OK )
{
filename = gtk_file_chooser_get_filename ( GTK_FILE_CHOOSER ( window . file_chooser ) ) ;
if ( stat1 = = STATUS_LOAD_GAME )
load_save_load_game ( filename ) ;
else if ( stat1 = = STATUS_LOAD_GAME_TEAM_SELECTION )
misc_callback_startup_load ( filename ) ;
else if ( stat1 = = STATUS_SAVE_GAME )
load_save_save_game ( filename ) ;
g_free ( filename ) ;
2005-04-04 12:36:04 +02:00
}
2005-06-14 22:04:37 +02:00
window_destroy ( & window . file_chooser , FALSE ) ;
2005-04-04 12:36:04 +02:00
}
2005-03-23 20:03:26 +01:00
/** Show the options window. */
void
window_show_options ( void )
{
window_create ( WINDOW_OPTIONS ) ;
option_gui_set_up_window ( ) ;
}
2005-03-27 19:59:57 +02:00
/** Show the player list context menu, triggered by 'event'. */
void
window_show_menu_player ( GdkEvent * event )
{
if ( window . menu_player ! = NULL )
window_destroy ( & window . menu_player , FALSE ) ;
window . menu_player = create_menu_player ( ) ;
gtk_menu_popup ( GTK_MENU ( window . menu_player ) , NULL , NULL , NULL , NULL ,
( ( GdkEventButton * ) event ) - > button , gdk_event_get_time ( event ) ) ;
}
2005-03-17 21:26:01 +01:00
/** Show the digits window with the labels and values set
according to the arguments . */
void
2005-05-30 17:54:20 +02:00
window_show_digits ( const gchar * text_main , const gchar * text1 , gint value1 ,
const gchar * text2 , gint value2 )
2005-03-17 21:26:01 +01:00
{
GtkLabel * label_main , * label_1 , * label_2 ;
GtkSpinButton * spinbutton1 , * spinbutton2 ;
window_create ( WINDOW_DIGITS ) ;
label_main = GTK_LABEL ( lookup_widget ( window . digits , " label_main " ) ) ;
label_1 = GTK_LABEL ( lookup_widget ( window . digits , " label_1 " ) ) ;
label_2 = GTK_LABEL ( lookup_widget ( window . digits , " label_2 " ) ) ;
spinbutton1 = GTK_SPIN_BUTTON ( lookup_widget ( window . digits , " spinbutton1 " ) ) ;
spinbutton2 = GTK_SPIN_BUTTON ( lookup_widget ( window . digits , " spinbutton2 " ) ) ;
if ( stat0 = = STATUS_GET_LOAN | |
stat0 = = STATUS_PAY_LOAN )
gtk_spin_button_set_range ( spinbutton1 , ( gdouble ) 1 , ( gdouble ) value1 ) ;
gtk_spin_button_set_value ( spinbutton1 , ( gdouble ) value1 ) ;
gtk_spin_button_set_value ( spinbutton2 , ( gdouble ) value2 ) ;
gtk_label_set_text ( label_main , text_main ) ;
if ( text1 ! = NULL )
gtk_label_set_text ( label_1 , text1 ) ;
else
gtk_widget_hide ( GTK_WIDGET ( label_1 ) - > parent ) ;
if ( text2 ! = NULL )
gtk_label_set_text ( label_2 , text2 ) ;
else
gtk_widget_hide ( GTK_WIDGET ( label_2 ) - > parent ) ;
}
/** Show the stadium window for the current user. */
void
window_show_stadium ( void )
{
gchar buf [ SMALL ] ;
2005-03-18 23:03:23 +01:00
const Team * tm = current_user . tm ;
2005-03-17 21:26:01 +01:00
GtkLabel * label_capacity ,
2005-04-07 18:44:33 +02:00
* label_stadium_status , * label_average_attendance ;
GtkProgressBar * progressbar_safety ,
* progressbar_average_attendance ;
gfloat average_attendance_perc = 0 ;
2005-03-17 21:26:01 +01:00
window_create ( WINDOW_STADIUM ) ;
label_capacity = GTK_LABEL ( lookup_widget ( window . stadium , " label_capacity " ) ) ;
label_stadium_status = GTK_LABEL ( lookup_widget ( window . stadium , " label_stadium_status " ) ) ;
2005-04-07 18:44:33 +02:00
label_average_attendance = GTK_LABEL ( lookup_widget ( window . stadium , " label_average_attendance " ) ) ;
2005-03-17 21:26:01 +01:00
progressbar_safety = GTK_PROGRESS_BAR ( lookup_widget ( window . stadium , " progressbar_safety " ) ) ;
2005-04-07 18:44:33 +02:00
progressbar_average_attendance = GTK_PROGRESS_BAR ( lookup_widget ( window . stadium , " progressbar_average_attendance " ) ) ;
2005-03-17 21:26:01 +01:00
gui_label_set_text_from_int ( label_capacity , tm - > stadium . capacity , FALSE ) ;
2005-04-07 18:44:33 +02:00
gui_label_set_text_from_int ( label_average_attendance , tm - > stadium . average_attendance , FALSE ) ;
2005-03-17 21:26:01 +01:00
2005-04-07 18:44:33 +02:00
if ( tm - > stadium . games > 0 )
average_attendance_perc =
( gfloat ) ( tm - > stadium . average_attendance * tm - > stadium . games ) /
( gfloat ) tm - > stadium . possible_attendance ;
2005-03-17 21:26:01 +01:00
gtk_progress_bar_set_fraction ( progressbar_safety , tm - > stadium . safety ) ;
2005-04-07 18:44:33 +02:00
gtk_progress_bar_set_fraction ( progressbar_average_attendance , average_attendance_perc ) ;
2005-03-17 21:26:01 +01:00
sprintf ( buf , " %d%% " , ( gint ) rint ( tm - > stadium . safety * 100 ) ) ;
gtk_progress_bar_set_text ( progressbar_safety , buf ) ;
2005-04-07 18:44:33 +02:00
sprintf ( buf , " %d%% " , ( gint ) rint ( average_attendance_perc * 100 ) ) ;
gtk_progress_bar_set_text ( progressbar_average_attendance , buf ) ;
2005-03-18 23:03:23 +01:00
if ( current_user . counters [ COUNT_USER_STADIUM_CAPACITY ] +
current_user . counters [ COUNT_USER_STADIUM_SAFETY ] ! = 0 )
2005-03-17 21:26:01 +01:00
{
sprintf ( buf , _ ( " Improvement in progress. \n %d seats and %d%% safety still to be done. \n Expected finish: %d weeks. " ) ,
2005-03-18 23:03:23 +01:00
current_user . counters [ COUNT_USER_STADIUM_CAPACITY ] ,
current_user . counters [ COUNT_USER_STADIUM_SAFETY ] ,
2005-03-17 21:26:01 +01:00
MAX ( finance_get_stadium_improvement_duration (
2005-03-18 23:03:23 +01:00
( gfloat ) current_user . counters [ COUNT_USER_STADIUM_CAPACITY ] , TRUE ) ,
2005-03-17 21:26:01 +01:00
finance_get_stadium_improvement_duration (
2005-03-18 23:03:23 +01:00
( gfloat ) current_user . counters [ COUNT_USER_STADIUM_SAFETY ] / 100 , FALSE ) ) ) ;
2005-03-17 21:26:01 +01:00
gtk_label_set_text ( label_stadium_status , buf ) ;
}
else
gtk_label_set_text ( label_stadium_status , _ ( " No improvements currently in progress. " ) ) ;
}
2005-03-27 19:59:57 +02:00
gboolean
window_show ( gpointer window )
{
gtk_widget_show ( ( GtkWidget * ) window ) ;
return FALSE ;
}
2005-03-20 21:49:55 +01:00
/** Show the window where the user can select between yes and no.
2005-05-30 17:54:20 +02:00
@ param text The text shown in the window . */
2005-03-20 21:49:55 +01:00
void
2005-05-30 17:54:20 +02:00
window_show_yesno ( const gchar * text )
2005-03-20 21:49:55 +01:00
{
window_create ( WINDOW_YESNO ) ;
gtk_label_set_text ( GTK_LABEL ( lookup_widget ( window . yesno , " label_yesno " ) ) , text ) ;
}
2005-05-30 17:54:20 +02:00
/** Show the transfer dialog (yes/no/later).
@ param text The text to put into the label . */
void
window_show_transfer_dialog ( const gchar * text )
{
window_create ( WINDOW_TRANSFER_DIALOG ) ;
gtk_label_set_text ( GTK_LABEL ( lookup_widget ( window . transfer_dialog , " label_transfer_dialog " ) ) , text ) ;
}
2005-05-28 16:34:14 +02:00
/** Set the spinbuttons in the live window
to the correct values . */
void
window_live_set_spinbuttons ( void )
{
gtk_spin_button_set_value (
GTK_SPIN_BUTTON ( lookup_widget ( window . live , " spinbutton_speed " ) ) ,
( gfloat ) option_int ( " int_opt_user_live_game_speed " , & usr ( stat2 ) . options ) ) ;
gtk_spin_button_set_value (
GTK_SPIN_BUTTON ( lookup_widget ( window . live , " spinbutton_verbosity " ) ) ,
( gfloat ) option_int ( " int_opt_user_live_game_verbosity " , & usr ( stat2 ) . options ) ) ;
}
2004-12-30 17:48:19 +01:00
/** Create and show a window. Which one depends on the argument.
@ param window_type An integer telling us which window to
create .
2005-03-08 09:25:46 +01:00
@ param count_popups Whether this window adds to the popup
counter that determines when the main window gets ( in ) sensitive .
2004-12-30 17:48:19 +01:00
@ return The pointer to the new window .
@ see # Windows */
GtkWidget *
window_create ( gint window_type )
{
2005-03-08 09:25:46 +01:00
gint old_popups_active = popups_active ;
2005-03-10 21:59:39 +01:00
gchar buf [ SMALL ] ;
2005-03-03 13:46:48 +01:00
GtkWidget * wind = NULL ;
2005-01-09 21:21:22 +01:00
2005-03-10 21:59:39 +01:00
sprintf ( buf , " Bygfoot Football Manager %s " , VERS ) ;
2004-12-30 17:48:19 +01:00
switch ( window_type )
{
default :
2005-03-08 09:25:46 +01:00
g_warning ( " window_create: unknown window type %d \n " , window_type ) ;
break ;
case WINDOW_MAIN :
2005-03-03 13:46:48 +01:00
if ( window . main = = NULL )
2005-01-09 21:21:22 +01:00
{
2005-03-03 13:46:48 +01:00
window . main = create_main_window ( ) ;
wind = window . main ;
2005-06-15 10:58:26 +02:00
sprintf ( buf , _ ( " Welcome to Bygfoot %s " ) , VERS ) ;
2005-06-14 17:27:44 +02:00
game_gui_print_message ( buf ) ;
2005-06-15 10:58:26 +02:00
sprintf ( buf , " Bygfoot Football Manager %s " , VERS ) ;
2005-01-09 21:21:22 +01:00
}
else
2005-03-03 13:46:48 +01:00
wind = window . main ;
2005-03-24 19:04:31 +01:00
if ( opt_int ( " int_opt_maximize_main_window " ) )
gtk_window_maximize ( GTK_WINDOW ( wind ) ) ;
2004-12-30 17:48:19 +01:00
break ;
case WINDOW_STARTUP :
2005-03-03 13:46:48 +01:00
if ( window . startup ! = NULL )
g_warning ( " window_create: called on already existing window \n " ) ;
else
2005-03-08 09:25:46 +01:00
{
popups_active + + ;
2005-03-03 13:46:48 +01:00
window . startup = create_window_startup ( ) ;
2005-03-08 09:25:46 +01:00
}
2005-03-03 13:46:48 +01:00
wind = window . startup ;
2004-12-30 17:48:19 +01:00
break ;
2005-01-09 21:21:22 +01:00
case WINDOW_LIVE :
2005-03-03 13:46:48 +01:00
if ( window . live ! = NULL )
g_warning ( " window_create: called on already existing window \n " ) ;
else
2005-03-08 09:25:46 +01:00
{
popups_active + + ;
2005-03-03 13:46:48 +01:00
window . live = create_window_live ( ) ;
2005-03-08 09:25:46 +01:00
}
2005-06-05 12:39:29 +02:00
strcpy ( buf , league_cup_get_name_string ( ( ( LiveGame * ) statp ) - > fix - > clid ) ) ;
2005-03-03 13:46:48 +01:00
wind = window . live ;
2005-05-28 16:34:14 +02:00
window_live_set_spinbuttons ( ) ;
2005-03-03 13:46:48 +01:00
break ;
2005-03-08 09:25:46 +01:00
case WINDOW_WARNING :
if ( window . warning ! = NULL )
g_warning ( " window_create: called on already existing window \n " ) ;
else
window . warning = create_window_warning ( ) ;
wind = window . warning ;
2005-03-10 21:59:39 +01:00
strcpy ( buf , " Erm... " ) ;
break ;
case WINDOW_PROGRESS :
if ( window . progress ! = NULL )
g_warning ( " window_create: called on already existing window \n " ) ;
else
window . progress = create_window_progress ( ) ;
wind = window . progress ;
strcpy ( buf , " " ) ;
2005-03-08 09:25:46 +01:00
break ;
2005-03-17 21:26:01 +01:00
case WINDOW_DIGITS :
if ( window . digits ! = NULL )
g_warning ( " window_create: called on already existing window \n " ) ;
else
{
popups_active + + ;
window . digits = create_window_digits ( ) ;
}
wind = window . digits ;
strcpy ( buf , _ ( " Numbers... " ) ) ;
break ;
case WINDOW_STADIUM :
if ( window . stadium ! = NULL )
g_warning ( " window_create: called on already existing window \n " ) ;
else
{
popups_active + + ;
window . stadium = create_window_stadium ( ) ;
}
wind = window . stadium ;
strcpy ( buf , _ ( " Your stadium " ) ) ;
break ;
2005-03-18 23:03:23 +01:00
case WINDOW_JOB_OFFER :
if ( window . job_offer ! = NULL )
g_warning ( " window_create: called on already existing window \n " ) ;
else
{
popups_active + + ;
window . job_offer = create_window_job_offer ( ) ;
}
wind = window . job_offer ;
strcpy ( buf , _ ( " Job offer " ) ) ;
break ;
2005-03-20 21:49:55 +01:00
case WINDOW_YESNO :
if ( window . yesno ! = NULL )
g_warning ( " window_create: called on already existing window \n " ) ;
else
{
popups_active + + ;
window . yesno = create_window_yesno ( ) ;
}
wind = window . yesno ;
strcpy ( buf , " ??? " ) ;
break ;
2005-03-23 20:03:26 +01:00
case WINDOW_OPTIONS :
if ( window . options ! = NULL )
g_warning ( " window_create: called on already existing window \n " ) ;
else
{
popups_active + + ;
window . options = create_window_options ( ) ;
}
wind = window . options ;
strcpy ( buf , " Options " ) ;
break ;
2005-03-24 14:00:01 +01:00
case WINDOW_FONT_SEL :
if ( window . font_sel ! = NULL )
g_warning ( " window_create: called on already existing window \n " ) ;
else
window . font_sel = create_window_font_sel ( ) ;
wind = window . font_sel ;
strcpy ( buf , " Select font " ) ;
break ;
2005-06-14 22:04:37 +02:00
case WINDOW_FILE_CHOOSER :
if ( window . file_chooser ! = NULL )
2005-04-04 12:36:04 +02:00
g_warning ( " window_create: called on already existing window \n " ) ;
else
2005-06-14 22:04:37 +02:00
window . file_chooser = create_window_file_chooser ( ) ;
wind = window . file_chooser ;
2005-04-04 12:36:04 +02:00
break ;
2005-03-25 11:54:54 +01:00
case WINDOW_CONTRACT :
if ( window . contract ! = NULL )
g_warning ( " window_create: called on already existing window \n " ) ;
else
window . contract = create_window_contract ( ) ;
wind = window . contract ;
strcpy ( buf , " Contract offer " ) ;
break ;
2005-03-27 19:59:57 +02:00
case WINDOW_USER_MANAGEMENT :
if ( window . user_management ! = NULL )
g_warning ( " window_create: called on already existing window \n " ) ;
else
window . user_management = create_window_user_management ( ) ;
wind = window . user_management ;
strcpy ( buf , " User management " ) ;
break ;
2005-05-13 20:20:47 +02:00
case WINDOW_DEBUG :
if ( window . wdebug ! = NULL )
g_warning ( " window_create: called on already existing window \n " ) ;
else
window . wdebug = create_window_debug ( ) ;
wind = window . wdebug ;
strcpy ( buf , " Bygfoot debug window " ) ;
break ;
2005-05-22 15:33:24 +02:00
case WINDOW_HELP :
if ( window . help ! = NULL )
g_warning ( " window_create: called on already existing window \n " ) ;
else
window . help = create_window_help ( ) ;
wind = window . help ;
break ;
2005-05-30 17:54:20 +02:00
case WINDOW_TRANSFER_DIALOG :
if ( window . transfer_dialog ! = NULL )
g_warning ( " window_create: called on already existing window \n " ) ;
else
window . transfer_dialog = create_window_transfer_dialog ( ) ;
wind = window . transfer_dialog ;
strcpy ( buf , " Transfer offer " ) ;
break ;
2005-03-03 13:46:48 +01:00
}
2004-12-30 17:48:19 +01:00
2005-06-14 22:04:37 +02:00
if ( window_type ! = WINDOW_FILE_CHOOSER )
gtk_window_set_title ( GTK_WINDOW ( wind ) , buf ) ;
2005-04-13 15:01:59 +02:00
if ( window_type ! = WINDOW_PROGRESS )
g_timeout_add ( 20 , ( GSourceFunc ) window_show , ( gpointer ) wind ) ;
else
gtk_widget_show ( wind ) ;
2004-12-30 17:48:19 +01:00
2005-03-11 18:18:51 +01:00
if ( popups_active ! = old_popups_active & &
window . main ! = NULL )
2005-03-03 13:46:48 +01:00
gtk_widget_set_sensitive ( window . main , FALSE ) ;
2005-01-09 21:21:22 +01:00
2005-03-03 13:46:48 +01:00
return wind ;
2004-12-30 17:48:19 +01:00
}
2005-01-09 21:21:22 +01:00
/** Destroy a window widget and set the popups and
main window sensitivity correctly .
2005-03-08 09:25:46 +01:00
@ param window The window we destroy .
@ param count_popups Whether this window adds to the popup
counter that determines when the main window gets ( in ) sensitive . */
2005-01-09 21:21:22 +01:00
void
2005-03-08 09:25:46 +01:00
window_destroy ( GtkWidget * * wind , gboolean count_popups )
2005-01-09 21:21:22 +01:00
{
2005-03-03 13:46:48 +01:00
if ( * wind = = NULL )
2005-01-09 21:21:22 +01:00
return ;
2005-03-08 09:25:46 +01:00
if ( * wind ! = window . main & & count_popups )
2005-01-09 21:21:22 +01:00
{
popups_active - - ;
2005-03-03 13:46:48 +01:00
if ( popups_active = = 0 & & window . main ! = NULL )
gtk_widget_set_sensitive ( window . main , TRUE ) ;
2005-01-09 21:21:22 +01:00
}
2005-03-03 13:46:48 +01:00
gtk_widget_destroy ( * wind ) ;
2005-01-09 21:21:22 +01:00
2005-03-03 13:46:48 +01:00
* wind = NULL ;
2005-01-09 21:21:22 +01:00
}