app: in the transform tools, blink type box when there's no item to transform

In the transform tools, when there is no item of the selected type
to transform, blink the move-type box widget in the tool options,
in addition to showing an error message in the status bar, to hint
at the source of the error.

(cherry picked from commit 17412aa234)
This commit is contained in:
Ell 2018-12-10 07:39:32 -05:00
parent 92c6f87391
commit a42f2cb2e7
3 changed files with 21 additions and 12 deletions

View file

@ -214,18 +214,21 @@ gimp_transform_options_gui (GimpToolOptions *tool_options,
gboolean interpolation,
gboolean clipping)
{
GObject *config = G_OBJECT (tool_options);
GtkWidget *vbox = gimp_tool_options_gui (tool_options);
GtkWidget *hbox;
GtkWidget *box;
GtkWidget *label;
GtkWidget *frame;
GtkWidget *combo;
GObject *config = G_OBJECT (tool_options);
GimpTransformOptions *options = GIMP_TRANSFORM_OPTIONS (tool_options);
GtkWidget *vbox = gimp_tool_options_gui (tool_options);
GtkWidget *hbox;
GtkWidget *box;
GtkWidget *label;
GtkWidget *frame;
GtkWidget *combo;
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox);
options->type_box = hbox;
label = gtk_label_new (_("Transform:"));
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
gtk_widget_show (label);

View file

@ -35,12 +35,15 @@ typedef struct _GimpTransformOptionsClass GimpTransformOptionsClass;
struct _GimpTransformOptions
{
GimpToolOptions parent_instance;
GimpToolOptions parent_instance;
GimpTransformType type;
GimpTransformDirection direction;
GimpInterpolationType interpolation;
GimpTransformResize clip;
GimpTransformType type;
GimpTransformDirection direction;
GimpInterpolationType interpolation;
GimpTransformResize clip;
/* options gui */
GtkWidget *type_box;
};
struct _GimpTransformOptionsClass

View file

@ -43,6 +43,7 @@
#include "widgets/gimpmessagedialog.h"
#include "widgets/gimpmessagebox.h"
#include "widgets/gimpwidgets-utils.h"
#include "gimptoolcontrol.h"
#include "gimptransformoptions.h"
@ -560,6 +561,8 @@ gimp_transform_tool_check_active_item (GimpTransformTool *tr_tool,
if (! item)
{
g_set_error_literal (error, GIMP_ERROR, GIMP_FAILED, null_message);
if (error)
gimp_widget_blink (options->type_box);
return NULL;
}