[Xfce4-commits] [apps/xfce4-terminal] 01/01: Refactor Zoom-In/Out enable/disable code

noreply at xfce.org noreply at xfce.org
Fri Sep 2 14:28:22 CEST 2016


This is an automated email from the git hooks/post-receive script.

f2404 pushed a commit to branch master
in repository apps/xfce4-terminal.

commit dc5608756fa4c9495940d442091589c456ba0c8e
Author: Igor <f2404 at yandex.ru>
Date:   Fri Sep 2 15:28:14 2016 +0300

    Refactor Zoom-In/Out enable/disable code
---
 terminal/terminal-window.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/terminal/terminal-window.c b/terminal/terminal-window.c
index f1c815a..1be6131 100644
--- a/terminal/terminal-window.c
+++ b/terminal/terminal-window.c
@@ -1680,8 +1680,6 @@ terminal_window_action_zoom_in (GtkAction     *action,
     {
       ++window->zoom;
       terminal_window_zoom_update_screens (window);
-      if (window->zoom == TERMINAL_ZOOM_LEVEL_MAXIMUM)
-        gtk_action_set_sensitive (action, FALSE);
     }
 }
 
@@ -1697,8 +1695,6 @@ terminal_window_action_zoom_out (GtkAction      *action,
     {
       --window->zoom;
       terminal_window_zoom_update_screens (window);
-      if (window->zoom == TERMINAL_ZOOM_LEVEL_MINIMUM)
-        gtk_action_set_sensitive (action, FALSE);
     }
 }
 
@@ -2088,6 +2084,7 @@ terminal_window_zoom_update_screens (TerminalWindow *window)
 {
   gint            npages, n;
   TerminalScreen *screen;
+  GtkAction      *action;
 
   terminal_return_if_fail (GTK_IS_NOTEBOOK (window->notebook));
 
@@ -2098,6 +2095,19 @@ terminal_window_zoom_update_screens (TerminalWindow *window)
       screen = TERMINAL_SCREEN (gtk_notebook_get_nth_page (GTK_NOTEBOOK (window->notebook), n));
       terminal_screen_update_font (screen);
     }
+
+  /* update zoom actions */
+  action = gtk_action_group_get_action (window->action_group, "zoom-in");
+  if (window->zoom == TERMINAL_ZOOM_LEVEL_MAXIMUM)
+    gtk_action_set_sensitive (action, FALSE);
+  else if (!gtk_action_is_sensitive (action))
+    gtk_action_set_sensitive (action, TRUE);
+
+  action = gtk_action_group_get_action (window->action_group, "zoom-out");
+  if (window->zoom == TERMINAL_ZOOM_LEVEL_MINIMUM)
+      gtk_action_set_sensitive (action, FALSE);
+    else if (!gtk_action_is_sensitive (action))
+      gtk_action_set_sensitive (action, TRUE);
 }
 
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list