]> err.no Git - libchamplain/commitdiff
Use the API of 3.3
authorEmmanuel Rodriguez <emmanuel.rodriguez@gmail.com>
Sun, 14 Jun 2009 14:02:22 +0000 (16:02 +0200)
committerPierre-Luc Beaudoin <pierre-luc@pierlux.com>
Sun, 14 Jun 2009 15:11:18 +0000 (11:11 -0400)
bindings/perl/Champlain/examples/capitals.pl
bindings/perl/Champlain/examples/gtk2.pl
bindings/perl/Champlain/examples/image.pl

index 1a7f7edebb539412a239f328aa5b81aaf736df8e..6cc17dd23afd8098cb93bc6ee15d2c780c561a45 100755 (executable)
@@ -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');
index d146055b5d56e44f86099d3f51b0125710b6b37f..dc8161786259e3ff62c0ca090db7a05be0ef968f 100755 (executable)
@@ -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;
                }
                
index c66310668d007ade8956807d8e84646b7bb8f71d..9671743402e0a34f7a6dfa4409acb67334f6e981 100755 (executable)
@@ -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