summaryrefslogtreecommitdiff
path: root/applets/clock/clock-map.c
diff options
context:
space:
mode:
authorVincent Untz <[email protected]>2012-02-02 14:04:27 +0100
committerraveit65 <[email protected]>2018-04-26 13:01:37 +0200
commitcfe060300ff10557f8805eee176604095c48cc2d (patch)
treec52c7f5d23819a981635089f021a9de032461c14 /applets/clock/clock-map.c
parentc61d3711954a959ebc7c957ac4f39c8ca3b783e9 (diff)
downloadmate-panel-cfe060300ff10557f8805eee176604095c48cc2d.tar.bz2
mate-panel-cfe060300ff10557f8805eee176604095c48cc2d.tar.xz
clock: Convert to GResource
origin commits: https://git.gnome.org/browse/gnome-panel/commit/?h=gnome-3-4&id=aa2895d https://git.gnome.org/browse/gnome-panel/commit/?h=gnome-3-4&id=695d30c https://git.gnome.org/browse/gnome-panel/commit/?h=gnome-3-4&id=00f9870 https://git.gnome.org/browse/gnome-panel/commit/?h=gnome-3-4&id=9ade365
Diffstat (limited to 'applets/clock/clock-map.c')
-rw-r--r--applets/clock/clock-map.c35
1 files changed, 25 insertions, 10 deletions
diff --git a/applets/clock/clock-map.c b/applets/clock/clock-map.c
index 7865d9f1..fa60bb7f 100644
--- a/applets/clock/clock-map.c
+++ b/applets/clock/clock-map.c
@@ -27,9 +27,9 @@ enum {
};
static char *marker_files[MARKER_NB] = {
- ICONDIR "/clock-map-location-marker.png",
- ICONDIR "/clock-map-location-hilight.png",
- ICONDIR "/clock-map-location-current.png"
+ "clock-map-location-marker.png",
+ "clock-map-location-hilight.png",
+ "clock-map-location-current.png"
};
static guint signals[LAST_SIGNAL] = { 0 };
@@ -135,8 +135,17 @@ clock_map_init (ClockMap *this)
g_assert (sizeof (marker_files)/sizeof (char *) == MARKER_NB);
for (i = 0; i < MARKER_NB; i++) {
- priv->location_marker_pixbuf[i] = gdk_pixbuf_new_from_file
- (marker_files[i], NULL);
+ char *resource;
+ GInputStream *stream;
+
+ resource = g_strconcat (CLOCK_RESOURCE_PATH "icons/", marker_files[i], NULL);
+ stream = g_resources_open_stream (resource, 0, NULL);
+ g_free (resource);
+
+ if (stream != NULL) {
+ priv->location_marker_pixbuf[i] = gdk_pixbuf_new_from_stream (stream, NULL, NULL);
+ g_object_unref (stream);
+ }
}
}
@@ -208,11 +217,17 @@ clock_map_refresh (ClockMap *this)
}
if (!priv->stock_map_pixbuf) {
- GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file_at_scale
- (ICONDIR "/clock-map.png",
- priv->width, priv->height, FALSE, NULL);
-
- priv->stock_map_pixbuf = pixbuf;
+ GInputStream *stream = g_resources_open_stream (CLOCK_RESOURCE_PATH "icons/clock-map.png",
+ 0, NULL);
+ if (stream != NULL) {
+ GdkPixbuf *pixbuf = gdk_pixbuf_new_from_stream_at_scale (stream,
+ priv->width, priv->height,
+ FALSE,
+ NULL, NULL);
+ g_object_unref (stream);
+
+ priv->stock_map_pixbuf = pixbuf;
+ }
}
clock_map_place_locations (this);