gnoemoe/dialogs/gm-scripts-dialog.c: added theme

gnoemoe/dialogs/gm-world-properties-dialog.c: added logging
gnoemoe/dialogs/gm-preferences-dialog.c: added userlist
This commit is contained in:
Jesse van den Kieboom 2006-04-07 16:28:12 +00:00
parent b230a75fce
commit 1170564bae
4 changed files with 248 additions and 71 deletions

View File

@ -1,3 +1,14 @@
2006-07-04 Jesse van den Kieboom <jesse@icecrew.nl>
* gnoemoe/dialogs/gm-scripts-dialog.c: added theme
* gnoemoe/dialogs/gm-world-properties-dialog.c: added logging
* gnoemoe/dialogs/gm-preferences-dialog.c: added userlist
2006-07-04 Jesse van den Kieboom <jesse@icecrew.nl>
* gnoemoe/widgets/gm-world-view.c: use gm_world_status
* gnoemoe/widgets/gm-world-input-view.c: fixed size after activate
* gnoemoe/widgets/gm-editor-view.c: custom style scheme
* gnoemoe/widgets/gm-app-view.c: fix ctrl cycle
2006-01-04 Jesse van den Kieboom <jesse@icecrew.nl>
* gnoemoe/dialogs/gm-open-world-dialog.c: close dialog on world
activation

View File

