From dfabf7972529a1c2407409f34ca58f101829e34b Mon Sep 17 00:00:00 2001 From: Kaj-Michael Lang Date: Fri, 19 Oct 2007 14:31:30 +0300 Subject: [PATCH] Make quick POI work. Bit of a hack with the lat,lon but.. I don't care right now. --- src/poi-gui.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/poi-gui.c b/src/poi-gui.c index 4a6b76f..167695a 100644 --- a/src/poi-gui.c +++ b/src/poi-gui.c @@ -57,6 +57,8 @@ static struct _quick_poi_categories quick_poi_categories[] = { { NODE_AMENITY_ATM, "ATM", }, }; +/* Argh... */ +static gdouble qp_lat, qp_lon; static gboolean category_delete(GtkWidget *widget, delete_poi *dpoi) @@ -733,7 +735,18 @@ return TRUE; static gboolean poi_quick_button_cb(GtkWidget *w, gpointer data) { +guint cat_id; gtk_widget_destroy(dialog_qp); + +cat_id=GPOINTER_TO_INT(data); + +/* poi_add frees the label and desc so strdup them */ +if (poi_add(qp_lat, qp_lon, cat_id, g_strdup("QP"), g_strdup("Quick POI, update information please."))==FALSE) { + popup_error(_window, _("Problem adding POI")); +} else { + map_render_data(); +} + return TRUE; } @@ -743,9 +756,8 @@ poi_quick_dialog(guint unitx, guint unity) GtkWidget *table; GtkWidget *buttons[POI_QUICK_BUTTONS]; guint x,y; -poi_info poi; -unit2latlon(unitx, unity, poi.lat, poi.lon); +unit2latlon(unitx, unity, qp_lat, qp_lon); dialog_qp = gtk_dialog_new_with_buttons(_("Quick POI"), GTK_WINDOW(_window), @@ -767,11 +779,8 @@ gtk_table_set_homogeneous(GTK_TABLE(table), TRUE); for (x=1;x<=3;x++) { for (y=1;y<=3;y++) { - gchar *btnlabel; - buttons[x*y]=gtk_button_new_with_label(quick_poi_categories[x*y-1].name); gtk_table_attach(GTK_TABLE(table), buttons[x*y], x-1, x, y-1, y, GTK_FILL, 0, 2, 4); - g_free(btnlabel); g_signal_connect(G_OBJECT(buttons[x*y]), "clicked", G_CALLBACK(poi_quick_button_cb), GINT_TO_POINTER(quick_poi_categories[x*y-1].type)); } } -- 2.39.5