Added updating options when color information changes in the color table

This commit is contained in:
Jesse van den Kieboom 2005-10-11 09:44:39 +00:00
parent 803f214b1a
commit d70252b1e3
1 changed files with 35 additions and 4 deletions

View File

@ -7,7 +7,7 @@
#include <libgnomevfs/gnome-vfs.h>
#include <libgnomeui/libgnomeui.h>
#include "gm-app-view.h"
#include "widgets/gm-app-view.h"
#include "gm-world.h"
#include "gm-color-table.h"
@ -31,7 +31,13 @@ static GmApp *application;
//gboolean on_gm_app_tray_destroy(GtkWidget *widget, gpointer user_data);
void on_gm_app_view_size_allocate(GmAppView *view, GtkAllocation *allocation,
GmApp *app);
void on_gm_app_color_table_color_changed(GmColorTable *color_table,
const gchar *color, GmApp *app);
void on_gm_app_color_table_bold_toggled(GmColorTable *color_table,
gboolean bold, GmApp *app);
void on_gm_app_color_table_font_changed(GmColorTable *color_table,
const gchar *font, GmApp *app);
struct poptOption poptions[] = {
{
"debug",
@ -277,7 +283,6 @@ gm_app_create_settings(GmApp *app) {
gm_options_set(app->priv->options, "editor_alternative", "0");
gm_options_set(app->priv->options, "editor_embed", "0");
gm_options_set(app->priv->options, "editor_needs_terminal", "0");
gm_options_set(app->priv->options, "font-family", "Monospace 8");
gm_options_set(app->priv->options, "worlds_saved_state", "");
gm_options_set(app->priv->options, "search_direction", "1");
}
@ -336,11 +341,19 @@ gm_app_initialize(GmApp *app) {
app->priv->scripts = gm_scripts_new();
#endif
/* Create the main view */
gm_app_create_settings(app);
gm_options_load(app->priv->options, app->priv->options_path);
// Load color table
app->priv->color_table =
gm_color_table_new_from_options(app->priv->options);
// Add color table signals
g_signal_connect(app->priv->color_table, "color_changed",
G_CALLBACK(on_gm_app_color_table_color_changed), app);
g_signal_connect(app->priv->color_table, "font_changed",
G_CALLBACK(on_gm_app_color_table_font_changed), app);
g_signal_connect(app->priv->color_table, "bold_toggled",
G_CALLBACK(on_gm_app_color_table_bold_toggled), app);
}
void
@ -546,6 +559,24 @@ on_gm_app_view_size_allocate(GmAppView *view, GtkAllocation *allocation,
gm_options_set_int(app->priv->options, "height", allocation->height);
}
void
on_gm_app_color_table_color_changed(GmColorTable *color_table,
const gchar *color, GmApp *app) {
gm_options_set(app->priv->options, color,
gm_color_table_get_hex(color_table, color));
}
void
on_gm_app_color_table_bold_toggled(GmColorTable *color_table,
gboolean bold, GmApp *app) {
gm_options_set_int(app->priv->options, "bold-colors", bold);
}
void on_gm_app_color_table_font_changed(GmColorTable *color_table,
const gchar *font, GmApp *app) {
gm_options_set(app->priv->options, "font-family", font);
}
/*gboolean
on_gm_app_tray_button_press(GtkWidget *widget, GdkEventButton *event,
gpointer user_data) {