]> err.no Git - mapper/commitdiff
Map widget:
authorKaj-Michael Lang <milang@tal.org>
Tue, 6 May 2008 13:52:05 +0000 (16:52 +0300)
committerKaj-Michael Lang <milang@tal.org>
Tue, 6 May 2008 13:52:05 +0000 (16:52 +0300)
- Add methods to add and remove paths

src/gtkmap.c
src/gtkmap.h

index 2e59188d24f33f7cd9689d67861fee4e48e93aaf..f8db4cbe76f10146333e46d4b194991185bf1150 100644 (file)
@@ -811,6 +811,39 @@ for (iter=priv->paths; iter!=NULL; iter=iter->next) {
 }
 }
 
+gboolean
+gtk_map_add_path(GtkWidget *widget, Path *path)
+{
+GtkMap *map;
+GtkMapPriv *priv;
+
+g_return_if_fail(GTK_IS_MAP(widget));
+g_return_if_fail(path);
+
+map=GTK_MAP(widget);
+priv=GTK_MAP_GET_PRIVATE(map);
+
+/* Don't allow duplicates */
+if (g_slist_find(priv->paths, path)!=NULL)
+       return FALSE;
+priv->paths=g_slist_append(priv->paths, path);
+return TRUE;
+}
+
+gboolean
+gtk_map_remove_path(GtkWidget *widget, Path *path)
+{
+GtkMap *map;
+GtkMapPriv *priv;
+
+g_return_if_fail(GTK_IS_MAP(widget));
+g_return_if_fail(path);
+
+map=GTK_MAP(widget);
+priv=GTK_MAP_GET_PRIVATE(map);
+priv->paths=g_slist_remove(priv->paths, path);
+}
+
 static void 
 gtk_map_mark_draw(GtkWidget *widget, GdkEventExpose *event)
 {
index 958f3ff9e33ceda7fd984568f65bb1795599c978..b9729a22142a00679f35108a6a3724d260b2e6b8 100644 (file)
@@ -73,9 +73,9 @@ void gtk_map_set_mark(GtkWidget *map);
 void gtk_map_move_mark(GtkWidget *map);
 
 /* Path functions */
-void gtk_map_set_path(GtkWidget *map, Path *path, PathType type, gint id);
+gboolean gtk_map_add_path(GtkWidget *map, Path *path);
 gboolean gtk_map_remove_path(GtkWidget *map, Path *path);
-gboolean gtk_map_remove_path_by_id(GtkWidget *map, gint id);
+gboolean gtk_map_remove_path_by_id(GtkWidget *map, gint path_id);
 
 /* Get copy of map buffer */
 GdkPixmap *gtk_map_pixmap_get(GtkWidget *map);