[gedit] "Close all" and "Save All" should be enabled according to tabs status



commit 68dfc296e97fa31d8c47ae956148c66bb03786af
Author: ghugesagar <ghugesss gmail com>
Date:   Wed Mar 26 11:27:33 2014 +0530

    "Close all" and "Save All" should be enabled according to tabs status
    
    https://bugzilla.gnome.org/show_bug.cgi?id=727073

 gedit/gedit-window.c |   28 ++++++++++++++++++++++++----
 1 files changed, 24 insertions(+), 4 deletions(-)
---
diff --git a/gedit/gedit-window.c b/gedit/gedit-window.c
index c691b78..0d3b16d 100644
--- a/gedit/gedit-window.c
+++ b/gedit/gedit-window.c
@@ -1311,13 +1311,15 @@ set_sensitivity_according_to_window_state (GeditWindow *window)
 
        action = g_action_map_lookup_action (G_ACTION_MAP (window), "close-all");
        g_simple_action_set_enabled (G_SIMPLE_ACTION (action),
-                                    !(window->priv->state & GEDIT_WINDOW_STATE_SAVING) &&
-                                    !(window->priv->state & GEDIT_WINDOW_STATE_PRINTING));
+                                    !(window->priv->state & GEDIT_WINDOW_STATE_SAVING) &&
+                                    !(window->priv->state & GEDIT_WINDOW_STATE_PRINTING) &&
+                                    num_tabs > 0);
 
        action = g_action_map_lookup_action (G_ACTION_MAP (window), "save-all");
        g_simple_action_set_enabled (G_SIMPLE_ACTION (action),
-                                    !(window->priv->state & GEDIT_WINDOW_STATE_PRINTING) &&
-                                    !(lockdown & GEDIT_LOCKDOWN_SAVE_TO_DISK));
+                                    !(window->priv->state & GEDIT_WINDOW_STATE_PRINTING) &&
+                                    !(lockdown & GEDIT_LOCKDOWN_SAVE_TO_DISK) &&
+                                    num_tabs > 0);
 
        action = g_action_map_lookup_action (G_ACTION_MAP (window), "save");
        g_simple_action_set_enabled (G_SIMPLE_ACTION (action), num_tabs > 0);
@@ -1920,6 +1922,9 @@ update_sensitivity_according_to_open_tabs (GeditWindow *window,
                                           gint         num_tabs)
 {
        GAction *action;
+       GeditLockdownMask lockdown;
+
+       lockdown = gedit_app_get_lockdown (GEDIT_APP (g_application_get_default ()));
 
        action = g_action_map_lookup_action (G_ACTION_MAP (window), "save");
        g_simple_action_set_enabled (G_SIMPLE_ACTION (action), num_tabs > 0);
@@ -1927,6 +1932,21 @@ update_sensitivity_according_to_open_tabs (GeditWindow *window,
        action = g_action_map_lookup_action (G_ACTION_MAP (window), "save-as");
        g_simple_action_set_enabled (G_SIMPLE_ACTION (action), num_tabs > 0);
 
+       action = g_action_map_lookup_action (G_ACTION_MAP (window), "close-all");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (action),
+                                    !(window->priv->state & GEDIT_WINDOW_STATE_SAVING) &&
+                                    !(window->priv->state & GEDIT_WINDOW_STATE_PRINTING) &&
+                                    num_tabs > 0);
+
+       action = g_action_map_lookup_action (G_ACTION_MAP (window), "save-all");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (action),
+                                    !(window->priv->state & GEDIT_WINDOW_STATE_PRINTING) &&
+                                    !(lockdown & GEDIT_LOCKDOWN_SAVE_TO_DISK) &&
+                                    num_tabs > 0);
+
+       action = g_action_map_lookup_action (G_ACTION_MAP (window), "revert");
+       g_simple_action_set_enabled (G_SIMPLE_ACTION (action), num_tabs > 0);
+
        action = g_action_map_lookup_action (G_ACTION_MAP (window), "reopen-closed-tab");
        g_simple_action_set_enabled (G_SIMPLE_ACTION (action), (window->priv->closed_docs_stack != NULL));
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]