From ed8b18065d8e2a62769edb03e6a9fdeca5b8b324 Mon Sep 17 00:00:00 2001 From: Pierre-Luc Beaudoin Date: Sat, 31 Jan 2009 17:39:51 +0200 Subject: [PATCH] Bump version to 0.3 and update demo to use 0.3 API --- configure.ac | 8 +++-- demos/launcher.c | 89 +++++++++++++++++++++++------------------------- 2 files changed, 47 insertions(+), 50 deletions(-) diff --git a/configure.ac b/configure.ac index bcdc7f5..e0ebd3f 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.61) -AC_INIT(libchamplain-gtk, 0.2.8, pierre-luc@pierlux.com) +AC_INIT(libchamplain-gtk, 0.3, pierre-luc@pierlux.com) AC_CONFIG_SRCDIR([champlain-gtk/champlain-view-embed.h]) AC_CONFIG_HEADER([config.h]) @@ -18,7 +18,7 @@ AC_PATH_PROG([GLIB_GENMARSHAL], [glib-genmarshal]) # Checks for libraries. LIBRARY_VERSION=0:1:0 # API_VERSION is used to generate the pc file only -API_VERSION=0.2 +API_VERSION=0.3 AC_SUBST(LIBRARY_VERSION) AC_SUBST(API_VERSION) @@ -36,7 +36,9 @@ PKG_CHECK_MODULES(DEPS, AC_SUBST(CPLAIN_DEPS_CFLAGS) AC_SUBST(CPLAIN_DEPS_LIBS) -PKG_CHECK_MODULES(CPLAIN_DEPS,[champlain-0.2 >= 0.2]) +PKG_CHECK_MODULES(CPLAIN_DEPS, + [champlain-0.3 >= 0.3] + ) # check for gtk-doc GTK_DOC_CHECK(1.9) diff --git a/demos/launcher.c b/demos/launcher.c index bd88c60..12f6b06 100644 --- a/demos/launcher.c +++ b/demos/launcher.c @@ -41,29 +41,30 @@ static ClutterActor* create_marker_layer () { ClutterActor *layer, *marker; - + layer = champlain_layer_new(); - + ClutterColor orange = { 0xf3, 0x94, 0x07, 0xbb }; ClutterColor white = { 0xff, 0xff, 0xff, 0xff }; marker = champlain_marker_new_with_label("Montréal", "Airmole 14", NULL, NULL); champlain_marker_set_position(CHAMPLAIN_MARKER(marker), 45.528178, -73.563788); clutter_container_add(CLUTTER_CONTAINER(layer), marker, NULL); - + marker = champlain_marker_new_with_label("New York", "Sans 25", &white, NULL); champlain_marker_set_position(CHAMPLAIN_MARKER(marker), 40.77, -73.98); clutter_container_add(CLUTTER_CONTAINER(layer), marker, NULL); - + marker = champlain_marker_new_with_label("Saint-Tite-des-Caps", "Serif 12", NULL, &orange); champlain_marker_set_position(CHAMPLAIN_MARKER(marker), 47.130885, -70.764141); clutter_container_add(CLUTTER_CONTAINER(layer), marker, NULL); - + clutter_actor_hide(layer); return layer; } static void -toggle_layer (GtkToggleButton *widget, ClutterActor *layer) +toggle_layer (GtkToggleButton *widget, + ClutterActor *layer) { if(gtk_toggle_button_get_active(widget)) clutter_actor_show_all(layer); @@ -72,7 +73,8 @@ toggle_layer (GtkToggleButton *widget, ClutterActor *layer) } static void -map_source_changed (GtkWidget *widget, ChamplainView *view) +map_source_changed (GtkWidget *widget, + ChamplainView *view) { gchar* selection = gtk_combo_box_get_active_text(GTK_COMBO_BOX(widget)); if (g_strcmp0(selection, OSM_MAP) == 0) @@ -90,14 +92,17 @@ map_source_changed (GtkWidget *widget, ChamplainView *view) } static void -zoom_changed (GtkSpinButton *spinbutton, ChamplainView *view) +zoom_changed (GtkSpinButton *spinbutton, + ChamplainView *view) { gint zoom = gtk_spin_button_get_value_as_int(spinbutton); g_object_set(G_OBJECT(view), "zoom-level", zoom, NULL); } static void -map_zoom_changed (ChamplainView *view, GParamSpec *gobject, GtkSpinButton *spinbutton) +map_zoom_changed (ChamplainView *view, + GParamSpec *gobject, + GtkSpinButton *spinbutton) { gint zoom; g_object_get(G_OBJECT(view), "zoom-level", &zoom, NULL); @@ -105,24 +110,27 @@ map_zoom_changed (ChamplainView *view, GParamSpec *gobject, GtkSpinButton *spinb } static void -zoom_in (GtkWidget *widget, ChamplainView *view) +zoom_in (GtkWidget *widget, + ChamplainView *view) { champlain_view_zoom_in(view); } static void -zoom_out (GtkWidget *widget, ChamplainView *view) +zoom_out (GtkWidget *widget, + ChamplainView *view) { champlain_view_zoom_out(view); } int -main (int argc, char *argv[]) +main (int argc, + char *argv[]) { GtkWidget *window; GtkWidget *widget, *vbox, *bbox, *button, *viewport; ClutterActor *layer, *view; - + g_thread_init (NULL); gtk_clutter_init (&argc, &argv); @@ -139,64 +147,51 @@ main (int argc, char *argv[]) * When the window is about to be destroyed we get a notificaiton and * stop the main GTK loop */ - g_signal_connect (G_OBJECT (window), "destroy", G_CALLBACK (on_destroy), NULL); + g_signal_connect (G_OBJECT (window), "destroy", G_CALLBACK (on_destroy), + NULL); vbox = gtk_vbox_new(FALSE, 10); - - view = champlain_view_new (CHAMPLAIN_VIEW_MODE_KINETIC); + + view = champlain_view_new (); widget = champlain_view_embed_new(CHAMPLAIN_VIEW (view)); - g_object_set(G_OBJECT(view), "zoom-level", 5, NULL); + g_object_set(G_OBJECT(view), "scroll-mode", CHAMPLAIN_SCROLL_MODE_KINETIC, + "zoom-level", 5, NULL); layer = create_marker_layer(); champlain_view_add_layer(CHAMPLAIN_VIEW (view), layer); - + gtk_widget_set_size_request(widget, 640, 480); - + bbox = gtk_hbox_new (FALSE, 10); button = gtk_button_new_from_stock (GTK_STOCK_ZOOM_IN); - g_signal_connect (button, - "clicked", - G_CALLBACK (zoom_in), - view); + g_signal_connect (button, "clicked", G_CALLBACK (zoom_in), view); gtk_container_add (GTK_CONTAINER (bbox), button); + button = gtk_button_new_from_stock (GTK_STOCK_ZOOM_OUT); - g_signal_connect (button, - "clicked", - G_CALLBACK (zoom_out), - view); + g_signal_connect (button, "clicked", G_CALLBACK (zoom_out), view); gtk_container_add (GTK_CONTAINER (bbox), button); + button = gtk_toggle_button_new_with_label ("Markers"); - g_signal_connect (button, - "toggled", - G_CALLBACK (toggle_layer), - layer); + g_signal_connect (button, "toggled", G_CALLBACK (toggle_layer), layer); gtk_container_add (GTK_CONTAINER (bbox), button); - + button = gtk_combo_box_new_text(); gtk_combo_box_append_text(GTK_COMBO_BOX(button), OSM_MAP); gtk_combo_box_append_text(GTK_COMBO_BOX(button), OAM_MAP); gtk_combo_box_append_text(GTK_COMBO_BOX(button), MFF_MAP); gtk_combo_box_set_active(GTK_COMBO_BOX(button), 0); - g_signal_connect (button, - "changed", - G_CALLBACK (map_source_changed), - view); + g_signal_connect (button, "changed", G_CALLBACK (map_source_changed), view); gtk_container_add (GTK_CONTAINER (bbox), button); - + button = gtk_spin_button_new_with_range(0, 20, 1); - g_signal_connect (button, - "changed", - G_CALLBACK (zoom_changed), - view); - g_signal_connect (view, - "notify::zoom-level", - G_CALLBACK (map_zoom_changed), - button); + g_signal_connect (button, "changed", G_CALLBACK (zoom_changed), view); + g_signal_connect (view, "notify::zoom-level", G_CALLBACK (map_zoom_changed), + button); gtk_container_add (GTK_CONTAINER (bbox), button); - + viewport = gtk_viewport_new (NULL, NULL); gtk_viewport_set_shadow_type (GTK_VIEWPORT(viewport), GTK_SHADOW_ETCHED_IN); gtk_container_add (GTK_CONTAINER (viewport), widget); - + gtk_box_pack_start (GTK_BOX (vbox), bbox, FALSE, FALSE, 0); gtk_container_add (GTK_CONTAINER (vbox), viewport); -- 2.39.5