]> err.no Git - mapper/commitdiff
Make quick POI work. Bit of a hack with the lat,lon but.. I don't care right now.
authorKaj-Michael Lang <milang@angel.tal.org>
Fri, 19 Oct 2007 11:31:30 +0000 (14:31 +0300)
committerKaj-Michael Lang <milang@angel.tal.org>
Fri, 19 Oct 2007 11:31:30 +0000 (14:31 +0300)
src/poi-gui.c

index 4a6b76f99e260790093d50e32715e5359191e492..167695ad3c105a6f18fa32677aaf8b01ef3b836b 100644 (file)
@@ -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));
        }
 }