From: Emmanuel Rodriguez Date: Sun, 14 Jun 2009 14:02:22 +0000 (+0200) Subject: Use the API of 3.3 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d828b016efcb3dee52a75d9795c43e34a126cdb3;p=libchamplain Use the API of 3.3 --- diff --git a/bindings/perl/Champlain/examples/capitals.pl b/bindings/perl/Champlain/examples/capitals.pl index 1a7f7ed..6cc17dd 100755 --- a/bindings/perl/Champlain/examples/capitals.pl +++ b/bindings/perl/Champlain/examples/capitals.pl @@ -33,8 +33,8 @@ sub main { # Create the map stuff - my $map = Champlain::View->new(); - my $gtk2_map = Gtk2::Champlain::ViewEmbed->new($map); + my $gtk2_map = Gtk2::ChamplainEmbed->new(); + my $map = $gtk2_map->get_view(); $gtk2_map->set_size_request(640, 480); $map->center_on(0, 0); $map->set_scroll_mode('kinetic'); diff --git a/bindings/perl/Champlain/examples/gtk2.pl b/bindings/perl/Champlain/examples/gtk2.pl index d146055..dc81617 100755 --- a/bindings/perl/Champlain/examples/gtk2.pl +++ b/bindings/perl/Champlain/examples/gtk2.pl @@ -23,8 +23,8 @@ sub main { my $vbox = Gtk2::VBox->new(FALSE, 10); # Create the map view - my $map = Champlain::View->new(); - my $gtk2_map = Gtk2::Champlain::ViewEmbed->new($map); + my $gtk2_map = Gtk2::ChamplainEmbed->new(); + my $map = $gtk2_map->get_view(); $map->set_scroll_mode('kinetic'); $map->set_zoom_level(5); $gtk2_map->set_size_request(640, 480); @@ -74,14 +74,13 @@ sub main { $map->set_zoom_level($spin->get_value_as_int); }); $map->signal_connect('notify::zoom-level', sub { - $spin->set_value($map->get('zoom-level')); + $spin->set_value($map->get_zoom_level); }); $toolbox->add($spin); my $image = Gtk2::Image->new_from_stock('gtk-network', 'button'); $map->signal_connect('notify::state', sub { - my $state = $map->get('state'); - if ($state eq 'loading') { + if ($map->get_state eq 'loading') { $image->show(); } else { @@ -120,20 +119,19 @@ sub create_combo_box { my $model = Gtk2::ListStore->new( 'Glib::String', 'Glib::String', - #'Champlain::MapSourceDesc', doesn't work as it's not are registered type ); my $active = 0; # Tells which map source is active my $index = 0; - my $current_source = $map->get('map-source')->get_id; + my $current_source = $map->get_map_source->get_id; my $factory = Champlain::MapSourceFactory->dup_default; - foreach my $desc (sort { $a->{name} cmp $b->{name} } $factory->get_list) { + foreach my $desc (sort { $a->get_name cmp $b->get_name } $factory->dup_list) { my $iter = $model->append(); $model->set($iter, - 0, $desc->{name}, - 1, $desc->{id}, + 0, $desc->get_name, + 1, $desc->get_id, ); - if ($current_source eq $desc->{id}) { + if ($current_source eq $desc->get_id) { $active = $index; } diff --git a/bindings/perl/Champlain/examples/image.pl b/bindings/perl/Champlain/examples/image.pl index c663106..9671743 100755 --- a/bindings/perl/Champlain/examples/image.pl +++ b/bindings/perl/Champlain/examples/image.pl @@ -32,11 +32,11 @@ sub main { my $vbox = Gtk2::VBox->new(FALSE, 10); # Create the map view - my $map = Champlain::View->new(); + my $gtk2_map = Gtk2::ChamplainEmbed->new(); + my $map = $gtk2_map->get_view(); $map->center_on(47.130885, -70.764141); $map->set_scroll_mode('kinetic'); $map->set_zoom_level(5); - my $gtk2_map = Gtk2::Champlain::ViewEmbed->new($map); $gtk2_map->set_size_request(640, 480); # Create the markers and marker layer