iPDC-suite/iPDC/utility_tools.c

47 lines
1.5 KiB
C
Raw Normal View History

#include<gtk/gtk.h>
2022-09-24 14:25:37 +05:30
#include "utility_tools.h"
2022-08-23 22:04:29 +05:30
#define UI_fILE "./utility_tools.ui"
2022-09-24 14:25:37 +05:30
// void change_image(OsmGpsMap *map, float lat, float lon, OsmGpsMapImage *image)
// {
// if (g_last_image)
// osm_gps_map_image_remove(map, g_last_image);
// osm_gps_map_image_add(map, lat, lon, image);
// }
2022-08-23 13:05:44 +05:30
void utility_tools(GtkButton *but, gpointer udata)
{
2022-08-23 22:04:29 +05:30
GtkBuilder *builder;
GError *error = NULL;
builder = gtk_builder_new();
if(!gtk_builder_add_from_file(builder, UI_fILE, &error))
{
g_warning("%s", error->message);
g_free(error);
}
2022-09-24 14:25:37 +05:30
window = GTK_WIDGET(gtk_builder_get_object(builder, "util_window"));
2022-08-23 22:04:29 +05:30
GtkContainer *map_container = GTK_CONTAINER(gtk_builder_get_object(builder, "map_layout"));
2022-09-24 14:25:37 +05:30
util_map = g_object_new (OSM_TYPE_GPS_MAP,
"map-source", OSM_GPS_MAP_SOURCE_GOOGLE_HYBRID,
2022-08-23 22:04:29 +05:30
"tile-cache", "/tmp/",
NULL);
2022-09-24 14:25:37 +05:30
osm_gps_map_set_center_and_zoom (util_map, 15.4589, 75.0078, 10);
g_red_image = gdk_pixbuf_new_from_file_at_size ("red.png", 24,24,NULL);
g_green_image = gdk_pixbuf_new_from_file_at_size ("green.png", 24,24,NULL);
// g_last_image = osm_gps_map_image_add(util_map,15.4589, 75.0078, g_red_image);
// g_last_image = osm_gps_map_image_add(util_map,15.518597, 74.925584, g_green_image);
gtk_widget_set_size_request(GTK_WIDGET(util_map), 600, 500);
2022-08-23 22:04:29 +05:30
2022-09-24 14:25:37 +05:30
gtk_container_add(map_container, GTK_WIDGET(util_map));
2022-08-23 22:04:29 +05:30
gtk_widget_show_all(window);
gtk_main();
}