2005-03-27 19:59:57 +02:00
|
|
|
#include "file.h"
|
2004-12-23 13:58:39 +01:00
|
|
|
#include "options_callbacks.h"
|
|
|
|
#include "options_interface.h"
|
2005-03-24 14:00:01 +01:00
|
|
|
#include "option_gui.h"
|
2004-12-23 13:58:39 +01:00
|
|
|
#include "support.h"
|
2005-04-04 12:36:04 +02:00
|
|
|
#include "user.h"
|
2005-03-23 20:03:26 +01:00
|
|
|
#include "variables.h"
|
|
|
|
#include "window.h"
|
2004-12-23 13:58:39 +01:00
|
|
|
|
|
|
|
void
|
2005-03-23 20:03:26 +01:00
|
|
|
on_button_options_ok_clicked (GtkButton *button,
|
2004-12-23 13:58:39 +01:00
|
|
|
gpointer user_data)
|
|
|
|
{
|
2005-04-04 12:36:04 +02:00
|
|
|
gboolean save_global =
|
|
|
|
gtk_toggle_button_get_active(
|
|
|
|
GTK_TOGGLE_BUTTON(lookup_widget(window.options, "checkbutton_save_global"))),
|
|
|
|
save_user =
|
|
|
|
gtk_toggle_button_get_active(
|
|
|
|
GTK_TOGGLE_BUTTON(lookup_widget(window.options, "checkbutton_save_user")));
|
|
|
|
const gchar *conf_dir = file_get_first_support_dir();
|
|
|
|
gchar buf[SMALL];
|
|
|
|
|
2005-03-24 14:00:01 +01:00
|
|
|
option_gui_write_options();
|
2004-12-23 13:58:39 +01:00
|
|
|
|
2005-04-04 12:36:04 +02:00
|
|
|
if(save_global)
|
|
|
|
{
|
|
|
|
sprintf(buf, "%s/bygfoot.conf", conf_dir);
|
|
|
|
file_save_opt_file(buf, &options);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(save_user)
|
|
|
|
{
|
|
|
|
if(strcmp(current_user.name->str, "NONAME") == 0)
|
|
|
|
sprintf(buf, "%s/bygfoot_user.conf", conf_dir);
|
|
|
|
else
|
|
|
|
sprintf(buf, "%s/bygfoot_%s.conf", conf_dir, current_user.name->str);
|
|
|
|
|
|
|
|
file_save_opt_file(buf, ¤t_user.options);
|
|
|
|
}
|
|
|
|
|
2005-03-24 14:00:01 +01:00
|
|
|
window_destroy(&window.options, TRUE);
|
2004-12-23 13:58:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
2005-03-23 20:03:26 +01:00
|
|
|
on_button_options_cancel_clicked (GtkButton *button,
|
2004-12-23 13:58:39 +01:00
|
|
|
gpointer user_data)
|
|
|
|
{
|
2005-03-23 20:03:26 +01:00
|
|
|
window_destroy(&window.options, TRUE);
|
2004-12-23 13:58:39 +01:00
|
|
|
}
|
|
|
|
|
2005-03-24 14:00:01 +01:00
|
|
|
|
|
|
|
void
|
|
|
|
on_button_font_name_clicked (GtkButton *button,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
window_create(WINDOW_FONT_SEL);
|
|
|
|
}
|
|
|
|
|
2005-03-27 19:59:57 +02:00
|
|
|
|
|
|
|
void
|
|
|
|
on_button_reload_constants_clicked (GtkButton *button,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
const gchar *constants_file =
|
|
|
|
gtk_entry_get_text(GTK_ENTRY(lookup_widget(window.options, "entry_constants_file")));
|
|
|
|
|
2005-04-04 12:36:04 +02:00
|
|
|
file_load_opt_file(constants_file, &constants);
|
2005-03-27 19:59:57 +02:00
|
|
|
}
|
|
|
|
|
2005-04-13 15:01:59 +02:00
|
|
|
|
|
|
|
gboolean
|
|
|
|
on_checkbutton_save_global_button_press_event
|
|
|
|
(GtkWidget *widget,
|
|
|
|
GdkEventButton *event,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
if(event->button == 3)
|
|
|
|
{
|
|
|
|
gchar *conf_file = file_find_support_file("bygfoot.conf", TRUE);
|
|
|
|
|
|
|
|
file_load_opt_file(conf_file, &options);
|
|
|
|
g_free(conf_file);
|
|
|
|
|
|
|
|
option_gui_set_up_window();
|
2005-06-23 23:53:57 +02:00
|
|
|
return TRUE;
|
2005-04-13 15:01:59 +02:00
|
|
|
}
|
|
|
|
|
2005-06-23 23:53:57 +02:00
|
|
|
return FALSE;
|
2005-04-13 15:01:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
on_checkbutton_save_user_button_press_event
|
|
|
|
(GtkWidget *widget,
|
|
|
|
GdkEventButton *event,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
|
|
|
|
if(event->button == 3)
|
|
|
|
{
|
|
|
|
file_load_user_conf_file(¤t_user);
|
|
|
|
option_gui_set_up_window();
|
2005-06-23 23:53:57 +02:00
|
|
|
return TRUE;
|
2005-04-13 15:01:59 +02:00
|
|
|
}
|
|
|
|
|
2005-06-23 23:53:57 +02:00
|
|
|
return FALSE;
|
2005-04-13 15:01:59 +02:00
|
|
|
}
|
|
|
|
|