static void phidias_items_geo_set_model (PhidiasItemsViewer *self, GtkTreeModel *items) { ChamplainView *view; PhidiasItemsGeo *geo; geo = PHIDIAS_ITEMS_GEO (self); if (geo->priv->tree_model != NULL) { g_signal_handler_disconnect (geo->priv->tree_model, geo->priv->signals [0]); g_signal_handler_disconnect (geo->priv->tree_model, geo->priv->signals [1]); } view = gtk_champlain_embed_get_view (GTK_CHAMPLAIN_EMBED (geo)); g_hash_table_foreach_remove (geo->priv->markers, remove_marker, geo->priv->current_layer); if (items == NULL) return; /** TODO This has to be done in a idle() callback */ gtk_tree_model_foreach (items, add_marker, geo); clutter_actor_show (CLUTTER_ACTOR (geo->priv->current_layer)); champlain_marker_layer_show_all_markers (geo->priv->current_layer); champlain_marker_layer_animate_in_all_markers (geo->priv->current_layer); geo->priv->tree_model = items; geo->priv->signals [0] = g_signal_connect (items, "row-deleted", G_CALLBACK (item_deleted_cb), geo); geo->priv->signals [1] = g_signal_connect (items, "row-inserted", G_CALLBACK (item_added_cb), geo); }
void gourmap_ui_update_map (GourmapUi *ui, const double my_lat, const double my_lng, const double center_lat, const double center_lng, GList *poi_list) { GourmapUiPrivate *priv = GET_PRIVATE (ui); ClutterActor *marker; ClutterColor *color; Restaurant *rest; GList *list_i; /* remove previous markers */ champlain_marker_layer_remove_all (priv->marker_layer); champlain_view_set_zoom_level (priv->champ_view, priv->zoom); champlain_view_go_to (priv->champ_view, my_lat, my_lng); color = clutter_color_new (0xff, 0x20, 0x15, 0xbb); marker = champlain_label_new_with_text (_("I'm here"), "Serif 14", NULL, color); clutter_color_free (color); champlain_location_set_location (CHAMPLAIN_LOCATION (marker), my_lat, my_lng); champlain_marker_layer_add_marker (priv->marker_layer, CHAMPLAIN_MARKER (marker)); /* Put restaurant markers */ list_i = poi_list; color = clutter_color_new (0xff, 0x20, 0xff, 0xbb); while (list_i != NULL) { rest = (Restaurant *)list_i->data; marker = champlain_label_new_with_text (rest->name, "Serif 10", NULL, color); champlain_location_set_location (CHAMPLAIN_LOCATION (marker), rest->latitude, rest->longitude); champlain_marker_layer_add_marker (priv->marker_layer, CHAMPLAIN_MARKER (marker)); list_i = g_list_next (list_i); } clutter_color_free (color); champlain_marker_layer_show_all_markers (priv->marker_layer); }