[gimp] app: make sure there is always a tool selected on startup



commit 825d4ab185f28414b822f26422b0282c5cd2fdec
Author: Michael Natterer <mitch gimp org>
Date:   Tue Mar 3 20:24:40 2015 +0100

    app: make sure there is always a tool selected on startup
    
    "No tool on startup" can happen if a tool has disappeared between
    sessions, or by broken manual config file editing.

 app/tools/gimp-tools.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/app/tools/gimp-tools.c b/app/tools/gimp-tools.c
index 0590f2d..0ed25ae 100644
--- a/app/tools/gimp-tools.c
+++ b/app/tools/gimp-tools.c
@@ -329,6 +329,15 @@ gimp_tools_restore (Gimp *gimp)
       g_clear_error (&error);
     }
 
+  /*  make sure there is always a tool active, so broken config files
+   *  can't leave us with no initial tool
+   */
+  if (! gimp_context_get_tool (gimp_get_user_context (gimp)))
+    {
+      gimp_context_set_tool (gimp_get_user_context (gimp),
+                             gimp_get_tool_info_iter (gimp)->data);
+    }
+
   for (list = gimp_get_tool_info_iter (gimp);
        list;
        list = g_list_next (list))


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