Added logging options, made non modal
This commit is contained in:
parent
066069b9c8
commit
8ba90f148d
|
@ -27,19 +27,28 @@
|
||||||
|
|
||||||
void gm_preferences_dialog_run_dialog();
|
void gm_preferences_dialog_run_dialog();
|
||||||
|
|
||||||
|
void on_gm_preferences_font_set(GtkFontButton *button, gpointer user_data);
|
||||||
|
|
||||||
void on_gm_preferences_dialog_check_button_embed_editor_clicked(
|
void on_gm_preferences_dialog_check_button_embed_editor_clicked(
|
||||||
GtkButton *button, gpointer user_data);
|
GtkButton *button, gpointer user_data);
|
||||||
void on_gm_preferences_dialog_check_button_alt_editor_clicked(
|
void on_gm_preferences_dialog_check_button_alt_editor_clicked(
|
||||||
GtkButton *button, gpointer user_data);
|
GtkButton *button, gpointer user_data);
|
||||||
|
void on_gm_preferences_dialog_check_button_needs_terminal_clicked(
|
||||||
|
GtkButton *button, gpointer user_data);
|
||||||
|
void on_gm_preferences_dialog_check_button_auto_syntax_clicked(
|
||||||
|
GtkButton *button, gpointer user_data);
|
||||||
|
|
||||||
|
gboolean on_gm_preferences_dialog_entry_alt_editor_focus_out(GtkEntry *entry,
|
||||||
|
GdkEventFocus *event, gpointer user_data);
|
||||||
|
|
||||||
|
void on_gm_preferences_dialog_check_button_logging_toggled(
|
||||||
|
GtkToggleButton *button, gpointer user_data);
|
||||||
|
void on_gm_preferences_dialog_check_button_logging_enable_toggled(
|
||||||
|
GtkToggleButton *button, gpointer user_data);
|
||||||
|
|
||||||
void on_gm_preferences_dialog_combo_box_scheme_changed(GtkComboBox *box,
|
void on_gm_preferences_dialog_combo_box_scheme_changed(GtkComboBox *box,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
void on_gm_preferences_dialog_check_button_fg_clicked(
|
void on_gm_preferences_dialog_color_set(GtkColorButton *button, gchar *option);
|
||||||
GtkButton *button, gpointer user_data);
|
|
||||||
void on_gm_preferences_dialog_check_button_bg_clicked(
|
|
||||||
GtkButton *button, gpointer user_data);
|
|
||||||
void on_gm_preferences_dialog_toggle_button_style_clicked(
|
|
||||||
GtkButton *button, gpointer user_data);
|
|
||||||
|
|
||||||
void on_gm_preferences_dialog_tree_view_editor_colors_row_changed(
|
void on_gm_preferences_dialog_tree_view_editor_colors_row_changed(
|
||||||
GtkTreeSelection *selection, gpointer data);
|
GtkTreeSelection *selection, gpointer data);
|
||||||
|
@ -52,6 +61,7 @@ typedef struct _GmPreferencesDialog {
|
||||||
GladeXML *xml;
|
GladeXML *xml;
|
||||||
GtkWidget *dialog;
|
GtkWidget *dialog;
|
||||||
|
|
||||||
|
gint user_scheme_index;
|
||||||
} GmPreferencesDialog;
|
} GmPreferencesDialog;
|
||||||
|
|
||||||
static const GmKeyValuePair color_mapping[] = {
|
static const GmKeyValuePair color_mapping[] = {
|
||||||
|
@ -83,7 +93,8 @@ static const GmKeyValuePair color_mapping[] = {
|
||||||
{"color_button_bg_blue", "bg_blue"},
|
{"color_button_bg_blue", "bg_blue"},
|
||||||
{"color_button_bg_purple", "bg_purple"},
|
{"color_button_bg_purple", "bg_purple"},
|
||||||
{"color_button_bg_cyan", "bg_cyan"},
|
{"color_button_bg_cyan", "bg_cyan"},
|
||||||
{"color_button_bg_white", "bg_white"}
|
{"color_button_bg_white", "bg_white"},
|
||||||
|
{NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
static const GmKeyValuePair color_schemes[] = {
|
static const GmKeyValuePair color_schemes[] = {
|
||||||
|
@ -139,9 +150,97 @@ gm_preferences_dialog_init_combo_box_scheme() {
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
preferences->user_scheme_index = i - 1;
|
||||||
gtk_combo_box_set_active(box, select);
|
gtk_combo_box_set_active(box, select);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gm_preferences_dialog_update_color_buttons(gboolean signals) {
|
||||||
|
GmKeyValuePair const *pair;
|
||||||
|
GtkColorButton *but;
|
||||||
|
GdkColor col;
|
||||||
|
GmColorTable *color_table = gm_app_color_table(gm_app_instance());
|
||||||
|
|
||||||
|
for (pair = color_mapping; pair->key != NULL; ++pair) {
|
||||||
|
but = GTK_COLOR_BUTTON(gm_preferences_dialog_widget(pair->key));
|
||||||
|
|
||||||
|
gm_color_table_get(color_table, pair->value, &col);
|
||||||
|
gtk_color_button_set_color(but, &col);
|
||||||
|
|
||||||
|
if (signals) {
|
||||||
|
g_signal_connect(but, "color-set",
|
||||||
|
G_CALLBACK(on_gm_preferences_dialog_color_set),
|
||||||
|
pair->value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gm_preferences_dialog_init_logging() {
|
||||||
|
GtkWidget *check;
|
||||||
|
GmOptions *options = gm_app_options(gm_app_instance());
|
||||||
|
|
||||||
|
check = gm_preferences_dialog_widget("check_button_logging_enable");
|
||||||
|
glade_xml_signal_connect(preferences->xml,
|
||||||
|
"on_check_button_logging_enable_toggled", G_CALLBACK(
|
||||||
|
on_gm_preferences_dialog_check_button_logging_enable_toggled));
|
||||||
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check),
|
||||||
|
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));
|
||||||
|
|
||||||
|
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));
|
||||||
|
|
||||||
|
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));
|
||||||
|
}
|
||||||
|
|
||||||
#define GM_PREFERENCES_DIALOG_XML \
|
#define GM_PREFERENCES_DIALOG_XML \
|
||||||
PACKAGE_DATA_DIR "/" PACKAGE "/ui/gm-preferences.glade"
|
PACKAGE_DATA_DIR "/" PACKAGE "/ui/gm-preferences.glade"
|
||||||
|
|
||||||
|
@ -159,15 +258,16 @@ gm_preferences_dialog_run() {
|
||||||
|
|
||||||
preferences->xml = glade_xml_new(GM_PREFERENCES_DIALOG_XML,
|
preferences->xml = glade_xml_new(GM_PREFERENCES_DIALOG_XML,
|
||||||
"gm_preferences_dialog", NULL);
|
"gm_preferences_dialog", NULL);
|
||||||
preferences->dialog =
|
preferences->dialog = gm_preferences_dialog_widget("gm_preferences_dialog");
|
||||||
gm_preferences_dialog_widget("gm_preferences_dialog");
|
|
||||||
|
gm_preferences_dialog_update_color_buttons(TRUE);
|
||||||
gm_preferences_dialog_load_colors();
|
|
||||||
gm_preferences_dialog_init_combo_box_scheme();
|
gm_preferences_dialog_init_combo_box_scheme();
|
||||||
|
gm_preferences_dialog_init_logging();
|
||||||
|
|
||||||
gtk_font_button_set_font_name(GTK_FONT_BUTTON(
|
gtk_font_button_set_font_name(GTK_FONT_BUTTON(
|
||||||
gm_preferences_dialog_widget("font_button_font")),
|
gm_preferences_dialog_widget("font_button_font")),
|
||||||
gm_options_get(options, "font-family"));
|
gm_color_table_font_description(gm_app_color_table(
|
||||||
|
gm_app_instance())));
|
||||||
|
|
||||||
alt_editor = gm_options_get(options, "editor_alternative");
|
alt_editor = gm_options_get(options, "editor_alternative");
|
||||||
|
|
||||||
|
@ -188,6 +288,9 @@ gm_preferences_dialog_run() {
|
||||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(
|
||||||
gm_preferences_dialog_widget("check_button_needs_terminal")),
|
gm_preferences_dialog_widget("check_button_needs_terminal")),
|
||||||
gm_options_get_int(options, "editor_needs_terminal"));
|
gm_options_get_int(options, "editor_needs_terminal"));
|
||||||
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(
|
||||||
|
gm_preferences_dialog_widget("check_button_auto_syntax")),
|
||||||
|
gm_options_get_int(options, "auto_syntax_check"));
|
||||||
|
|
||||||
gtk_widget_set_sensitive(
|
gtk_widget_set_sensitive(
|
||||||
gm_preferences_dialog_widget("entry_alt_editor"),
|
gm_preferences_dialog_widget("entry_alt_editor"),
|
||||||
|
@ -200,12 +303,25 @@ gm_preferences_dialog_run() {
|
||||||
alt_editor != NULL
|
alt_editor != NULL
|
||||||
&& gm_options_get_int(options, "editor_embed") == 0);
|
&& gm_options_get_int(options, "editor_embed") == 0);
|
||||||
|
|
||||||
|
glade_xml_signal_connect(preferences->xml,
|
||||||
|
"on_font_button_font_font_set", G_CALLBACK(
|
||||||
|
on_gm_preferences_font_set));
|
||||||
|
|
||||||
|
glade_xml_signal_connect(preferences->xml,
|
||||||
|
"on_entry_alt_editor_focus_out", G_CALLBACK(
|
||||||
|
on_gm_preferences_dialog_entry_alt_editor_focus_out));
|
||||||
glade_xml_signal_connect(preferences->xml,
|
glade_xml_signal_connect(preferences->xml,
|
||||||
"on_check_button_alt_editor_clicked", G_CALLBACK(
|
"on_check_button_alt_editor_clicked", G_CALLBACK(
|
||||||
on_gm_preferences_dialog_check_button_alt_editor_clicked));
|
on_gm_preferences_dialog_check_button_alt_editor_clicked));
|
||||||
glade_xml_signal_connect(preferences->xml,
|
glade_xml_signal_connect(preferences->xml,
|
||||||
"on_check_button_embed_editor_clicked", G_CALLBACK(
|
"on_check_button_embed_editor_clicked", G_CALLBACK(
|
||||||
on_gm_preferences_dialog_check_button_embed_editor_clicked));
|
on_gm_preferences_dialog_check_button_embed_editor_clicked));
|
||||||
|
glade_xml_signal_connect(preferences->xml,
|
||||||
|
"on_check_button_needs_terminal_clicked", G_CALLBACK(
|
||||||
|
on_gm_preferences_dialog_check_button_needs_terminal_clicked));
|
||||||
|
glade_xml_signal_connect(preferences->xml,
|
||||||
|
"on_check_button_auto_syntax_clicked", G_CALLBACK(
|
||||||
|
on_gm_preferences_dialog_check_button_auto_syntax_clicked));
|
||||||
|
|
||||||
glade_xml_signal_connect(preferences->xml,
|
glade_xml_signal_connect(preferences->xml,
|
||||||
"on_combo_box_scheme_changed", G_CALLBACK(
|
"on_combo_box_scheme_changed", G_CALLBACK(
|
||||||
|
@ -214,82 +330,6 @@ gm_preferences_dialog_run() {
|
||||||
gm_preferences_dialog_run_dialog();
|
gm_preferences_dialog_run_dialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
gm_preferences_dialog_load_colors() {
|
|
||||||
int i;
|
|
||||||
GtkColorButton *but;
|
|
||||||
GdkColor col;
|
|
||||||
GmColorTable *color_table = gm_app_color_table(gm_app_instance());
|
|
||||||
|
|
||||||
for (i = 0; i < (int)(sizeof(color_mapping) / sizeof(GmKeyValuePair)); i++) {
|
|
||||||
but = GTK_COLOR_BUTTON(gm_preferences_dialog_widget(
|
|
||||||
color_mapping[i].key));
|
|
||||||
|
|
||||||
gm_color_table_get(color_table, color_mapping[i].value, &col);
|
|
||||||
gtk_color_button_set_color(but, &col);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
gm_preferences_dialog_save_colors() {
|
|
||||||
int i;
|
|
||||||
GtkColorButton *but;
|
|
||||||
GdkColor col;
|
|
||||||
GmColorTable *color_table = gm_app_color_table(gm_app_instance());
|
|
||||||
gchar *col_str;
|
|
||||||
|
|
||||||
for (i = 0; i < (int)(sizeof(color_mapping) / sizeof(GmKeyValuePair)); i++) {
|
|
||||||
but = GTK_COLOR_BUTTON(gm_preferences_dialog_widget(
|
|
||||||
color_mapping[i].key));
|
|
||||||
|
|
||||||
gtk_color_button_get_color(but, &col);
|
|
||||||
col_str = g_strdup_printf("#%04X%04X%04X", col.red, col.green,
|
|
||||||
col.blue);
|
|
||||||
|
|
||||||
gm_color_table_set(color_table, color_mapping[i].value, col_str);
|
|
||||||
g_free(col_str);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean
|
|
||||||
gm_preferences_dialog_check_values() {
|
|
||||||
const gchar *alt_editor = gtk_entry_get_text(GTK_ENTRY(
|
|
||||||
gm_preferences_dialog_widget("entry_alt_editor")));
|
|
||||||
const gchar *font_description = gtk_font_button_get_font_name(
|
|
||||||
GTK_FONT_BUTTON(gm_preferences_dialog_widget("font_button_font")));
|
|
||||||
gboolean use_alt_editor = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(
|
|
||||||
gm_preferences_dialog_widget("check_button_alt_editor")));
|
|
||||||
GmOptions *options = gm_app_options(gm_app_instance());
|
|
||||||
|
|
||||||
if (use_alt_editor && *alt_editor == '\0') {
|
|
||||||
gm_error_dialog(_("Editor can't be empty, enter a non empty command"),
|
|
||||||
GTK_WINDOW(preferences->dialog));
|
|
||||||
gm_notebook_focus_from_label(GTK_NOTEBOOK(gm_preferences_dialog_widget(
|
|
||||||
"notebook_preferences")), _("Editor"));
|
|
||||||
gtk_widget_grab_focus(gm_preferences_dialog_widget("entry_alt_editor"));
|
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (use_alt_editor) {
|
|
||||||
gm_options_set(options, "editor_alternative", alt_editor);
|
|
||||||
} else {
|
|
||||||
gm_options_set(options, "editor_alternative", "0");
|
|
||||||
}
|
|
||||||
|
|
||||||
gm_options_set_int(options, "editor_embed", gtk_toggle_button_get_active(
|
|
||||||
GTK_TOGGLE_BUTTON(gm_preferences_dialog_widget
|
|
||||||
("check_button_embed_editor"))));
|
|
||||||
gm_options_set_int(options, "editor_needs_terminal",
|
|
||||||
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(
|
|
||||||
gm_preferences_dialog_widget("check_button_needs_terminal"))));
|
|
||||||
|
|
||||||
gm_options_set(options, "font-family", font_description);
|
|
||||||
gm_preferences_dialog_save_colors();
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
gm_preferences_dialog_run_dialog() {
|
gm_preferences_dialog_run_dialog() {
|
||||||
g_signal_connect(preferences->dialog, "response",
|
g_signal_connect(preferences->dialog, "response",
|
||||||
|
@ -302,31 +342,22 @@ gm_preferences_dialog_run_dialog() {
|
||||||
|
|
||||||
void
|
void
|
||||||
on_gm_preferences_dialog_response(GtkDialog *dialog, gint response,
|
on_gm_preferences_dialog_response(GtkDialog *dialog, gint response,
|
||||||
gpointer user_data) {
|
gpointer user_data) {
|
||||||
gboolean is_okay = TRUE;
|
gm_options_save(gm_app_options(gm_app_instance()));
|
||||||
|
|
||||||
switch (response) {
|
|
||||||
case GTK_RESPONSE_OK: case GTK_RESPONSE_APPLY:
|
|
||||||
if (gm_preferences_dialog_check_values()) {
|
|
||||||
gm_options_save(gm_app_options(gm_app_instance()));
|
|
||||||
|
|
||||||
if (response == GTK_RESPONSE_APPLY) {
|
|
||||||
is_okay = FALSE;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
is_okay = FALSE;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_okay) {
|
gtk_widget_destroy(GTK_WIDGET(dialog));
|
||||||
gtk_widget_destroy(GTK_WIDGET(dialog));
|
g_object_unref(preferences->xml);
|
||||||
g_object_unref(preferences->xml);
|
|
||||||
g_free(preferences);
|
g_free(preferences);
|
||||||
preferences = NULL;
|
preferences = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
on_gm_preferences_font_set(GtkFontButton *button, gpointer user_data) {
|
||||||
|
gchar const *font = gtk_font_button_get_font_name(button);
|
||||||
|
|
||||||
|
gm_color_table_set_font_description(gm_app_color_table(gm_app_instance()),
|
||||||
|
font);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -365,6 +396,11 @@ on_gm_preferences_dialog_check_button_alt_editor_clicked(
|
||||||
FALSE);
|
FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!active) {
|
||||||
|
gm_options_set(gm_app_options(gm_app_instance()), "editor_alternative",
|
||||||
|
"0");
|
||||||
|
}
|
||||||
|
|
||||||
gtk_widget_set_sensitive(gm_preferences_dialog_widget(
|
gtk_widget_set_sensitive(gm_preferences_dialog_widget(
|
||||||
"entry_alt_editor"), active);
|
"entry_alt_editor"), active);
|
||||||
gtk_widget_set_sensitive(gm_preferences_dialog_widget(
|
gtk_widget_set_sensitive(gm_preferences_dialog_widget(
|
||||||
|
@ -373,6 +409,68 @@ on_gm_preferences_dialog_check_button_alt_editor_clicked(
|
||||||
"check_button_needs_terminal"), active);
|
"check_button_needs_terminal"), active);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
on_gm_preferences_dialog_check_button_needs_terminal_clicked(
|
||||||
|
GtkButton *button, gpointer user_data) {
|
||||||
|
gboolean active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button));
|
||||||
|
|
||||||
|
gm_options_set_int(gm_app_options(gm_app_instance()),
|
||||||
|
"editor_needs_terminal", active);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
on_gm_preferences_dialog_check_button_auto_syntax_clicked(
|
||||||
|
GtkButton *button, gpointer user_data) {
|
||||||
|
gboolean active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button));
|
||||||
|
|
||||||
|
gm_options_set_int(gm_app_options(gm_app_instance()),
|
||||||
|
"auto_check_syntax", active);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
on_gm_preferences_dialog_entry_alt_editor_focus_out(GtkEntry *entry,
|
||||||
|
GdkEventFocus *event, gpointer user_data) {
|
||||||
|
gchar const *alt_editor = gtk_entry_get_text(entry);
|
||||||
|
GmOptions *options = gm_app_options(gm_app_instance());
|
||||||
|
|
||||||
|
if (*alt_editor != '\0') {
|
||||||
|
gm_options_set(options, "editor_alternative", alt_editor);
|
||||||
|
} else {
|
||||||
|
gm_options_set(options, "editor_alternative", "0");
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
on_gm_preferences_dialog_color_set(GtkColorButton *button, gchar *option) {
|
||||||
|
GmColorTable *table = gm_app_color_table(gm_app_instance());
|
||||||
|
GdkColor col;
|
||||||
|
gchar *col_str;
|
||||||
|
GtkComboBox *box;
|
||||||
|
|
||||||
|
gtk_color_button_get_color(button, &col);
|
||||||
|
col_str = g_strdup_printf("#%04X%04X%04X", col.red, col.green, col.blue);
|
||||||
|
|
||||||
|
gm_color_table_set(table, option, col_str);
|
||||||
|
g_free(col_str);
|
||||||
|
|
||||||
|
box = GTK_COMBO_BOX(gm_preferences_dialog_widget(
|
||||||
|
"combo_box_scheme"));
|
||||||
|
g_signal_handlers_block_by_func(box,
|
||||||
|
on_gm_preferences_dialog_combo_box_scheme_changed, NULL);
|
||||||
|
|
||||||
|
// Select user combo item
|
||||||
|
if (gtk_combo_box_get_active(box) != preferences->user_scheme_index) {
|
||||||
|
gtk_combo_box_set_active(box, preferences->user_scheme_index);
|
||||||
|
gm_preferences_dialog_update_color_buttons(FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_signal_handlers_unblock_by_func(box,
|
||||||
|
on_gm_preferences_dialog_combo_box_scheme_changed, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
on_gm_preferences_dialog_combo_box_scheme_changed(GtkComboBox *box,
|
on_gm_preferences_dialog_combo_box_scheme_changed(GtkComboBox *box,
|
||||||
gpointer user_data) {
|
gpointer user_data) {
|
||||||
|
@ -383,7 +481,31 @@ on_gm_preferences_dialog_combo_box_scheme_changed(GtkComboBox *box,
|
||||||
|
|
||||||
gtk_combo_box_get_active_iter(box, &iter);
|
gtk_combo_box_get_active_iter(box, &iter);
|
||||||
gtk_tree_model_get(model, &iter, SCHEME_OPTION, &scheme, -1);
|
gtk_tree_model_get(model, &iter, SCHEME_OPTION, &scheme, -1);
|
||||||
|
|
||||||
gm_color_table_set_from_scheme_name(color_table, scheme);
|
gm_color_table_set_from_scheme_name(color_table, scheme);
|
||||||
|
|
||||||
|
gm_preferences_dialog_update_color_buttons(FALSE);
|
||||||
g_free(scheme);
|
g_free(scheme);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
gboolean active = gtk_toggle_button_get_active(button);
|
||||||
|
|
||||||
|
gm_options_set_int(gm_app_options(gm_app_instance()), opt, active);
|
||||||
|
g_free(opt);
|
||||||
|
}
|
||||||
|
|
||||||
|
void on_gm_preferences_dialog_check_button_logging_enable_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);
|
||||||
|
|
||||||
|
gtk_widget_set_sensitive(gm_preferences_dialog_widget("frame_log_types"),
|
||||||
|
active);
|
||||||
|
}
|
||||||
|
|
Reference in New Issue