|
27 | 27 | }; |
28 | 28 |
|
29 | 29 | static char *marker_files[MARKER_NB] = { |
30 | | - ICONDIR "/clock-map-location-marker.png", |
31 | | - ICONDIR "/clock-map-location-hilight.png", |
32 | | - ICONDIR "/clock-map-location-current.png" |
| 30 | + "clock-map-location-marker.png", |
| 31 | + "clock-map-location-hilight.png", |
| 32 | + "clock-map-location-current.png" |
33 | 33 | }; |
34 | 34 |
|
35 | 35 | static guint signals[LAST_SIGNAL] = { 0 }; |
@@ -135,8 +135,17 @@ clock_map_init (ClockMap *this) |
135 | 135 | g_assert (sizeof (marker_files)/sizeof (char *) == MARKER_NB); |
136 | 136 |
|
137 | 137 | for (i = 0; i < MARKER_NB; i++) { |
138 | | - priv->location_marker_pixbuf[i] = gdk_pixbuf_new_from_file |
139 | | - (marker_files[i], NULL); |
| 138 | + char *resource; |
| 139 | + GInputStream *stream; |
| 140 | + |
| 141 | + resource = g_strconcat (CLOCK_RESOURCE_PATH "icons/", marker_files[i], NULL); |
| 142 | + stream = g_resources_open_stream (resource, 0, NULL); |
| 143 | + g_free (resource); |
| 144 | + |
| 145 | + if (stream != NULL) { |
| 146 | + priv->location_marker_pixbuf[i] = gdk_pixbuf_new_from_stream (stream, NULL, NULL); |
| 147 | + g_object_unref (stream); |
| 148 | + } |
140 | 149 | } |
141 | 150 | } |
142 | 151 |
|
@@ -208,11 +217,17 @@ clock_map_refresh (ClockMap *this) |
208 | 217 | } |
209 | 218 |
|
210 | 219 | if (!priv->stock_map_pixbuf) { |
211 | | - GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file_at_scale |
212 | | - (ICONDIR "/clock-map.png", |
213 | | - priv->width, priv->height, FALSE, NULL); |
214 | | - |
215 | | - priv->stock_map_pixbuf = pixbuf; |
| 220 | + GInputStream *stream = g_resources_open_stream (CLOCK_RESOURCE_PATH "icons/clock-map.png", |
| 221 | + 0, NULL); |
| 222 | + if (stream != NULL) { |
| 223 | + GdkPixbuf *pixbuf = gdk_pixbuf_new_from_stream_at_scale (stream, |
| 224 | + priv->width, priv->height, |
| 225 | + FALSE, |
| 226 | + NULL, NULL); |
| 227 | + g_object_unref (stream); |
| 228 | + |
| 229 | + priv->stock_map_pixbuf = pixbuf; |
| 230 | + } |
216 | 231 | } |
217 | 232 |
|
218 | 233 | clock_map_place_locations (this); |
|
0 commit comments