[gnome-panel] clock: remove rsvg dependency



commit 05d32e6b259769a4aec5519f777cdd5f39ee2f1b
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Thu Dec 1 17:25:23 2016 +0200

    clock: remove rsvg dependency

 applets/clock/clock-face.c  |   10 +++++---
 applets/clock/clock-utils.c |   49 -------------------------------------------
 applets/clock/clock-utils.h |    4 ---
 configure.ac                |   16 +++++++++----
 4 files changed, 17 insertions(+), 62 deletions(-)
---
diff --git a/applets/clock/clock-face.c b/applets/clock/clock-face.c
index a9cebea..f65bf06 100644
--- a/applets/clock/clock-face.c
+++ b/applets/clock/clock-face.c
@@ -439,16 +439,18 @@ clock_face_load_face (ClockFace *this, gint width, gint height)
                            "clock-face-", size_string[priv->size],
                             "-", daytime_string[priv->timeofday], ".svg",
                             NULL);
-       priv->face_pixbuf = clock_utils_pixbuf_from_svg_resource_at_size (name,
-                                                                         width, height);
+       priv->face_pixbuf = gdk_pixbuf_new_from_resource_at_scale (name,
+                                                                  width, height,
+                                                                  FALSE, NULL);
        g_free (name);
 
        if (!priv->face_pixbuf) {
                name = g_strconcat (CLOCK_RESOURCE_PATH "icons/",
                                    "clock-face-", size_string[priv->size], ".svg",
                                    NULL);
-               priv->face_pixbuf = clock_utils_pixbuf_from_svg_resource_at_size (name,
-                                                                                 width, height);
+               priv->face_pixbuf = gdk_pixbuf_new_from_resource_at_scale (name,
+                                                                          width, height,
+                                                                          FALSE, NULL);
                 g_free (name);
         }
 
diff --git a/applets/clock/clock-utils.c b/applets/clock/clock-utils.c
index a63d0d2..f3416d8 100644
--- a/applets/clock/clock-utils.c
+++ b/applets/clock/clock-utils.c
@@ -32,8 +32,6 @@
 
 #include <gtk/gtk.h>
 
-#include <librsvg/rsvg.h>
-
 #include "clock-applet.h"
 #include "clock-utils.h"
 
@@ -125,50 +123,3 @@ clock_utils_display_help (GtkWidget  *widget,
                gtk_widget_show (dialog);
        }
 }
-
-GdkPixbuf *
-clock_utils_pixbuf_from_svg_resource_at_size (const char *resource,
-                                             int         width,
-                                             int         height)
-{
-       GInputStream      *stream = NULL;
-       RsvgHandle        *handle = NULL;
-       RsvgDimensionData  svg_dimensions;
-       GdkPixbuf         *pixbuf = NULL;
-       cairo_surface_t   *surface = NULL;
-       cairo_matrix_t     matrix;
-       cairo_t           *cr = NULL;
-
-       stream = g_resources_open_stream (resource, 0, NULL);
-       if (!stream)
-               goto out;
-
-       handle = rsvg_handle_new ();
-       if (!handle)
-               goto out;
-
-       if (!rsvg_handle_read_stream_sync (handle, stream, NULL, NULL))
-               goto out;
-
-       rsvg_handle_get_dimensions (handle, &svg_dimensions);
-
-       surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width, height);
-       cr = cairo_create (surface);
-       cairo_matrix_init_scale (&matrix,
-                                ((double) width / svg_dimensions.width),
-                                ((double) height / svg_dimensions.height));
-       cairo_transform (cr, &matrix);
-       rsvg_handle_render_cairo (handle, cr);
-       cairo_destroy (cr);
-
-       pixbuf = gdk_pixbuf_get_from_surface (surface, 0, 0, width, height);
-       cairo_surface_destroy (surface);
-
-out:
-       if (handle)
-               rsvg_handle_close (handle, NULL);
-       if (stream)
-               g_object_unref (stream);
-
-       return pixbuf;
-}
diff --git a/applets/clock/clock-utils.h b/applets/clock/clock-utils.h
index f04e18d..c008d51 100644
--- a/applets/clock/clock-utils.h
+++ b/applets/clock/clock-utils.h
@@ -37,10 +37,6 @@ void clock_utils_display_help (GtkWidget  *widget,
                               const char *doc_id,
                               const char *link_id);
 
-GdkPixbuf *clock_utils_pixbuf_from_svg_resource_at_size (const char *resource,
-                                                        int         width,
-                                                        int         height);
-
 G_END_DECLS
 
 #endif /* __CLOCK_UTILS_H__ */
diff --git a/configure.ac b/configure.ac
index 7fdeeb8..d54bc9e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -104,7 +104,7 @@ AC_ARG_ENABLE([documentation],
 AM_CONDITIONAL(ENABLE_DOCUMENTATION, test x$enable_documentation = xyes)
 
 LIBGNOME_DESKTOP_REQUIRED=2.91.0
-GDK_PIXBUF_REQUIRED=2.25.2
+GDK_PIXBUF_REQUIRED=2.26.0
 PANGO_REQUIRED=1.15.4
 GLIB_REQUIRED=2.45.3
 GTK_REQUIRED=3.22.0
@@ -115,7 +115,6 @@ LIBEDATASERVER_REQUIRED=3.5.3
 CAIRO_REQUIRED=1.0.0
 GWEATHER_REQUIRED=3.17.1
 DCONF_REQUIRED=0.13.4
-LIBRSVG_REQUIRED=2.36.2
 XRANDR_REQUIRED=1.3.0
 
 dnl pkg-config dependency checks
@@ -172,9 +171,16 @@ AC_SUBST(WNCKLET_LIBS)
 AC_CHECK_HEADERS(langinfo.h)
 AC_CHECK_FUNCS(nl_langinfo)
 
-PKG_CHECK_MODULES(CLOCK, pango >= $PANGO_REQUIRED gtk+-3.0 >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED 
gio-2.0 >= $GLIB_REQUIRED librsvg-2.0 >= $LIBRSVG_REQUIRED gweather-3.0 >= $GWEATHER_REQUIRED 
gnome-desktop-3.0 >= $LIBGNOME_DESKTOP_REQUIRED polkit-gobject-1 dconf >= $DCONF_REQUIRED)
-AC_SUBST(CLOCK_CFLAGS)
-AC_SUBST(CLOCK_LIBS)
+PKG_CHECK_MODULES([CLOCK], [
+  dconf >= $DCONF_REQUIRED
+  gio-2.0 >= $GLIB_REQUIRED
+  glib-2.0 >= $GLIB_REQUIRED
+  gnome-desktop-3.0 >= $LIBGNOME_DESKTOP_REQUIRED
+  gtk+-3.0 >= $GTK_REQUIRED
+  gweather-3.0 >= $GWEATHER_REQUIRED
+  pango >= $PANGO_REQUIRED
+  polkit-gobject-1
+])
 
 # Check whether to enable e-d-s support for clock applet
 AC_MSG_CHECKING([whether to enable evolution-data-server support])


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]