From: Kaj-Michael Lang Date: Wed, 7 May 2008 08:08:26 +0000 (+0300) Subject: Widget tester: X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c13efd8d212ce13619139989b7a16b763bcff36e;p=mapper Widget tester: - Connect signals last - Set default zoom after signal connection so the zoomer is set --- diff --git a/src/map-widget-test.c b/src/map-widget-test.c index d2f1f38..9d02ccb 100644 --- a/src/map-widget-test.c +++ b/src/map-widget-test.c @@ -21,7 +21,7 @@ map_zoom_changed(GtkWidget *widget, gint zoom, gpointer data) GtkWidget *zoomer=(GtkWidget *)data; gtk_range_set_value(GTK_RANGE(zoomer), zoom); -return TRUE; +return; } static gboolean @@ -75,12 +75,10 @@ vbox=gtk_vbox_new(FALSE, 3); map=gtk_map_new(); gtk_map_set_tile_repository(map, rd); +gtk_map_set_center_latlon(map, 64.25, 22.00); gtk_box_pack_start(GTK_BOX(hbox), map, TRUE, TRUE, 0); zoomer=gtk_vscale_new_with_range(0,17,1); -g_signal_connect(G_OBJECT(zoomer), "value-changed", G_CALLBACK(map_zoom), NULL); -g_signal_connect(G_OBJECT(map), "zoom-changed", G_CALLBACK(map_zoom_changed), zoomer); - gtk_box_pack_start(GTK_BOX(hbox), zoomer, FALSE, FALSE, 0); btn_left=gtk_button_new_with_label("L"); @@ -88,20 +86,24 @@ btn_right=gtk_button_new_with_label("R"); btn_up=gtk_button_new_with_label("U"); btn_down=gtk_button_new_with_label("D"); -g_signal_connect(G_OBJECT(btn_up), "clicked", G_CALLBACK(map_pan_up), NULL); -g_signal_connect(G_OBJECT(btn_down), "clicked", G_CALLBACK(map_pan_down), NULL); -g_signal_connect(G_OBJECT(btn_left), "clicked", G_CALLBACK(map_pan_left), NULL); -g_signal_connect(G_OBJECT(btn_right), "clicked", G_CALLBACK(map_pan_right), NULL); - gtk_box_pack_start(GTK_BOX(vbox), btn_left, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), btn_right, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), btn_up, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), btn_down, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(dialog->vbox), hbox, TRUE, TRUE, 0); +g_signal_connect(G_OBJECT(zoomer), "value-changed", G_CALLBACK(map_zoom), NULL); +g_signal_connect(G_OBJECT(map), "zoom-changed", G_CALLBACK(map_zoom_changed), zoomer); + +g_signal_connect(G_OBJECT(btn_up), "clicked", G_CALLBACK(map_pan_up), NULL); +g_signal_connect(G_OBJECT(btn_down), "clicked", G_CALLBACK(map_pan_down), NULL); +g_signal_connect(G_OBJECT(btn_left), "clicked", G_CALLBACK(map_pan_left), NULL); +g_signal_connect(G_OBJECT(btn_right), "clicked", G_CALLBACK(map_pan_right), NULL); + +gtk_map_set_zoom(map, 12); + gtk_widget_show_all(GTK_WIDGET(dialog)); gtk_dialog_run(dialog);