Add a hiden preference "allow_always_save" to make the Save buttons/menu items always sensitive and allow saving files even without changes.

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@3520 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Enrico Tröger 2009-01-28 17:01:32 +00:00
parent 692cb1364c
commit 8ef5804bbe
5 changed files with 13 additions and 2 deletions

View File

@ -3,6 +3,10 @@
* src/document.c: * src/document.c:
Set the documents' mtime field properly for checking disk file Set the documents' mtime field properly for checking disk file
changes. changes.
* src/document.c, src/keyfile.c, src/ui_utils.c, src/ui_utils.h:
Add a hiden preference "allow_always_save" to make the Save buttons/
menu items always sensitive and allow saving files even without
changes.
2009-01-27 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de> 2009-01-27 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>

View File

@ -1688,7 +1688,7 @@ gboolean document_save_file(GeanyDocument *doc, gboolean force)
return FALSE; return FALSE;
/* the "changed" flag should exclude the "readonly" flag, but check it anyway for safety */ /* the "changed" flag should exclude the "readonly" flag, but check it anyway for safety */
if (! force && (! doc->changed || doc->readonly)) if (! force && ! ui_prefs.allow_always_save && (! doc->changed || doc->readonly))
return FALSE; return FALSE;
if (doc->file_name == NULL) if (doc->file_name == NULL)

View File

@ -170,6 +170,8 @@ static void init_pref_groups(void)
"complete_snippets_whilst_editing", FALSE); "complete_snippets_whilst_editing", FALSE);
stash_group_add_boolean(group, &interface_prefs.show_symbol_list_expanders, stash_group_add_boolean(group, &interface_prefs.show_symbol_list_expanders,
"show_symbol_list_expanders", TRUE); "show_symbol_list_expanders", TRUE);
stash_group_add_boolean(group, &ui_prefs.allow_always_save,
"allow_always_save", FALSE);
} }

View File

@ -573,6 +573,9 @@ void ui_save_buttons_toggle(gboolean enable)
guint i; guint i;
gboolean dirty_tabs = FALSE; gboolean dirty_tabs = FALSE;
if (ui_prefs.allow_always_save)
return;
ui_widget_set_sensitive(widgets.save_buttons[0], enable); ui_widget_set_sensitive(widgets.save_buttons[0], enable);
ui_widget_set_sensitive(widgets.save_buttons[1], enable); ui_widget_set_sensitive(widgets.save_buttons[1], enable);
@ -609,6 +612,7 @@ static void init_document_widgets(void)
add_doc_widget("close_other_documents1"); add_doc_widget("close_other_documents1");
add_doc_widget("menu_change_font1"); add_doc_widget("menu_change_font1");
add_doc_widget("menu_close_all1"); add_doc_widget("menu_close_all1");
add_doc_widget("menu_save1");
add_doc_widget("menu_save_all1"); add_doc_widget("menu_save_all1");
add_doc_widget("menu_save_as1"); add_doc_widget("menu_save_as1");
add_doc_widget("menu_count_words1"); add_doc_widget("menu_count_words1");
@ -653,7 +657,7 @@ static void init_document_widgets(void)
add_doc_toolitem("Copy"); add_doc_toolitem("Copy");
add_doc_toolitem("Paste"); add_doc_toolitem("Paste");
add_doc_toolitem("Delete"); add_doc_toolitem("Delete");
add_doc_toolitem("SaveAll"); add_doc_toolitem("Save");
add_doc_toolitem("SaveAll"); add_doc_toolitem("SaveAll");
add_doc_toolitem("Compile"); add_doc_toolitem("Compile");
add_doc_toolitem("Run"); add_doc_toolitem("Run");

View File

@ -81,6 +81,7 @@ typedef struct UIPrefs
gboolean fullscreen; gboolean fullscreen;
gboolean sidebar_visible; gboolean sidebar_visible;
gboolean msgwindow_visible; gboolean msgwindow_visible;
gboolean allow_always_save; /* if set, files can always be saved, even if unchanged */
/* Menu-item related data */ /* Menu-item related data */
GQueue *recent_queue; GQueue *recent_queue;