[dia] Use menus_get_tool_actions() for sensitivity of all tools at once



commit 6c53d441ddb0d20bf90cbb3ae565eb3e6b6dcb3f
Author: Hans Breuer <hans breuer org>
Date:   Sat Jan 29 19:57:17 2011 +0100

    Use menus_get_tool_actions() for sensitivity of all  tools at once
    
    Should make the code more maintainable, when we add a new tool.
    The effect on the menu is slightly different than before. Now the
    whole Tools submenu gets disabled, while formerly the single tools
    where insensitive.

 app/diagram.c |   18 +++---------------
 1 files changed, 3 insertions(+), 15 deletions(-)
---
diff --git a/app/diagram.c b/app/diagram.c
index 33f1dac..4f050da 100644
--- a/app/diagram.c
+++ b/app/diagram.c
@@ -629,21 +629,9 @@ diagram_update_menu_sensitivity (Diagram *dia)
   if ((action = menus_get_action ("SelectInverse")) != NULL)
     gtk_action_set_sensitive (action, !textedit_active);
 
-  /* Tools menu */
-  {
-    /* Keep in sync with menus.c(tool_entries) */
-    static gchar * action_names[] = {
-      "ToolsModify", "ToolsMagnify",  "ToolsTextedit",  "ToolsScroll", 
-      "ToolsText", "ToolsBox", "ToolsEllipse", "ToolsPolygon", "ToolsBeziergon",
-      "ToolsLine", "ToolsArc", "ToolsZigzagline", "ToolsPolyline","ToolsBezierline", 
-      "ToolsImage", "ToolsOutline", NULL
-    };
-    int i;
-    for (i = 0; action_names[i] != NULL; ++i) {
-      if ((action = menus_get_action (action_names[i])) != NULL)
-        gtk_action_set_sensitive (action, !textedit_active);
-    }
-  }
+  /* Tools menu - toolbox actions */
+  gtk_action_group_set_sensitive (menus_get_tool_actions (),  !textedit_active);
+
   /* View menu - should not need disabling yet */
 }
     



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