@ -20,6 +20,7 @@
#include "gm-app.h"
#include "gm-preferences-dialog.h"
#include "widgets/gm-editor-view.h"
#include "mcp/gm-mcp-userlist-view.h"
#include "gm-support.h"
#include "gm-debug.h"
#include "gm-options.h"
@ -46,15 +47,24 @@ gboolean on_gm_preferences_dialog_entry_alt_editor_focus_out(GtkEntry *entry,
void on_gm_preferences_dialog_check_button_logging_toggled(
GtkToggleButton *button, gpointer user_data);
void on_gm_preferences_dialog_check_button_logging_enable_toggled(
void on_gm_preferences_dialog_check_button_logging_disable_all_toggled(
GtkToggleButton *button, gpointer user_data);
void on_gm_preferences_dialog_combo_box_scheme_changed(GtkComboBox *box,
gpointer user_data);
void on_gm_preferences_dialog_color_set(GtkColorButton *button, gchar *option);
void on_gm_preferences_dialog_tree_view_editor_colors_row_changed(
GtkTreeSelection *selection, gpointer data);
void on_gm_preferences_dialog_check_button_show_object_number_toggled(
GtkToggleButton *button, gpointer user_data);
void on_gm_preferences_dialog_check_button_show_player_status_toggled(
GtkToggleButton *button, gpointer user_data);
void on_gm_preferences_dialog_check_button_use_state_icon_toggled(
GtkToggleButton *button, gpointer user_data);
void on_gm_preferences_dialog_radio_button_sort_toggled(GtkToggleButton *button,
gpointer user_data);
void on_gm_preferences_dialog_response(GtkDialog *dialog, gint response,
gpointer user_data);
@ -116,7 +126,7 @@ enum {
};
GtkWidget *
gm_preferences_dialog_widget(gchar *name) {
gm_preferences_dialog_widget(gchar const *name) {
return glade_xml_get_widget(preferences->xml, name);
}
@ -178,75 +188,84 @@ gm_preferences_dialog_update_color_buttons(gboolean signals) {
}
}
static gchar const *logging_button_names[] = {
"logging_in",
"logging_out",
"logging_status",
"logging_mcp_in",
"logging_mcp_out",
"logging_mcp_status",
"logging_add_timestamp",
"logging_add_log_type",
NULL
};
void
gm_preferences_dialog_init_logging() {
GtkWidget *check;
GmOptions *options = gm_app_options(gm_app_instance());
gchar const **entry;
gchar *name;
check = gm_preferences_dialog_widget("check_button_logging_enable");
check = gm_preferences_dialog_widget("check_button_logging_disable_all");
glade_xml_signal_connect(preferences->xml,
"on_check_button_logging_enable_toggled", G_CALLBACK(
on_gm_preferences_dialog_check_button_logging_enable_toggled));
"on_check_button_logging_disable_all_toggled", G_CALLBACK(
on_gm_preferences_dialog_check_button_logging_disable_all_toggled));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check),
gm_options_get_int(options, "logging_enable"));
!gm_options_get_int(options, "logging_enable"));
gtk_toggle_button_toggled(GTK_TOGGLE_BUTTON(check));
check = gm_preferences_dialog_widget("check_button_logging_in");
g_object_set_data_full(G_OBJECT(check), "option", g_strdup("in"), g_free);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check),
gm_options_get_int(options, "logging_in"));
glade_xml_signal_connect(preferences->xml,
"on_check_button_logging_in_toggled", G_CALLBACK(
on_gm_preferences_dialog_check_button_logging_toggled));
check = gm_preferences_dialog_widget("check_button_logging_out");
g_object_set_data_full(G_OBJECT(check), "option", g_strdup("out"), g_free);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check),
gm_options_get_int(options, "logging_out"));
glade_xml_signal_connect(preferences->xml,
"on_check_button_logging_out_toggled", G_CALLBACK(
on_gm_preferences_dialog_check_button_logging_toggled));
for (entry = logging_button_names; *entry; ++entry) {
name = g_strconcat("check_button_", *entry, NULL);
check = gm_preferences_dialog_widget(name);
g_free(name);
check = gm_preferences_dialog_widget("check_button_logging_status");
g_object_set_data_full(G_OBJECT(check), "option", g_strdup("status"),
g_free);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check),
gm_options_get_int(options, "logging_status"));
glade_xml_signal_connect(preferences->xml,
"on_check_button_logging_status_toggled", G_CALLBACK(
on_gm_preferences_dialog_check_button_logging_toggled));
g_object_set_data(G_OBJECT(check), "gm_logging_name",
(gpointer)*entry);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check),
gm_options_get_int(options, *entry));
check = gm_preferences_dialog_widget("check_button_logging_mcp_in");
g_object_set_data_full(G_OBJECT(check), "option", g_strdup("mcp_in"),
g_free);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check),
gm_options_get_int(options, "logging_mcp_in"));
glade_xml_signal_connect(preferences->xml,
"on_check_button_logging_mcp_in_toggled", G_CALLBACK(
on_gm_preferences_dialog_check_button_logging_toggled));
check = gm_preferences_dialog_widget("check_button_logging_mcp_out");
g_object_set_data_full(G_OBJECT(check), "option", g_strdup("mcp_out"),
g_free);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check),
gm_options_get_int(options, "logging_mcp_out"));
glade_xml_signal_connect(preferences->xml,
"on_check_button_logging_mcp_out_toggled", G_CALLBACK(
on_gm_preferences_dialog_check_button_logging_toggled));
check = gm_preferences_dialog_widget("check_button_logging_mcp_status");
g_object_set_data_full(G_OBJECT(check), "option", g_strdup("mcp_status"),
g_free);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check),
gm_options_get_int(options, "logging_mcp_status"));
glade_xml_signal_connect(preferences->xml,
"on_check_button_logging_mcp_status_toggled", G_CALLBACK(
on_gm_preferences_dialog_check_button_logging_toggled));
name = g_strconcat("on_check_button_", *entry, "_toggled", NULL);
glade_xml_signal_connect(preferences->xml, name, G_CALLBACK(
on_gm_preferences_dialog_check_button_logging_toggled));
g_free(name);
}
}
#define GM_PREFERENCES_DIALOG_XML \
PACKAGE_DATA_DIR "/" PACKAGE "/ui/gm-preferences.glade"
static gchar const *sort_button_names[] = {
"radio_button_state_rank_name",
"radio_button_rank_name",
"radio_button_state_name",
"radio_button_name",
NULL
};
static void
gm_preferences_dialog_init_sort_buttons() {
gint id = 0;
gchar const **name;
GtkWidget *widget;
gint sort_type = gm_options_get_int(gm_app_options(gm_app_instance()),
"userlist_sort_type");
for (name = sort_button_names; *name; ++name) {
widget = gm_preferences_dialog_widget(*name);
if (id == sort_type) {
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), TRUE);
}
g_object_set_data(G_OBJECT(widget), "gm_userlist_sort_id",
GINT_TO_POINTER(id));
++id;
}
}
void
gm_preferences_dialog_run() {
gchar const *alt_editor;
@ -312,6 +331,18 @@ gm_preferences_dialog_run() {
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(
gm_preferences_dialog_widget("check_button_auto_syntax")),
gm_options_get_int(options, "auto_check_syntax"));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(
gm_preferences_dialog_widget("check_button_show_object_number")),
gm_options_get_int(options, "userlist_show_object_number"));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(
gm_preferences_dialog_widget("check_button_show_player_status")),
gm_options_get_int(options, "userlist_show_status"));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(
gm_preferences_dialog_widget("check_button_use_state_icon")),
gm_options_get_int(options, "userlist_use_state_icon"));
gm_preferences_dialog_init_sort_buttons();
gtk_widget_set_sensitive(
gm_preferences_dialog_widget("entry_alt_editor"),
@ -347,7 +378,21 @@ gm_preferences_dialog_run() {
glade_xml_signal_connect(preferences->xml,
"on_combo_box_scheme_changed", G_CALLBACK(
on_gm_preferences_dialog_combo_box_scheme_changed));
glade_xml_signal_connect(preferences->xml,
"on_check_button_show_object_number_toggled", G_CALLBACK(
on_gm_preferences_dialog_check_button_show_object_number_toggled));
glade_xml_signal_connect(preferences->xml,
"on_check_button_show_player_status_toggled", G_CALLBACK(
on_gm_preferences_dialog_check_button_show_player_status_toggled));
glade_xml_signal_connect(preferences->xml,
"on_check_button_use_state_icon_toggled", G_CALLBACK(
on_gm_preferences_dialog_check_button_use_state_icon_toggled));
glade_xml_signal_connect(preferences->xml,
"on_radio_button_sort_toggled", G_CALLBACK(
on_gm_preferences_dialog_radio_button_sort_toggled));
gm_preferences_dialog_run_dialog();
}
@ -528,22 +573,65 @@ on_gm_preferences_dialog_combo_box_scheme_changed(GtkComboBox *box,
void
on_gm_preferences_dialog_check_button_logging_toggled(
GtkToggleButton *button, gpointer user_data) {
gchar *option = (gchar *)g_object_get_data(G_OBJECT(button), "option");
gchar *opt = g_strconcat("logging_", option, NULL);
gchar *option = (gchar *)g_object_get_data(G_OBJECT(button),
"gm_logging_name");
gboolean active = gtk_toggle_button_get_active(button);
gm_options_set_int(gm_app_options(gm_app_instance()), opt, active);
g_free(opt);
gm_options_set_int(gm_app_options(gm_app_instance()), option, active);
}
void
on_gm_preferences_dialog_check_button_logging_enable_toggled(
on_gm_preferences_dialog_check_button_logging_disable_all_toggled(
GtkToggleButton *button, gpointer user_data) {
gboolean active = gtk_toggle_button_get_active(button);
gm_options_set_int(gm_app_options(gm_app_instance()), "logging_enable",
active);
!active);
gtk_widget_set_sensitive(gm_preferences_dialog_widget("frame_log_types"),
active);
!active);
gtk_widget_set_sensitive(gm_preferences_dialog_widget("frame_log_format"),
!active);
}
void
on_gm_preferences_dialog_check_button_show_object_number_toggled(
GtkToggleButton *button, gpointer user_data) {
gboolean active = gtk_toggle_button_get_active(button);
gm_options_set_int(gm_app_options(gm_app_instance()),
"userlist_show_object_number", active);
}
void
on_gm_preferences_dialog_check_button_show_player_status_toggled(
GtkToggleButton *button, gpointer user_data) {
gboolean active = gtk_toggle_button_get_active(button);
gm_options_set_int(gm_app_options(gm_app_instance()),
"userlist_show_status", active);
}
void
on_gm_preferences_dialog_check_button_use_state_icon_toggled(
GtkToggleButton *button, gpointer user_data) {
gboolean active = gtk_toggle_button_get_active(button);
gm_options_set_int(gm_app_options(gm_app_instance()),
"userlist_use_state_icon", active);
}
void
on_gm_preferences_dialog_radio_button_sort_toggled(GtkToggleButton *button,
gpointer user_data) {
gboolean active = gtk_toggle_button_get_active(button);
gint id;
if (active) {
id = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(button),
"gm_userlist_sort_id"));
gm_options_set_int(gm_app_options(gm_app_instance()),
"userlist_sort_type", id);
}
}

