1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-11-19 11:35:12 +00:00

Remove use of deprecated librsvg functions.

This commit is contained in:
Brenden Matthews 2021-02-27 09:50:44 -06:00
parent eebd5f056e
commit 6eae8e8c24
No known key found for this signature in database
GPG Key ID: B49ABB7270D9D4FD

View File

@ -55,8 +55,11 @@ void rsvgPositionDataGet(RsvgPositionData *pd, int *x, int *y) {
} }
RsvgHandle *rsvg_create_handle_from_file(const char *filename) { RsvgHandle *rsvg_create_handle_from_file(const char *filename) {
GFile *gfile = g_file_new_for_path(filename);
GError *error = NULL; GError *error = NULL;
RsvgHandle *handle = rsvg_handle_new_from_file(filename, &error); RsvgHandle *handle = rsvg_handle_new_from_gfile_sync(
gfile, RSVG_HANDLE_FLAGS_NONE, NULL, &error);
if (error) { if (error) {
g_object_unref(error); g_object_unref(error);
@ -64,22 +67,15 @@ RsvgHandle *rsvg_create_handle_from_file(const char *filename) {
handle = NULL; handle = NULL;
} }
g_object_unref(gfile);
return handle; return handle;
} }
int rsvg_destroy_handle(RsvgHandle *handle) { int rsvg_destroy_handle(RsvgHandle *handle) {
int status = 0; if (handle) { g_object_unref(handle); }
if (handle) { return 0;
GError *error = NULL;
status = rsvg_handle_close(handle, &error);
if (status) g_object_unref(handle);
if (error) g_object_unref(error);
}
return status;
} }
#endif /* _LIBRSVG_HELPER_H_ */ #endif /* _LIBRSVG_HELPER_H_ */