/**
* gtk_map_add_path:
* @path: A path object to add to the map
+ * @current: Is this the current track ?
*
* Adds a new path to the map.
*/
gboolean
-gtk_map_add_path(GtkWidget *widget, Path *path)
+gtk_map_add_path(GtkWidget *widget, Path *path, gboolean current)
{
GtkMap *map;
GtkMapPriv *priv;
priv=GTK_MAP_GET_PRIVATE(map);
/* Don't allow duplicates */
-if (g_slist_find(priv->paths, path)!=NULL)
+if (g_slist_find(priv->paths, path)!=NULL) {
+ g_debug("Tried to add duplicate path!");
return FALSE;
+}
g_object_ref(path);
priv->paths=g_slist_append(priv->paths, path);
+if (current==TRUE)
+ priv->current_track=path;
+gtk_map_refresh(widget);
+return TRUE;
+}
+
+/**
+ * gtk_map_set_current_track:
+ * @path:
+ *
+ * Toggle if given path is current track
+ */
+gboolean
+gtk_map_toggle_current_track(GtkWidget *widget, Path *path, gboolean current)
+{
+GtkMap *map;
+GtkMapPriv *priv;
+
+g_return_val_if_fail(GTK_IS_MAP(widget), FALSE);
+g_return_val_if_fail(path, FALSE);
+
+map=GTK_MAP(widget);
+priv=GTK_MAP_GET_PRIVATE(map);
+
+if (g_slist_find(priv->paths, path)==NULL)
+ return FALSE;
+
+priv->current_track=current==TRUE ? path : NULL;
+
+return TRUE;
+}
+
+/**
+ * gtk_map_set_current_route:
+ * @path:
+ *
+ * Toggle if given path is current route
+ */
+gboolean
+gtk_map_toggle_current_route(GtkWidget *widget, Path *path, gboolean current)
+{
+GtkMap *map;
+GtkMapPriv *priv;
+
+g_return_val_if_fail(GTK_IS_MAP(widget), FALSE);
+g_return_val_if_fail(path, FALSE);
+
+map=GTK_MAP(widget);
+priv=GTK_MAP_GET_PRIVATE(map);
+
+if (g_slist_find(priv->paths, path)==NULL)
+ return FALSE;
+
+priv->current_route=current==TRUE ? path : NULL;
+
return TRUE;
}
map=GTK_MAP(widget);
priv=GTK_MAP_GET_PRIVATE(map);
-if (g_slist_find(priv->paths, path)==NULL)
+if (g_slist_find(priv->paths, path)==NULL) {
+ g_debug("Path is not on map");
return FALSE;
+}
+
priv->paths=g_slist_remove(priv->paths, path);
+
+if (priv->current_track==path)
+ priv->current_track=NULL;
+
+if (priv->current_route==path)
+ priv->current_route=NULL;
+
g_object_unref(path);
+gtk_map_refresh(widget);
return TRUE;
}
omode=priv->center_mode;
/* If we have a track, then we can center on it */
-if (priv->current_track) {
+if (priv->current_track && mode!=CENTER_MANUAL) {
priv->center_mode=mode;
if (omode!=mode)
g_signal_emit(widget, gtk_map_signals[MAP_CENTER_MODE_CHANGED], 0, NULL);
gboolean gtk_map_markers_remove(GtkWidget *map, GtkMapMarkerType type, GtkListStore *store);
/* Paths */
-gboolean gtk_map_add_path(GtkWidget *map, Path *path);
+gboolean gtk_map_add_path(GtkWidget *map, Path *path, gboolean current);
gboolean gtk_map_remove_path(GtkWidget *map, Path *path);
-gboolean gtk_map_remove_path_by_id(GtkWidget *map, gint path_id);
+gboolean gtk_map_toggle_current_track(GtkWidget *widget, Path *path, gboolean current);
void gtk_map_set_path_display(GtkWidget *widget, gint path_mask);
/* Get copy of map back buffer */