]> err.no Git - mapper/commitdiff
Widget tester:
authorKaj-Michael Lang <milang@tal.org>
Wed, 7 May 2008 08:08:26 +0000 (11:08 +0300)
committerKaj-Michael Lang <milang@tal.org>
Wed, 7 May 2008 08:08:26 +0000 (11:08 +0300)
- Connect signals last
- Set default zoom after signal connection so the zoomer is set

src/map-widget-test.c

index d2f1f382ca6681fb32e18a9a2e47495c22db2b98..9d02ccbba8a9c97de2a1d2b7b83a13a050a6121c 100644 (file)
@@ -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);