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.
This commit is contained in:
Jehan 2022-07-27 10:09:43 +02:00
parent cac7ed93a0
commit 6c18c7e497
3 changed files with 20 additions and 2 deletions

View File

@ -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);

View File

@ -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");
}

View File

@ -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__ */