[gimp] Issue #7795: fix CRITICAL when tool options dockable is absent.



commit 6c18c7e4975064646788fdc26d8ffb55c141732e
Author: Jehan <jehan girinstud io>
Date:   Wed Jul 27 10:09:43 2022 +0200

    Issue #7795: fix CRITICAL when tool options dockable is absent.
    
    Create a new utils function gimp_tools_show_tool_options() because
    showing the tool options is likely a common action. And use this when we
    want to blink the selection mode box, for this particular case.
    
    Note that I could not reproduce the CRITICAL here (i.e. even if the
    dockable was not showing, it seems the widget did already exist anyway).
    Anyway it's a nice idea to raise the tool options as the goal is to
    explicitly show how to fix the issue here. And it should fix the bug for
    people encountering it.

 app/tools/gimpselectiontool.c |  1 +
 app/tools/gimptools-utils.c   | 15 +++++++++++++++
 app/tools/gimptools-utils.h   |  6 ++++--
 3 files changed, 20 insertions(+), 2 deletions(-)
---
diff --git a/app/tools/gimpselectiontool.c b/app/tools/gimpselectiontool.c
index 79765fa3d6..5d08e999ce 100644
--- a/app/tools/gimpselectiontool.c
+++ b/app/tools/gimpselectiontool.c
@@ -649,6 +649,7 @@ gimp_selection_tool_start_edit (GimpSelectionTool *sel_tool,
     {
       gimp_tool_message_literal (tool, display, error->message);
 
+      gimp_tools_show_tool_options (display->gimp);
       gimp_widget_blink (options->mode_box);
 
       g_clear_error (&error);
diff --git a/app/tools/gimptools-utils.c b/app/tools/gimptools-utils.c
index 8958e988c6..9b5f0cf376 100644
--- a/app/tools/gimptools-utils.c
+++ b/app/tools/gimptools-utils.c
@@ -78,3 +78,18 @@ gimp_tools_blink_lock_box (Gimp     *gimp,
   view = GIMP_ITEM_TREE_VIEW (gtk_bin_get_child (GTK_BIN (dockable)));
   gimp_item_tree_view_blink_lock (view, item);
 }
+
+void
+gimp_tools_show_tool_options (Gimp *gimp)
+{
+  GdkMonitor *monitor;
+
+  g_return_if_fail (GIMP_IS_GIMP (gimp));
+
+  monitor = gimp_get_monitor_at_pointer ();
+
+  gimp_window_strategy_show_dockable_dialog (GIMP_WINDOW_STRATEGY (gimp_get_window_strategy (gimp)),
+                                             gimp,
+                                             gimp_dialog_factory_get_singleton (),
+                                             monitor, "gimp-tool-options");
+}
diff --git a/app/tools/gimptools-utils.h b/app/tools/gimptools-utils.h
index 5810f19ca6..2875d3de09 100644
--- a/app/tools/gimptools-utils.h
+++ b/app/tools/gimptools-utils.h
@@ -19,8 +19,10 @@
 #define __GIMP_TOOLS_UTILS_H__
 
 
-void   gimp_tools_blink_lock_box (Gimp     *gimp,
-                                  GimpItem *item);
+void   gimp_tools_blink_lock_box    (Gimp     *gimp,
+                                     GimpItem *item);
+
+void   gimp_tools_show_tool_options (Gimp *gimp);
 
 
 #endif  /* __GIMP_TOOLS_UTILS_H__ */


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