From 8ef5804bbe0a5855d82a3af35ceae3caea2665ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrico=20Tr=C3=B6ger?= Date: Wed, 28 Jan 2009 17:01:32 +0000 Subject: [PATCH] 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 --- ChangeLog | 4 ++++ src/document.c | 2 +- src/keyfile.c | 2 ++ src/ui_utils.c | 6 +++++- src/ui_utils.h | 1 + 5 files changed, 13 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 23528c4f..9e722991 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,10 @@ * src/document.c: Set the documents' mtime field properly for checking disk file 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 diff --git a/src/document.c b/src/document.c index c916998d..ea1680f9 100644 --- a/src/document.c +++ b/src/document.c @@ -1688,7 +1688,7 @@ gboolean document_save_file(GeanyDocument *doc, gboolean force) return FALSE; /* 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; if (doc->file_name == NULL) diff --git a/src/keyfile.c b/src/keyfile.c index 024ac15e..ac6b1eff 100644 --- a/src/keyfile.c +++ b/src/keyfile.c @@ -170,6 +170,8 @@ static void init_pref_groups(void) "complete_snippets_whilst_editing", FALSE); stash_group_add_boolean(group, &interface_prefs.show_symbol_list_expanders, "show_symbol_list_expanders", TRUE); + stash_group_add_boolean(group, &ui_prefs.allow_always_save, + "allow_always_save", FALSE); } diff --git a/src/ui_utils.c b/src/ui_utils.c index d1ca80ca..267b4480 100644 --- a/src/ui_utils.c +++ b/src/ui_utils.c @@ -573,6 +573,9 @@ void ui_save_buttons_toggle(gboolean enable) guint i; 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[1], enable); @@ -609,6 +612,7 @@ static void init_document_widgets(void) add_doc_widget("close_other_documents1"); add_doc_widget("menu_change_font1"); add_doc_widget("menu_close_all1"); + add_doc_widget("menu_save1"); add_doc_widget("menu_save_all1"); add_doc_widget("menu_save_as1"); add_doc_widget("menu_count_words1"); @@ -653,7 +657,7 @@ static void init_document_widgets(void) add_doc_toolitem("Copy"); add_doc_toolitem("Paste"); add_doc_toolitem("Delete"); - add_doc_toolitem("SaveAll"); + add_doc_toolitem("Save"); add_doc_toolitem("SaveAll"); add_doc_toolitem("Compile"); add_doc_toolitem("Run"); diff --git a/src/ui_utils.h b/src/ui_utils.h index 2d077ada..613fd689 100644 --- a/src/ui_utils.h +++ b/src/ui_utils.h @@ -81,6 +81,7 @@ typedef struct UIPrefs gboolean fullscreen; gboolean sidebar_visible; gboolean msgwindow_visible; + gboolean allow_always_save; /* if set, files can always be saved, even if unchanged */ /* Menu-item related data */ GQueue *recent_queue;