Commit 2da59e7b authored by Michael Natterer's avatar Michael Natterer 😴

app: add a "status-title" string property to GimpToolLine

which defaults to "Line: ". Set it to "Blend: " in the blend tool.
parent f4f2de1b
......@@ -61,7 +61,8 @@ enum
PROP_X1,
PROP_Y1,
PROP_X2,
PROP_Y2
PROP_Y2,
PROP_STATUS_TITLE,
};
struct _GimpToolLinePrivate
......@@ -70,6 +71,7 @@ struct _GimpToolLinePrivate
gdouble y1;
gdouble x2;
gdouble y2;
gchar *status_title;
gdouble saved_x1;
gdouble saved_y1;
......@@ -92,6 +94,7 @@ struct _GimpToolLinePrivate
/* local function prototypes */
static void gimp_tool_line_constructed (GObject *object);
static void gimp_tool_line_finalize (GObject *object);
static void gimp_tool_line_set_property (GObject *object,
guint property_id,
const GValue *value,
......@@ -153,6 +156,7 @@ gimp_tool_line_class_init (GimpToolLineClass *klass)
GimpToolWidgetClass *widget_class = GIMP_TOOL_WIDGET_CLASS (klass);
object_class->constructed = gimp_tool_line_constructed;
object_class->finalize = gimp_tool_line_finalize;
object_class->set_property = gimp_tool_line_set_property;
object_class->get_property = gimp_tool_line_get_property;
......@@ -192,6 +196,13 @@ gimp_tool_line_class_init (GimpToolLineClass *klass)
GIMP_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
g_object_class_install_property (object_class, PROP_STATUS_TITLE,
g_param_spec_string ("status-title",
NULL, NULL,
_("Line: "),
GIMP_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
g_type_class_add_private (klass, sizeof (GimpToolLinePrivate));
}
......@@ -259,6 +270,21 @@ gimp_tool_line_constructed (GObject *object)
gimp_tool_line_changed (widget);
}
static void
gimp_tool_line_finalize (GObject *object)
{
GimpToolLine *line = GIMP_TOOL_LINE (object);
GimpToolLinePrivate *private = line->private;
if (private->status_title)
{
g_free (private->status_title);
private->status_title = NULL;
}
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void
gimp_tool_line_set_property (GObject *object,
guint property_id,
......@@ -283,6 +309,13 @@ gimp_tool_line_set_property (GObject *object,
private->y2 = g_value_get_double (value);
break;
case PROP_STATUS_TITLE:
g_free (private->status_title);
private->status_title = g_value_dup_string (value);
if (! private->status_title)
private->status_title = g_strdup (_("Line: "));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
......@@ -313,6 +346,10 @@ gimp_tool_line_get_property (GObject *object,
g_value_set_double (value, private->y2);
break;
case PROP_STATUS_TITLE:
g_value_set_string (value, private->status_title);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
......@@ -629,7 +666,7 @@ gimp_tool_line_update_status (GimpToolLine *line,
_("%s to move the whole line"));
gimp_tool_widget_set_status_coords (GIMP_TOOL_WIDGET (line),
_("Blend: "),
private->status_title,
private->x2 - private->x1,
", ",
private->y2 - private->y1,
......
......@@ -607,6 +607,10 @@ gimp_blend_tool_start (GimpBlendTool *blend_tool,
blend_tool->end_x,
blend_tool->end_y);
g_object_set (blend_tool->widget,
"status-title", _("Blend: "),
NULL);
gimp_draw_tool_set_widget (GIMP_DRAW_TOOL (tool), blend_tool->widget);
g_signal_connect (blend_tool->widget, "changed",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment