Commit 1c41224c authored by Jonas Danielsson's avatar Jonas Danielsson

Add autoreload of stylesheet

parent 881a090b
......@@ -116,13 +116,34 @@ maps_mapbox_renderer_set_view (MapsMapboxRenderer *renderer,
champlain_view_add_layer (view, (ChamplainLayer *) renderer->priv->layer);
}
static void
on_stylesheet_changed (GFileMonitor *monitor,
GFile *file,
GFile *other_file,
GFileMonitorEvent event_type,
VTileMapCSS *stylesheet)
{
if (event_type == G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT)
vtile_mapcss_load (stylesheet, g_file_get_path (file), NULL);
}
void
maps_mapbox_renderer_load_css (MapsMapboxRenderer *renderer,
const char *filename,
GError **error)
{
GFile *file;
GFileMonitor *monitor;
renderer->priv->stylesheet = vtile_mapcss_new ();
vtile_mapcss_load (renderer->priv->stylesheet, filename, error);
file = g_file_new_for_path (filename);
monitor = g_file_monitor_file (file, G_FILE_MONITOR_NONE, NULL, NULL);
g_signal_connect (monitor, "changed",
G_CALLBACK (on_stylesheet_changed),
renderer->priv->stylesheet);
}
static void
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment