[libchamplain: 10/39] Don't use Gtk2 as Champlain is now a Clutter only library



commit e43ec5725f68122ad7ae08062e9c7a3a563c88b9
Author: Emmanuel Rodriguez <emmanuel rodriguez booking com>
Date:   Tue Sep 15 21:53:38 2009 +0200

    Don't use Gtk2 as Champlain is now a Clutter only library

 bindings/perl/Champlain/examples/capitals.pl |   31 ++++++-----------------
 bindings/perl/Champlain/examples/flickr.pl   |   31 ++++++----------------
 bindings/perl/Champlain/examples/image.pl    |   35 ++++++++-----------------
 3 files changed, 28 insertions(+), 69 deletions(-)
---
diff --git a/bindings/perl/Champlain/examples/capitals.pl b/bindings/perl/Champlain/examples/capitals.pl
index 6cc17dd..8ab6da0 100755
--- a/bindings/perl/Champlain/examples/capitals.pl
+++ b/bindings/perl/Champlain/examples/capitals.pl
@@ -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;
diff --git a/bindings/perl/Champlain/examples/flickr.pl b/bindings/perl/Champlain/examples/flickr.pl
index e72d07c..6e82229 100755
--- a/bindings/perl/Champlain/examples/flickr.pl
+++ b/bindings/perl/Champlain/examples/flickr.pl
@@ -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;
diff --git a/bindings/perl/Champlain/examples/image.pl b/bindings/perl/Champlain/examples/image.pl
index 9671743..0f85120 100755
--- a/bindings/perl/Champlain/examples/image.pl
+++ b/bindings/perl/Champlain/examples/image.pl
@@ -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;
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]