app: remove redundant "type" member of GimpSymmetry.

Use G_TYPE_FROM_INSTANCE() instead.
This commit is contained in:
Jehan 2016-02-03 20:11:31 +01:00
parent e01d56969d
commit 73389033d2
5 changed files with 5 additions and 9 deletions

View File

@ -74,7 +74,6 @@ gimp_image_symmetry_new (GimpImage *image,
sym = g_object_new (type,
"image", image,
NULL);
sym->type = type;
return sym;
}

View File

@ -887,7 +887,7 @@ gimp_image_set_property (GObject *object,
for (iter = private->symmetries; iter; iter = g_list_next (iter))
{
GimpSymmetry *sym = iter->data;
if (type == sym->type)
if (type == G_TYPE_FROM_INSTANCE (sym))
private->selected_symmetry = iter->data;
}
@ -948,7 +948,7 @@ gimp_image_get_property (GObject *object,
case PROP_SYMMETRY:
g_value_set_gtype (value,
private->selected_symmetry ?
private->selected_symmetry->type : GIMP_TYPE_SYMMETRY);
G_TYPE_FROM_INSTANCE (private->selected_symmetry) : GIMP_TYPE_SYMMETRY);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);

View File

@ -156,7 +156,6 @@ gimp_symmetry_class_init (GimpSymmetryClass *klass)
static void
gimp_symmetry_init (GimpSymmetry *sym)
{
sym->type = G_TYPE_NONE;
}
static void
@ -405,7 +404,7 @@ gimp_symmetry_to_parasite (const GimpSymmetry *sym)
str = gimp_config_serialize_to_string (GIMP_CONFIG (sym), NULL);
g_return_val_if_fail (str != NULL, NULL);
parasite_name = gimp_symmetry_parasite_name (sym->type);
parasite_name = gimp_symmetry_parasite_name (G_TYPE_FROM_INSTANCE (sym));
parasite = gimp_parasite_new (parasite_name,
GIMP_PARASITE_PERSISTENT,
strlen (str) + 1, str);

View File

@ -45,8 +45,6 @@ struct _GimpSymmetry
gboolean active;
GList *strokes;
GType type;
};
struct _GimpSymmetryClass

View File

@ -389,10 +389,10 @@ gimp_symmetry_editor_set_options (GimpSymmetryEditor *editor,
gtk_container_foreach (GTK_CONTAINER (frame),
(GtkCallback) gtk_widget_destroy, NULL);
if (! symmetry || symmetry->type == GIMP_TYPE_SYMMETRY)
if (! symmetry || G_TYPE_FROM_INSTANCE (symmetry) == GIMP_TYPE_SYMMETRY)
return;
klass = g_type_class_ref (symmetry->type);
klass = g_type_class_ref (G_TYPE_FROM_INSTANCE (symmetry));
gtk_frame_set_label (GTK_FRAME (frame),
klass->label);
g_type_class_unref (klass);