summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZenWalker <[email protected]>2017-06-23 02:16:48 +0200
committerZenWalker <[email protected]>2017-06-23 02:20:01 +0200
commit2b34ed27ac4abde8d70735c008bd214a79b45491 (patch)
tree7a589babf64d41e323ec45de6d0b54127fdba579
parentc428b0281883ec6d9a76bca8bf3813b9648de04c (diff)
downloadpluma-2b34ed27ac4abde8d70735c008bd214a79b45491.tar.bz2
pluma-2b34ed27ac4abde8d70735c008bd214a79b45491.tar.xz
disable the abbility to save the document if it has no changes
this prevent us the write to disk uselessly Closes #199
-rw-r--r--pluma/pluma-window.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/pluma/pluma-window.c b/pluma/pluma-window.c
index b1dcea9c..82b72ade 100644
--- a/pluma/pluma-window.c
+++ b/pluma/pluma-window.c
@@ -71,6 +71,9 @@
PLUMA_TYPE_WINDOW, \
PlumaWindowPrivate))
+/* Local variables */
+static gboolean cansave = TRUE;
+
/* Signals */
enum
{
@@ -692,7 +695,8 @@ set_sensitivity_according_to_tab (PlumaWindow *window,
(state == PLUMA_TAB_STATE_EXTERNALLY_MODIFIED_NOTIFICATION) ||
(state == PLUMA_TAB_STATE_SHOWING_PRINT_PREVIEW)) &&
!pluma_document_get_readonly (doc) &&
- !(lockdown & PLUMA_LOCKDOWN_SAVE_TO_DISK));
+ !(lockdown & PLUMA_LOCKDOWN_SAVE_TO_DISK) &&
+ (cansave));
action = gtk_action_group_get_action (window->priv->action_group,
"FileSaveAs");
@@ -2116,6 +2120,7 @@ set_title (PlumaWindow *window)
gchar *dirname = NULL;
gchar *title = NULL;
gint len;
+ GtkAction *action;
if (window->priv->active_tab == NULL)
{
@@ -2174,7 +2179,10 @@ set_title (PlumaWindow *window)
g_free (name);
name = tmp_name;
- }
+ cansave = TRUE;
+ }
+ else
+ cansave = FALSE;
if (pluma_document_get_readonly (doc))
{
@@ -2199,6 +2207,10 @@ set_title (PlumaWindow *window)
name);
}
+ action = gtk_action_group_get_action (window->priv->action_group,
+ "FileSave");
+ gtk_action_set_sensitive (action, cansave);
+
gtk_window_set_title (GTK_WINDOW (window), title);
g_free (dirname);