mirror of https://github.com/GNOME/gimp.git
file-svg: fix deprecated use of rsvg_handle_get_dimensions()
This commit is contained in:
parent
6f8f481ee2
commit
a6756b515b
|
@ -483,8 +483,8 @@ load_rsvg_size (GFile *file,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
RsvgHandle *handle;
|
RsvgHandle *handle;
|
||||||
RsvgDimensionData dim;
|
|
||||||
gboolean has_size;
|
gboolean has_size;
|
||||||
|
gdouble width, height;
|
||||||
|
|
||||||
handle = rsvg_handle_new_from_gfile_sync (file, rsvg_flags, NULL, error);
|
handle = rsvg_handle_new_from_gfile_sync (file, rsvg_flags, NULL, error);
|
||||||
|
|
||||||
|
@ -493,12 +493,10 @@ load_rsvg_size (GFile *file,
|
||||||
|
|
||||||
rsvg_handle_set_dpi (handle, vals->resolution);
|
rsvg_handle_set_dpi (handle, vals->resolution);
|
||||||
|
|
||||||
rsvg_handle_get_dimensions (handle, &dim);
|
if (rsvg_handle_get_intrinsic_size_in_pixels (handle, &width, &height))
|
||||||
|
|
||||||
if (dim.width > 0 && dim.height > 0)
|
|
||||||
{
|
{
|
||||||
vals->width = dim.width;
|
vals->width = ceil (width);
|
||||||
vals->height = dim.height;
|
vals->height = ceil (height);
|
||||||
has_size = TRUE;
|
has_size = TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -508,21 +506,21 @@ load_rsvg_size (GFile *file,
|
||||||
has_size = FALSE;
|
has_size = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (size_label)
|
if (size_label)
|
||||||
{
|
{
|
||||||
if (has_size)
|
if (has_size)
|
||||||
{
|
{
|
||||||
gchar *text = g_strdup_printf (_("%d × %d"),
|
gchar *text = g_strdup_printf (_("%d × %d"),
|
||||||
vals->width, vals->height);
|
vals->width, vals->height);
|
||||||
gtk_label_set_text (GTK_LABEL (size_label), text);
|
gtk_label_set_text (GTK_LABEL (size_label), text);
|
||||||
g_free (text);
|
g_free (text);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gtk_label_set_text (GTK_LABEL (size_label),
|
gtk_label_set_text (GTK_LABEL (size_label),
|
||||||
_("SVG file does not\nspecify a size!"));
|
_("SVG file does not\nspecify a size!"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
g_object_unref (handle);
|
g_object_unref (handle);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue