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); }
/** * Go to the specified placemark */ static void go_cb (GtkAction *action, PlacemarksPlugin *plugin) { GtkTreeIter iter; PlacemarksPluginPrivate *priv; const gchar *id; gboolean found = FALSE; GtkTreeIter found_iter; gfloat lat, lon; gint zoom; priv = PLACEMARKS_PLUGIN (plugin)->priv; id = gtk_action_get_name (action); gtk_tree_model_get_iter_first (priv->model, &iter); do { gchar *vid; gtk_tree_model_get (priv->model, &iter, COL_ID, &vid, -1); if (strcmp (id, vid) == 0) { found = TRUE; found_iter = iter; } g_free (vid); } while (gtk_tree_model_iter_next (priv->model, &iter) && !found); if (!found) return; gtk_tree_model_get (priv->model, &found_iter, COL_LAT, &lat, COL_LON, &lon, COL_ZOOM, &zoom, -1); champlain_view_set_zoom_level (priv->map_view, zoom); champlain_view_center_on (priv->map_view, lat, lon); }