View File

@ -336,9 +336,9 @@ gm_scripts_dialog_tree_add_script(GmScript *script) {
g_free(name);
if (script->type == GM_SCRIPT_TYPE_USER) {
name = g_strconcat(_("<b>User:</b> "), base, NULL);
name = g_strconcat("<b>", _("User"), ":</b> ", base, NULL);
} else {
name = g_strconcat(_("<b>Share:</b> "), base, NULL);
name = g_strconcat("<b>", _("Share"), ":</b> ", base, NULL);
}
g_free(base);
@ -500,7 +500,6 @@ gm_scripts_dialog_init_editor() {
GtkSourceLanguagesManager *lm = gtk_source_languages_manager_new();
GtkSourceLanguage *lang;
GtkWidget *view;
PangoFontDescription *f;
lang = gtk_source_languages_manager_get_language_from_mime_type(lm,
"application/x-ruby");
@ -517,10 +516,11 @@ gm_scripts_dialog_init_editor() {
gtk_source_buffer_set_language(
GTK_SOURCE_BUFFER(scripts_dialog->text_buffer_editor), lang);
}
g_object_unref(G_OBJECT(lm));
f = pango_font_description_from_string(gm_options_get(gm_app_options(
gm_app_instance()), "font-family"));
gtk_widget_modify_font(view, f);
gm_register_schemed(view, gm_app_color_table(gm_app_instance()),
GM_SCHEMED_FONT | GM_SCHEMED_COLORS);
gtk_source_view_set_insert_spaces_instead_of_tabs(GTK_SOURCE_VIEW(view),
FALSE);

View File

@ -117,6 +117,9 @@ void on_tree_view_triggers_row_activated(GtkTreeView *treeview,
void on_gm_world_properties_dialog_app_world_removed(GmApp *app, GmWorld *world,
GmWorldPropertiesDialog *properties);
void on_gm_world_properties_dialog_check_button_logging_override_toggled(
GtkToggleButton *button, GmWorldPropertiesDialog *properties);
void on_gm_world_properties_dialog_response(GtkDialog *dialog, gint response,
GmWorldPropertiesDialog *properties);
@ -267,6 +270,45 @@ gm_world_properties_dialog_find(GmWorld *world) {
return NULL;
}
static gchar const *logging_button_names[] = {
"logging_in",
"logging_out",
"logging_status",
"logging_mcp_in",
"logging_mcp_out",
"logging_mcp_status",
"logging_add_timestamp",
"logging_add_log_type",
NULL
};
void
gm_world_properties_dialog_init_logging(GmWorldPropertiesDialog *properties) {
GtkWidget *check;
gchar *name;
GmOptions *options = gm_world_options(properties->world);
gchar const **entry;
check = gm_world_properties_dialog_widget(properties,
"check_button_logging_override");
glade_xml_signal_connect_data(properties->xml,
"on_check_button_logging_override_toggled", G_CALLBACK(
on_gm_world_properties_dialog_check_button_logging_override_toggled
), properties);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check),
gm_options_get_int(options, "logging_override"));
gtk_toggle_button_toggled(GTK_TOGGLE_BUTTON(check));
for (entry = logging_button_names; *entry; ++entry) {
name = g_strconcat("check_button_", *entry, NULL);
check = gm_world_properties_dialog_widget(properties, name);
g_free(name);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check),
gm_options_get_int(options, *entry));
}
}
void
gm_world_properties_dialog_initialize(GmWorldPropertiesDialog *properties) {
GmOptions *options = gm_world_options(properties->world);
@ -297,6 +339,8 @@ gm_world_properties_dialog_initialize(GmWorldPropertiesDialog *properties) {
gm_world_properties_dialog_populate_charsets(properties);
gm_world_properties_dialog_populate_tree_view_triggers(properties);
gm_world_properties_dialog_init_logging(properties);
glade_xml_signal_connect_data(properties->xml,
"on_button_add_trigger_clicked",
G_CALLBACK(on_button_add_trigger_clicked), properties);
@ -464,6 +508,28 @@ gm_world_properties_dialog_set_triggers(GmWorldPropertiesDialog *properties) {
}
}
void
gm_world_properties_dialog_set_logging(GmWorldPropertiesDialog *properties) {
GmOptions *options = gm_world_options(properties->world);
gchar const **entry;
gchar *name;
GtkWidget *check;
check = gm_world_properties_dialog_widget(properties,
"check_button_logging_override");
gm_options_set_int(options, "logging_override",
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(check)));
for (entry = logging_button_names; *entry; ++entry) {
name = g_strconcat("check_button_", *entry, NULL);
check = gm_world_properties_dialog_widget(properties, name);
g_free(name);
gm_options_set_int(options, *entry, gtk_toggle_button_get_active(
GTK_TOGGLE_BUTTON(check)));
}
}
gboolean
gm_world_properties_dialog_check_values(GmWorldPropertiesDialog *properties) {
GmWorld *same_world;
@ -536,6 +602,7 @@ gm_world_properties_dialog_check_values(GmWorldPropertiesDialog *properties) {
}
gm_world_properties_dialog_set_triggers(properties);
gm_world_properties_dialog_set_logging(properties);
gm_options_set(options, "host", host);
gm_options_set_int(options, "port", gtk_spin_button_get_value_as_int(
@ -702,3 +769,14 @@ on_gm_world_properties_dialog_app_world_removed(GmApp *app, GmWorld *world,
gtk_dialog_response(GTK_DIALOG(properties->dialog), GTK_RESPONSE_CLOSE);
}
}
void
on_gm_world_properties_dialog_check_button_logging_override_toggled(
GtkToggleButton *button, GmWorldPropertiesDialog *properties) {
gboolean active = gtk_toggle_button_get_active(button);
gtk_widget_set_sensitive(gm_world_properties_dialog_widget(properties,
"frame_log_types"), active);
gtk_widget_set_sensitive(gm_world_properties_dialog_widget(properties,
"frame_log_format"), active);
}