Added missing shortcut for "Close".
Added option in the preferences dialog to replace tabs by spaces when saving a file. Added option for default encoding for new files. git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@470 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
parent
e6caa033eb
commit
f375a6be68
10
ChangeLog
10
ChangeLog
@ -1,3 +1,13 @@
|
||||
2006-06-21 Enrico Troeger <enrico.troeger@uvena.de>
|
||||
|
||||
* src/keybindings.c: Added missing shortcut for "Close".
|
||||
* geany.glade, src/interface.c, src/prefs.c, src/keyfile.c,
|
||||
src/document.c, src/dialogs.c, src/encodings.h:
|
||||
Added option in the preferences dialog to replace tabs by spaces
|
||||
when saving a file.
|
||||
Added option for default encoding for new files.
|
||||
|
||||
|
||||
2006-06-20 Nick Treleaven <nick.treleaven@btinternet.com>
|
||||
|
||||
* src/utils.c, src/utils.h, src/callbacks.c, src/document.c,
|
||||
|
83
geany.glade
83
geany.glade
@ -3136,14 +3136,66 @@
|
||||
<widget class="GtkVBox" id="vbox8">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
<property name="spacing">3</property>
|
||||
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<widget class="GtkHBox" id="hbox4">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">12</property>
|
||||
|
||||
<child>
|
||||
<placeholder/>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label153">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Default encoding:</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||
<property name="width_chars">-1</property>
|
||||
<property name="single_line_mode">False</property>
|
||||
<property name="angle">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkEventBox" id="eventbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="tooltip" translatable="yes">Sets the default encoding for newly created files.</property>
|
||||
<property name="visible_window">True</property>
|
||||
<property name="above_child">False</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkComboBox" id="combo_encoding">
|
||||
<property name="visible">True</property>
|
||||
<property name="add_tearoffs">False</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
@ -3208,7 +3260,7 @@
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
@ -3309,6 +3361,25 @@
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="check_replace_tabs">
|
||||
<property name="visible">True</property>
|
||||
<property name="tooltip" translatable="yes">Replaces all tabs in document by spaces.</property>
|
||||
<property name="label" translatable="yes">Replace tabs by space</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">False</property>
|
||||
<property name="active">False</property>
|
||||
<property name="inconsistent">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
|
@ -46,6 +46,7 @@
|
||||
#include "utils.h"
|
||||
#include "prefs.h"
|
||||
#include "keybindings.h"
|
||||
#include "encodings.h"
|
||||
|
||||
|
||||
|
||||
@ -1647,10 +1648,23 @@ void dialogs_show_prefs_dialog(void)
|
||||
GtkTooltips *tooltips;
|
||||
GtkObject *spin_scrollback_adj;
|
||||
#endif
|
||||
GtkWidget *combo;
|
||||
guint i;
|
||||
gchar *encoding_string;
|
||||
|
||||
app->prefs_dialog = create_prefs_dialog();
|
||||
gtk_window_set_transient_for(GTK_WINDOW(app->prefs_dialog), GTK_WINDOW(app->window));
|
||||
|
||||
// init the default file encoding combo box
|
||||
combo = lookup_widget(app->prefs_dialog, "combo_encoding");
|
||||
gtk_combo_box_set_wrap_width(GTK_COMBO_BOX(combo), 3);
|
||||
for (i = 0; i < GEANY_ENCODINGS_MAX; i++)
|
||||
{
|
||||
encoding_string = encodings_to_string(&encodings[i]);
|
||||
gtk_combo_box_append_text(GTK_COMBO_BOX(combo), encoding_string);
|
||||
g_free(encoding_string);
|
||||
}
|
||||
|
||||
#ifdef HAVE_VTE
|
||||
if (app->have_vte)
|
||||
{
|
||||
|
@ -52,6 +52,7 @@
|
||||
#include "templates.h"
|
||||
#include "treeviews.h"
|
||||
#include "utils.h"
|
||||
#include "encodings.h"
|
||||
|
||||
|
||||
|
||||
@ -372,7 +373,8 @@ void document_new_file(filetype *ft)
|
||||
sci_set_text(doc_list[idx].sci, template);
|
||||
g_free(template);
|
||||
|
||||
doc_list[idx].encoding = g_strdup("UTF-8");
|
||||
doc_list[idx].encoding = g_strdup(
|
||||
encodings_get_charset(&encodings[app->pref_editor_default_encoding]));
|
||||
document_set_filetype(idx, ft);
|
||||
utils_set_window_title(idx);
|
||||
utils_build_show_hide(idx);
|
||||
@ -619,6 +621,8 @@ void document_save_file(gint idx)
|
||||
return;
|
||||
}
|
||||
|
||||
// replaces tabs by spaces
|
||||
if (app->pref_editor_replace_tabs) utils_replace_tabs(idx);
|
||||
// strip trailing spaces
|
||||
if (app->pref_editor_trail_space) utils_strip_trailing_spaces(idx);
|
||||
// ensure the file has a newline at the end
|
||||
@ -642,8 +646,13 @@ void document_save_file(gint idx)
|
||||
|
||||
if (conv_error != NULL)
|
||||
{
|
||||
g_error_free(conv_error);
|
||||
geany_debug("error while converting the file to its orinial encoding");
|
||||
geany_debug("encoding: %s error message: %s)",
|
||||
doc_list[idx].encoding, conv_error->message);
|
||||
g_free(doc_list[idx].encoding);
|
||||
doc_list[idx].encoding = g_strdup("UTF-8");
|
||||
msgwin_status_add(_("Error while converting file (%s)."), conv_error->message);
|
||||
g_error_free(conv_error);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -57,7 +57,6 @@ static void init_encodings(void)
|
||||
fill(GEANY_ENCODING_ISO_8859_15, "ISO-8859-15", "Western");
|
||||
fill(GEANY_ENCODING_ISO_8859_16, "ISO-8859-16", "Romanian");
|
||||
|
||||
fill(GEANY_ENCODING_UTF_7, "UTF-7", "Unicode");
|
||||
fill(GEANY_ENCODING_UTF_8, "UTF-8", "Unicode");
|
||||
fill(GEANY_ENCODING_UTF_16, "UTF-16", "Unicode");
|
||||
fill(GEANY_ENCODING_UCS_2, "UCS-2", "Unicode");
|
||||
@ -118,10 +117,10 @@ static void encodings_lazy_init(void)
|
||||
if (initialized)
|
||||
return;
|
||||
|
||||
g_return_if_fail(G_N_ELEMENTS(encodings) == GEANY_ENCODING_LAST);
|
||||
g_return_if_fail(G_N_ELEMENTS(encodings) == GEANY_ENCODINGS_MAX);
|
||||
|
||||
i = 0;
|
||||
while (i < GEANY_ENCODING_LAST)
|
||||
while (i < GEANY_ENCODINGS_MAX)
|
||||
{
|
||||
g_return_if_fail(encodings[i].idx == i);
|
||||
|
||||
@ -142,7 +141,7 @@ const GeanyEncoding *encodings_get_from_charset(const gchar *charset)
|
||||
encodings_lazy_init ();
|
||||
|
||||
i = 0;
|
||||
while (i < GEANY_ENCODING_LAST)
|
||||
while (i < GEANY_ENCODINGS_MAX)
|
||||
{
|
||||
if (strcmp(charset, encodings[i].charset) == 0)
|
||||
return &encodings[i];
|
||||
@ -158,7 +157,7 @@ const GeanyEncoding *encodings_get_from_index(gint index)
|
||||
{
|
||||
g_return_val_if_fail(index >= 0, NULL);
|
||||
|
||||
if (index >= GEANY_ENCODING_LAST)
|
||||
if (index >= GEANY_ENCODINGS_MAX)
|
||||
return NULL;
|
||||
|
||||
encodings_lazy_init();
|
||||
@ -236,7 +235,7 @@ void encodings_init(void)
|
||||
|
||||
// create encodings submenu in document menu
|
||||
menu = lookup_widget(app->window, "set_encoding1_menu");
|
||||
while (i < GEANY_ENCODING_LAST)
|
||||
while (i < GEANY_ENCODINGS_MAX)
|
||||
{
|
||||
if (encodings[i].idx != i) break;
|
||||
|
||||
|
@ -78,7 +78,6 @@ typedef enum
|
||||
GEANY_ENCODING_ISO_8859_15,
|
||||
GEANY_ENCODING_ISO_8859_16,
|
||||
|
||||
GEANY_ENCODING_UTF_7,
|
||||
GEANY_ENCODING_UTF_8,
|
||||
GEANY_ENCODING_UTF_16,
|
||||
GEANY_ENCODING_UCS_2,
|
||||
@ -129,11 +128,11 @@ typedef enum
|
||||
GEANY_ENCODING_WINDOWS_1257,
|
||||
GEANY_ENCODING_WINDOWS_1258,
|
||||
|
||||
GEANY_ENCODING_LAST
|
||||
GEANY_ENCODINGS_MAX
|
||||
|
||||
} GeanyEncodingIndex;
|
||||
|
||||
|
||||
GeanyEncoding encodings[GEANY_ENCODING_LAST];
|
||||
GeanyEncoding encodings[GEANY_ENCODINGS_MAX];
|
||||
|
||||
#endif
|
||||
|
@ -147,7 +147,9 @@ typedef struct MyApp
|
||||
gboolean pref_editor_auto_complete_constructs;
|
||||
gboolean pref_editor_folding;
|
||||
gint pref_editor_tab_width;
|
||||
gint pref_editor_default_encoding;
|
||||
gboolean pref_editor_new_line;
|
||||
gboolean pref_editor_replace_tabs;
|
||||
gboolean pref_editor_trail_space;
|
||||
gboolean pref_main_load_session;
|
||||
gboolean pref_main_save_winpos;
|
||||
|
@ -1830,6 +1830,10 @@ create_prefs_dialog (void)
|
||||
GtkWidget *frame6;
|
||||
GtkWidget *alignment7;
|
||||
GtkWidget *vbox8;
|
||||
GtkWidget *hbox4;
|
||||
GtkWidget *label153;
|
||||
GtkWidget *eventbox1;
|
||||
GtkWidget *combo_encoding;
|
||||
GtkWidget *table5;
|
||||
GtkWidget *label116;
|
||||
GtkObject *spin_tab_width_adj;
|
||||
@ -1840,6 +1844,7 @@ create_prefs_dialog (void)
|
||||
GtkWidget *vbox6;
|
||||
GtkWidget *check_trailing_spaces;
|
||||
GtkWidget *check_new_line;
|
||||
GtkWidget *check_replace_tabs;
|
||||
GtkWidget *label19;
|
||||
GtkWidget *frame5;
|
||||
GtkWidget *alignment6;
|
||||
@ -2174,13 +2179,30 @@ create_prefs_dialog (void)
|
||||
gtk_container_add (GTK_CONTAINER (frame6), alignment7);
|
||||
gtk_alignment_set_padding (GTK_ALIGNMENT (alignment7), 0, 0, 12, 0);
|
||||
|
||||
vbox8 = gtk_vbox_new (FALSE, 0);
|
||||
vbox8 = gtk_vbox_new (FALSE, 3);
|
||||
gtk_widget_show (vbox8);
|
||||
gtk_container_add (GTK_CONTAINER (alignment7), vbox8);
|
||||
|
||||
hbox4 = gtk_hbox_new (FALSE, 12);
|
||||
gtk_widget_show (hbox4);
|
||||
gtk_box_pack_start (GTK_BOX (vbox8), hbox4, FALSE, TRUE, 0);
|
||||
|
||||
label153 = gtk_label_new (_("Default encoding:"));
|
||||
gtk_widget_show (label153);
|
||||
gtk_box_pack_start (GTK_BOX (hbox4), label153, FALSE, FALSE, 0);
|
||||
|
||||
eventbox1 = gtk_event_box_new ();
|
||||
gtk_widget_show (eventbox1);
|
||||
gtk_box_pack_start (GTK_BOX (hbox4), eventbox1, FALSE, FALSE, 0);
|
||||
gtk_tooltips_set_tip (tooltips, eventbox1, _("Sets the default encoding for newly created files."), NULL);
|
||||
|
||||
combo_encoding = gtk_combo_box_new_text ();
|
||||
gtk_widget_show (combo_encoding);
|
||||
gtk_container_add (GTK_CONTAINER (eventbox1), combo_encoding);
|
||||
|
||||
table5 = gtk_table_new (1, 2, FALSE);
|
||||
gtk_widget_show (table5);
|
||||
gtk_box_pack_start (GTK_BOX (vbox8), table5, FALSE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (vbox8), table5, TRUE, TRUE, 0);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table5), 3);
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table5), 25);
|
||||
|
||||
@ -2235,6 +2257,13 @@ create_prefs_dialog (void)
|
||||
gtk_tooltips_set_tip (tooltips, check_new_line, _("Ensures that at the end of the file is a new line"), NULL);
|
||||
gtk_button_set_focus_on_click (GTK_BUTTON (check_new_line), FALSE);
|
||||
|
||||
check_replace_tabs = gtk_check_button_new_with_mnemonic (_("Replace tabs by space"));
|
||||
gtk_widget_show (check_replace_tabs);
|
||||
gtk_box_pack_start (GTK_BOX (vbox6), check_replace_tabs, FALSE, FALSE, 0);
|
||||
GTK_WIDGET_UNSET_FLAGS (check_replace_tabs, GTK_CAN_FOCUS);
|
||||
gtk_tooltips_set_tip (tooltips, check_replace_tabs, _("Replaces all tabs in document by spaces."), NULL);
|
||||
gtk_button_set_focus_on_click (GTK_BUTTON (check_replace_tabs), FALSE);
|
||||
|
||||
label19 = gtk_label_new (_("<b>Saving files</b>"));
|
||||
gtk_widget_show (label19);
|
||||
gtk_frame_set_label_widget (GTK_FRAME (frame2), label19);
|
||||
@ -2645,6 +2674,10 @@ create_prefs_dialog (void)
|
||||
GLADE_HOOKUP_OBJECT (prefs_dialog, frame6, "frame6");
|
||||
GLADE_HOOKUP_OBJECT (prefs_dialog, alignment7, "alignment7");
|
||||
GLADE_HOOKUP_OBJECT (prefs_dialog, vbox8, "vbox8");
|
||||
GLADE_HOOKUP_OBJECT (prefs_dialog, hbox4, "hbox4");
|
||||
GLADE_HOOKUP_OBJECT (prefs_dialog, label153, "label153");
|
||||
GLADE_HOOKUP_OBJECT (prefs_dialog, eventbox1, "eventbox1");
|
||||
GLADE_HOOKUP_OBJECT (prefs_dialog, combo_encoding, "combo_encoding");
|
||||
GLADE_HOOKUP_OBJECT (prefs_dialog, table5, "table5");
|
||||
GLADE_HOOKUP_OBJECT (prefs_dialog, label116, "label116");
|
||||
GLADE_HOOKUP_OBJECT (prefs_dialog, spin_tab_width, "spin_tab_width");
|
||||
@ -2654,6 +2687,7 @@ create_prefs_dialog (void)
|
||||
GLADE_HOOKUP_OBJECT (prefs_dialog, vbox6, "vbox6");
|
||||
GLADE_HOOKUP_OBJECT (prefs_dialog, check_trailing_spaces, "check_trailing_spaces");
|
||||
GLADE_HOOKUP_OBJECT (prefs_dialog, check_new_line, "check_new_line");
|
||||
GLADE_HOOKUP_OBJECT (prefs_dialog, check_replace_tabs, "check_replace_tabs");
|
||||
GLADE_HOOKUP_OBJECT (prefs_dialog, label19, "label19");
|
||||
GLADE_HOOKUP_OBJECT (prefs_dialog, frame5, "frame5");
|
||||
GLADE_HOOKUP_OBJECT (prefs_dialog, alignment6, "alignment6");
|
||||
|
@ -47,6 +47,7 @@ static void cb_func_menu_new(void);
|
||||
static void cb_func_menu_open(void);
|
||||
static void cb_func_menu_save(void);
|
||||
static void cb_func_menu_saveall(void);
|
||||
static void cb_func_menu_close(void);
|
||||
static void cb_func_menu_closeall(void);
|
||||
static void cb_func_menu_reloadfile(void);
|
||||
static void cb_func_menu_undo(void);
|
||||
@ -110,6 +111,8 @@ void keybindings_init(void)
|
||||
GDK_s, GDK_CONTROL_MASK, "menu_save", _("Save"));
|
||||
keys[GEANY_KEYS_MENU_SAVEALL] = fill(cb_func_menu_saveall,
|
||||
GDK_S, GDK_SHIFT_MASK | GDK_CONTROL_MASK, "menu_saveall", _("Save all"));
|
||||
keys[GEANY_KEYS_MENU_CLOSE] = fill(cb_func_menu_close,
|
||||
GDK_w, GDK_CONTROL_MASK, "menu_close", _("Close"));
|
||||
keys[GEANY_KEYS_MENU_CLOSEALL] = fill(cb_func_menu_closeall,
|
||||
GDK_d, GDK_MOD1_MASK, "menu_closeall", _("Close all"));
|
||||
keys[GEANY_KEYS_MENU_RELOADFILE] = fill(cb_func_menu_reloadfile,
|
||||
@ -234,6 +237,7 @@ static void keybindings_add_accels()
|
||||
|
||||
// apply the settings
|
||||
GEANY_ADD_ACCEL(GEANY_KEYS_MENU_SAVEALL, menu_save_all1);
|
||||
GEANY_ADD_ACCEL(GEANY_KEYS_MENU_CLOSE, menu_close1);
|
||||
GEANY_ADD_ACCEL(GEANY_KEYS_MENU_CLOSEALL, menu_close_all1);
|
||||
GEANY_ADD_ACCEL(GEANY_KEYS_MENU_RELOADFILE, revert1);
|
||||
GEANY_ADD_ACCEL(GEANY_KEYS_MENU_UNDO, menu_undo2);
|
||||
@ -378,6 +382,11 @@ static void cb_func_menu_saveall(void)
|
||||
on_save_all1_activate(NULL, NULL);
|
||||
}
|
||||
|
||||
static void cb_func_menu_close(void)
|
||||
{
|
||||
on_close1_activate(NULL, NULL);
|
||||
}
|
||||
|
||||
static void cb_func_menu_closeall(void)
|
||||
{
|
||||
on_close_all1_activate(NULL, NULL);
|
||||
|
@ -45,6 +45,7 @@ enum
|
||||
GEANY_KEYS_MENU_OPEN,
|
||||
GEANY_KEYS_MENU_SAVE,
|
||||
GEANY_KEYS_MENU_SAVEALL,
|
||||
GEANY_KEYS_MENU_CLOSE,
|
||||
GEANY_KEYS_MENU_CLOSEALL,
|
||||
GEANY_KEYS_MENU_RELOADFILE,
|
||||
GEANY_KEYS_MENU_UNDO,
|
||||
|
@ -116,12 +116,14 @@ void configuration_save(void)
|
||||
g_key_file_set_integer_list(config, PACKAGE, "geometry", app->geometry, 4);
|
||||
}
|
||||
g_key_file_set_integer(config, PACKAGE, "pref_editor_tab_width", app->pref_editor_tab_width);
|
||||
g_key_file_set_integer(config, PACKAGE, "pref_editor_default_encoding", app->pref_editor_default_encoding);
|
||||
g_key_file_set_boolean(config, PACKAGE, "pref_main_confirm_exit", app->pref_main_confirm_exit);
|
||||
g_key_file_set_boolean(config, PACKAGE, "pref_main_load_session", app->pref_main_load_session);
|
||||
g_key_file_set_boolean(config, PACKAGE, "pref_main_save_winpos", app->pref_main_save_winpos);
|
||||
g_key_file_set_boolean(config, PACKAGE, "pref_main_show_search", app->pref_main_show_search);
|
||||
g_key_file_set_boolean(config, PACKAGE, "pref_main_show_goto", app->pref_main_show_goto);
|
||||
g_key_file_set_boolean(config, PACKAGE, "pref_editor_new_line", app->pref_editor_new_line);
|
||||
g_key_file_set_boolean(config, PACKAGE, "pref_editor_replace_tabs", app->pref_editor_replace_tabs);
|
||||
g_key_file_set_boolean(config, PACKAGE, "pref_editor_trail_space", app->pref_editor_trail_space);
|
||||
g_key_file_set_string(config, PACKAGE, "pref_template_developer", app->pref_template_developer);
|
||||
g_key_file_set_string(config, PACKAGE, "pref_template_company", app->pref_template_company);
|
||||
@ -221,7 +223,7 @@ gboolean configuration_load(void)
|
||||
app->fullscreen = utils_get_setting_boolean(config, PACKAGE, "fullscreen", FALSE);
|
||||
app->tab_order_ltr = utils_get_setting_boolean(config, PACKAGE, "tab_order_ltr", FALSE);
|
||||
app->brace_match_ltgt = utils_get_setting_boolean(config, PACKAGE, "brace_match_ltgt", FALSE);
|
||||
app->switch_msgwin_pages = utils_get_setting_boolean(config, PACKAGE, "switch_msgwin_pages", TRUE);
|
||||
app->switch_msgwin_pages = utils_get_setting_boolean(config, PACKAGE, "switch_msgwin_pages", FALSE);
|
||||
app->pref_editor_auto_close_xml_tags = utils_get_setting_boolean(config, PACKAGE, "auto_close_xml_tags", TRUE);
|
||||
app->pref_editor_auto_complete_constructs = utils_get_setting_boolean(config, PACKAGE, "auto_complete_constructs", TRUE);
|
||||
app->editor_font = utils_get_setting_string(config, PACKAGE, "editor_font", "Courier New 9");
|
||||
@ -251,6 +253,8 @@ gboolean configuration_load(void)
|
||||
|
||||
|
||||
app->pref_editor_tab_width = utils_get_setting_integer(config, PACKAGE, "pref_editor_tab_width", 4);
|
||||
// set default encoding to UTF8 (Unicode) - index 15
|
||||
app->pref_editor_default_encoding = utils_get_setting_integer(config, PACKAGE, "pref_editor_default_encoding", 15);
|
||||
app->pref_main_confirm_exit = utils_get_setting_boolean(config, PACKAGE, "pref_main_confirm_exit", TRUE);
|
||||
app->pref_main_load_session = utils_get_setting_boolean(config, PACKAGE, "pref_main_load_session", TRUE);
|
||||
app->pref_main_save_winpos = utils_get_setting_boolean(config, PACKAGE, "pref_main_save_winpos", TRUE);
|
||||
@ -274,6 +278,7 @@ gboolean configuration_load(void)
|
||||
g_free(tmp_string);
|
||||
g_free(tmp_string2);
|
||||
|
||||
app->pref_editor_replace_tabs = utils_get_setting_boolean(config, PACKAGE, "pref_editor_replace_tabs", FALSE);
|
||||
app->pref_editor_new_line = utils_get_setting_boolean(config, PACKAGE, "pref_editor_new_line", TRUE);
|
||||
app->pref_editor_trail_space = utils_get_setting_boolean(config, PACKAGE, "pref_editor_trail_space", TRUE);
|
||||
|
||||
|
13
src/prefs.c
13
src/prefs.c
@ -115,12 +115,19 @@ void prefs_init_dialog(void)
|
||||
gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget), app->pref_editor_tab_width);
|
||||
old_tab_width = app->pref_editor_tab_width;
|
||||
|
||||
widget = lookup_widget(app->prefs_dialog, "combo_encoding");
|
||||
// luckily the index of the combo box items match the index of the encodings array
|
||||
gtk_combo_box_set_active(GTK_COMBO_BOX(widget), app->pref_editor_default_encoding);
|
||||
|
||||
widget = lookup_widget(app->prefs_dialog, "check_trailing_spaces");
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), app->pref_editor_trail_space);
|
||||
|
||||
widget = lookup_widget(app->prefs_dialog, "check_new_line");
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), app->pref_editor_new_line);
|
||||
|
||||
widget = lookup_widget(app->prefs_dialog, "check_replace_tabs");
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), app->pref_editor_replace_tabs);
|
||||
|
||||
widget = lookup_widget(app->prefs_dialog, "check_indent");
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), app->pref_editor_show_indent_guide);
|
||||
|
||||
@ -323,12 +330,18 @@ void on_prefs_button_clicked(GtkDialog *dialog, gint response, gpointer user_dat
|
||||
widget = lookup_widget(app->prefs_dialog, "spin_tab_width");
|
||||
app->pref_editor_tab_width = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
|
||||
|
||||
widget = lookup_widget(app->prefs_dialog, "combo_encoding");
|
||||
app->pref_editor_default_encoding = gtk_combo_box_get_active(GTK_COMBO_BOX(widget));
|
||||
|
||||
widget = lookup_widget(app->prefs_dialog, "check_trailing_spaces");
|
||||
app->pref_editor_trail_space = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
||||
|
||||
widget = lookup_widget(app->prefs_dialog, "check_new_line");
|
||||
app->pref_editor_new_line = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
||||
|
||||
widget = lookup_widget(app->prefs_dialog, "check_replace_tabs");
|
||||
app->pref_editor_replace_tabs = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
||||
|
||||
widget = lookup_widget(app->prefs_dialog, "spin_long_line");
|
||||
app->long_line_column = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user