]> err.no Git - libchamplain/commitdiff
Don't use Gtk2 as Champlain is now a Clutter only library
authorEmmanuel Rodriguez <emmanuel.rodriguez@booking.com>
Tue, 15 Sep 2009 19:53:38 +0000 (21:53 +0200)
committerPierre-Luc Beaudoin <pierre-luc@pierlux.com>
Mon, 21 Sep 2009 16:19:44 +0000 (12:19 -0400)
bindings/perl/Champlain/examples/capitals.pl
bindings/perl/Champlain/examples/flickr.pl
bindings/perl/Champlain/examples/image.pl

index 6cc17dd23afd8098cb93bc6ee15d2c780c561a45..8ab6da01db2f65e94e26b3a74aee0d250421eaa7 100755 (executable)
@@ -16,8 +16,7 @@ use warnings;
 use open ':std', ':utf8';
 
 use Glib qw(TRUE FALSE);
-use Clutter qw(-gtk-init);
-use Gtk2 qw(-init);
+use Clutter qw(-threads-init -init);
 use Champlain;
 
 use XML::LibXML;
@@ -28,33 +27,19 @@ exit main();
 
 sub main {
 
-       my $window = Gtk2::Window->new();
-       my $vbox = Gtk2::VBox->new(FALSE, 0);
-       
-       
+       my $stage = Clutter::Stage->get_default();
+       $stage->set_size(800, 600);
+
        # Create the map stuff
-       my $gtk2_map = Gtk2::ChamplainEmbed->new();
-       my $map = $gtk2_map->get_view();
-       $gtk2_map->set_size_request(640, 480);
+       my $map = Champlain::View->new();
        $map->center_on(0, 0);
        $map->set_scroll_mode('kinetic');
        $map->set_zoom_level(3);
        
        my $layer = Champlain::Layer->new();
        $map->add_layer($layer);
-       
-       
-       my $viewport = Gtk2::Viewport->new();
-       $viewport->set_shadow_type('etched-in');
-       $viewport->add($gtk2_map);
-       $vbox->pack_start($viewport, TRUE, TRUE, 0);
-       
-       $window->add($vbox);
-       $window->set_size_request($gtk2_map->get_size_request);
-       $window->signal_connect(destroy => sub {
-               Gtk2->main_quit();
-       });
-       $window->show_all();
+
+       $stage->show_all();
 
        
        my $capitals_url = "http://en.wikipedia.org/wiki/List_of_national_capitals";
@@ -78,7 +63,7 @@ sub main {
        $soup->do_get($capitals_url, \&capitals_main_callback, $data);
        
        
-       Gtk2->main();
+       Clutter->main();
        
        
        return 0;
index e72d07c31ff1b93189f8980a0005c28e4976a544..6e82229bbc1a3acba2983f975c871b614ddfe666 100755 (executable)
@@ -23,8 +23,7 @@ use warnings;
 use open ':std', ':utf8';
 
 use Glib qw(TRUE FALSE);
-use Clutter qw(-gtk-init);
-use Gtk2 qw(-init);
+use Clutter qw(-threads-init -init);
 use Champlain;
 use XML::LibXML;
 use Carp;
@@ -45,38 +44,26 @@ sub main {
 
        local $| = 1;
 
-       my $window = Gtk2::Window->new();
-       $window->set_border_width(10);
-       $window->set_title("Champlain + Flickr - Demo");
-       $window->signal_connect('destroy' => sub { Gtk2->main_quit() });
-
-       my $vbox = Gtk2::VBox->new(FALSE, 10);
+       my $stage = Clutter::Stage->get_default();
+       $stage->set_size(800, 600);
 
        # Create the map view
-       my $gtk2_map = Gtk2::ChamplainEmbed->new();
-       my $map = $gtk2_map->get_view();
+       my $map = Champlain::View->new();
        $map->center_on(47.130885, -70.764141);
        $map->set_scroll_mode('kinetic');
        $map->set_zoom_level(5);
-       $gtk2_map->set_size_request(640, 480);
+       $map->set_size(640, 480);
 
        # Create the markers and marker layer
        my $layer = Champlain::Layer->new();
        $layer->show();
        $map->add_layer($layer);
-       
+
        $LABEL = make_label();
        $LABEL->hide();
        $map->add($LABEL);
 
-       my $viewport = Gtk2::Viewport->new();
-       $viewport->set_shadow_type('etched-in');
-       $viewport->add($gtk2_map);
-
-       $vbox->add($viewport);
-
-       $window->add($vbox);
-       $window->show_all();
+       $stage->show_all();
 
        my $icon = Clutter::Texture->new(
                File::Spec->catfile($FindBin::Bin, 'images', 'flickr.png')
@@ -91,7 +78,7 @@ sub main {
        };
        $map->signal_connect_after("button-release-event", \&flickr_search, $data);
 
-       Gtk2->main();
+       Clutter->main();
 
        return 0;
 }
@@ -276,7 +263,7 @@ sub flickr_download_photo_callback {
 sub make_label {
 
        my $black = Clutter::Color->new(0x00, 0x00, 0x00, 0xff);
-       my $button_text = Clutter::Label->new("Sans 16", '', $black);
+       my $button_text = Clutter::Text->new("Sans 16", '', $black);
        $button_text->set_position(10, 10);
 
        return $button_text;
index 9671743402e0a34f7a6dfa4409acb67334f6e981..0f85120f49dca1691e9e4f18c2342f53af94c231 100755 (executable)
@@ -15,7 +15,7 @@ use strict;
 use warnings;
 
 use Glib qw(TRUE FALSE);
-use Clutter qw(-gtk-init);
+use Clutter qw(-threads-init -init);
 use Gtk2 qw(-init);
 use Champlain;
 use LWP::UserAgent;
@@ -23,37 +23,24 @@ use LWP::UserAgent;
 exit main();
 
 sub main {
-       
-       my $window = Gtk2::Window->new();
-       $window->set_border_width(10);
-       $window->set_title("Champlain - Demo");
-       $window->signal_connect('destroy' => sub { Gtk2->main_quit() });
-       
-       my $vbox = Gtk2::VBox->new(FALSE, 10);  
+
+       my $stage = Clutter::Stage->get_default();
+       $stage->set_size(800, 600);
 
        # Create the map view
-       my $gtk2_map = Gtk2::ChamplainEmbed->new();
-       my $map = $gtk2_map->get_view();
+       my $map = Champlain::View->new();
        $map->center_on(47.130885, -70.764141);
        $map->set_scroll_mode('kinetic');
        $map->set_zoom_level(5);
-       $gtk2_map->set_size_request(640, 480);
-       
+
        # Create the markers and marker layer
        my $layer = create_marker_layer($map);
        $map->add_layer($layer);
-       
-       my $viewport = Gtk2::Viewport->new();
-       $viewport->set_shadow_type('etched-in');
-       $viewport->add($gtk2_map);
-
-       $vbox->add($viewport);
-
-       $window->add($vbox);
-       $window->show_all();
-       
-       Gtk2->main();
-       
+
+       $stage->show_all();
+
+       Clutter->main();
+
        return 0;
 }