From 86d74620e2bb7877b1963be95977a9b4f63f3b3e Mon Sep 17 00:00:00 2001 From: Emmanuel Rodriguez Date: Tue, 15 Sep 2009 20:26:25 +0200 Subject: [PATCH] The Perl bindings for champlain-gtk will be in a different package --- bindings/perl/Champlain/Makefile.PL | 21 +- bindings/perl/Champlain/champlain-perl.h | 7 - bindings/perl/Champlain/examples/gtk2.pl | 208 ------------------ bindings/perl/Champlain/maps-gtk | 1 - .../perl/Champlain/t/Gtk2ChamplainEmbed.t | 27 --- .../perl/Champlain/xs/Gtk2ChamplainEmbed.xs | 13 -- 6 files changed, 3 insertions(+), 274 deletions(-) delete mode 100755 bindings/perl/Champlain/examples/gtk2.pl delete mode 100644 bindings/perl/Champlain/maps-gtk delete mode 100644 bindings/perl/Champlain/t/Gtk2ChamplainEmbed.t delete mode 100644 bindings/perl/Champlain/xs/Gtk2ChamplainEmbed.xs diff --git a/bindings/perl/Champlain/Makefile.PL b/bindings/perl/Champlain/Makefile.PL index 09e95c5..bf4c9e3 100644 --- a/bindings/perl/Champlain/Makefile.PL +++ b/bindings/perl/Champlain/Makefile.PL @@ -6,7 +6,7 @@ use ExtUtils::MakeMaker; use Cwd; use File::Spec; -use Gtk2::CodeGen; +use Glib::CodeGen; use Glib::MakeHelper; use ExtUtils::Depends; use ExtUtils::PkgConfig; @@ -41,21 +41,6 @@ sub main { return; } - # If libchamplain-gtk is installed the GTK bindings will be generated - eval { - my %conf = ExtUtils::PkgConfig->find("champlain-gtk-$champlain_version"); - $pkgconfig{cflags} .= $conf{cflags} . ' -DCHAMPLAINPERL_GTK'; - $pkgconfig{libs} .= $conf{libs}; - - # All XS files that start with Gtk2Champlain are for libchamplain-gtk - push @XS_FILES, ; - push @typemaps, 'maps-gtk'; - push @deps, 'Gtk2'; - }; - if (my $error = $@) { - warn "Ignoring the Gtk2 bindings ($error)"; - } - $DEPENDS = ExtUtils::Depends->new('Champlain', @deps); $DEPENDS->add_pm( @@ -64,8 +49,8 @@ sub main { ); # Code generation - Gtk2::CodeGen->parse_maps('champlain', input => [ @typemaps ]); - Gtk2::CodeGen->write_boot(xs_files => [ @XS_FILES ]); + Glib::CodeGen->parse_maps('champlain', input => [ @typemaps ]); + Glib::CodeGen->write_boot(xs_files => [ @XS_FILES ]); $DEPENDS->set_inc($pkgconfig{cflags} . ' -I./build'); diff --git a/bindings/perl/Champlain/champlain-perl.h b/bindings/perl/Champlain/champlain-perl.h index b0c7d9e..41d29a3 100644 --- a/bindings/perl/Champlain/champlain-perl.h +++ b/bindings/perl/Champlain/champlain-perl.h @@ -2,15 +2,8 @@ #include - #include -#ifdef CHAMPLAINPERL_GTK -#include -#include -#endif - - #include "champlain-autogen.h" #endif /* _CHAMPLAIN_PERL_H_ */ diff --git a/bindings/perl/Champlain/examples/gtk2.pl b/bindings/perl/Champlain/examples/gtk2.pl deleted file mode 100755 index 4071d70..0000000 --- a/bindings/perl/Champlain/examples/gtk2.pl +++ /dev/null @@ -1,208 +0,0 @@ -#!/usr/bin/perl - -use strict; -use warnings; - -use Glib qw(TRUE FALSE); -use Clutter qw(-gtk-init); -use Gtk2 qw(-init); -use Gtk2::SimpleList; -use Champlain; - - -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); - - # Create the map view - 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); - - # Create the markers and marker layer - my $layer = create_marker_layer($map); - $map->add_layer($layer); - - - ## - # Create the top toolbar - my $toolbox = Gtk2::HBox->new(FALSE, 10); - - my $child = Gtk2::Button->new_from_stock('gtk-zoom-in'); - $child->signal_connect('clicked', sub { - $map->zoom_in(); - }); - $toolbox->add($child); - - $child = Gtk2::Button->new_from_stock('gtk-zoom-out'); - $child->signal_connect('clicked', sub { - $map->zoom_out(); - }); - $toolbox->add($child); - - $child = Gtk2::Button->new_from_stock('gtk-home'); - $child->signal_connect('clicked', sub { - $map->go_to(48.218611, 17.146397); - }); - $toolbox->add($child); - - $child = Gtk2::ToggleButton->new_with_label("Markers"); - $child->signal_connect('toggled', sub { - if ($layer->get('visible')) { - $layer->hide(); - } - else { - $layer->show_all(); - } - }); - $toolbox->add($child); - - $toolbox->add(create_combo_box($map)); - - my $spin = Gtk2::SpinButton->new_with_range(0, 20, 1); - $spin->set_value($map->get_zoom_level); - $spin->signal_connect('changed', sub { - $map->set_zoom_level($spin->get_value_as_int); - }); - $map->signal_connect('notify::zoom-level', sub { - $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') { - $image->show(); - } - else { - $image->hide(); - } - }); - $toolbox->pack_end($image, FALSE, FALSE, 0); - - - # Finish initializing the map view - $map->center_on(45.466, -73.75); - - - my $viewport = Gtk2::Viewport->new(); - $viewport->set_shadow_type('etched-in'); - $viewport->add($gtk2_map); - - $vbox->pack_start($toolbox, FALSE, FALSE, 0); - $vbox->add($viewport); - - $window->add($vbox); - $window->show_all(); - $image->hide(); - - Gtk2->main(); - - return 0; -} - - -sub create_combo_box { - my ($map) = @_; - - - # Create a simple list that will be used as the data model of the ComboBox - my $model = Gtk2::ListStore->new( - 'Glib::String', - 'Glib::String', - ); - my $active = 0; # Tells which map source is active - my $index = 0; - 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->dup_list) { - my $iter = $model->append(); - $model->set($iter, - 0, $desc->name, - 1, $desc->id, - ); - - if ($current_source eq $desc->id) { - $active = $index; - } - - ++$index; - } - - my $combo = Gtk2::ComboBox->new_text(); - $combo->set_model($model); - $combo->set_active($active); - - - $combo->signal_connect('changed', sub { - my ($button) = @_; - - # Get the ID of the map source selected - my $iter = $button->get_active_iter; - my $id = $model->get($iter, 1); - - # Create that map source - my $source = $factory->create($id); - $map->set_map_source($source); - }); - - return $combo; -} - - -sub create_marker_layer { - my ($map) = @_; - my $layer = Champlain::Layer->new(); - - my $orange = Clutter::Color->new(0xf3, 0x94, 0x07, 0xbb); - my $white = Clutter::Color->new(0xff, 0xff, 0xff, 0xff); - - my $marker; - - $marker = Champlain::Marker->new_with_text("Montr\x{e9}al", "Airmole 14"); - $marker->set_position(45.528178, -73.563788); - $marker->set_reactive(TRUE); - $marker->signal_connect_after("button-release-event", \&marker_button_release_cb, $map); - $layer->add($marker); - - $marker = Champlain::Marker->new_with_text("New York", "Sans 15", $white); - $marker->set_position(40.77, -73.98); - $layer->add($marker); - - $marker = Champlain::Marker->new_with_text("Bratislava", "Sans 15", $orange); - $marker->set_position(48.148377, 17.107311); - $layer->add($marker); - - $layer->show(); - return $layer; -} - - -sub marker_button_release_cb { - my ($marker, $event, $map) = @_; - return FALSE unless $event->button == 1 && $event->click_count == 1; - - print "Montreal was clicked\n"; - return TRUE; -} - - -sub map_view_button_release_cb { - my ($actor, $event, $map) = @_; - return FALSE unless $event->button == 2 && $event->click_count == 1; - - my ($lat, $lon) = $map->get_coords_from_event($event); - printf "Map was clicked at %f, %f\n", $lat, $lon; - return TRUE; -} diff --git a/bindings/perl/Champlain/maps-gtk b/bindings/perl/Champlain/maps-gtk deleted file mode 100644 index aece961..0000000 --- a/bindings/perl/Champlain/maps-gtk +++ /dev/null @@ -1 +0,0 @@ -GTK_TYPE_CHAMPLAIN_EMBED GtkChamplainEmbed GtkObject Gtk2::ChamplainEmbed diff --git a/bindings/perl/Champlain/t/Gtk2ChamplainEmbed.t b/bindings/perl/Champlain/t/Gtk2ChamplainEmbed.t deleted file mode 100644 index ede94be..0000000 --- a/bindings/perl/Champlain/t/Gtk2ChamplainEmbed.t +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/perl - -use strict; -use warnings; - -use Clutter::TestHelper tests => 2, sub_module => 'gtk'; -use Gtk2 '-init'; - -use Champlain ':coords'; - - -exit tests(); - - -sub tests { - test_all(); - return 0; -} - -sub test_all { - - my $embed = Gtk2::ChamplainEmbed->new(); - isa_ok($embed, 'Gtk2::ChamplainEmbed'); - - my $view = $embed->get_view; - isa_ok($view, 'Champlain::View'); -} diff --git a/bindings/perl/Champlain/xs/Gtk2ChamplainEmbed.xs b/bindings/perl/Champlain/xs/Gtk2ChamplainEmbed.xs deleted file mode 100644 index a447e36..0000000 --- a/bindings/perl/Champlain/xs/Gtk2ChamplainEmbed.xs +++ /dev/null @@ -1,13 +0,0 @@ -#include "champlain-perl.h" - - -MODULE = Gtk2::ChamplainEmbed PACKAGE = Gtk2::ChamplainEmbed PREFIX = gtk_champlain_embed_ - - -GtkWidget* -gtk_champlain_embed_new (class) - C_ARGS: /* No args */ - - -ChamplainView * -gtk_champlain_embed_get_view (GtkChamplainEmbed* embed) -- 2.39.5