comparison src/bar_gps.c @ 1758:8b9bbf92725f

require libchamplain 0.4 - check for libchamplain 0.4 - dropped libchamplain 0.3.x support http://sourceforge.net/tracker/index.php?func=detail&aid=2861847&group_id=222125&atid=1054680
author nadvornik
date Fri, 25 Sep 2009 20:39:15 +0000
parents a4f3c93294c9
children 4f081855679f
comparison
equal deleted inserted replaced
1757:8ecdf8445ef5 1758:8b9bbf92725f
23 #include "menu.h" 23 #include "menu.h"
24 #include "rcfile.h" 24 #include "rcfile.h"
25 #include "thumb.h" 25 #include "thumb.h"
26 #include "ui_menu.h" 26 #include "ui_menu.h"
27 27
28 #include <clutter-gtk/gtk-clutter-embed.h> 28 #include <clutter-gtk/clutter-gtk.h>
29 #include <champlain/champlain.h> 29 #include <champlain/champlain.h>
30 #include <champlain-gtk/champlain-gtk.h> 30 #include <champlain-gtk/champlain-gtk.h>
31 31
32 #define MARKER_COLOUR 0x00, 0x00, 0xff, 0xff 32 #define MARKER_COLOUR 0x00, 0x00, 0xff, 0xff
33 #define TEXT_COLOUR 0x00, 0x00, 0x00, 0xff 33 #define TEXT_COLOUR 0x00, 0x00, 0x00, 0xff
70 marker = CLUTTER_ACTOR(data); 70 marker = CLUTTER_ACTOR(data);
71 fd = g_object_get_data(G_OBJECT(marker), "file_fd"); 71 fd = g_object_get_data(G_OBJECT(marker), "file_fd");
72 if (fd->thumb_pixbuf != NULL) 72 if (fd->thumb_pixbuf != NULL)
73 { 73 {
74 actor = clutter_texture_new(); 74 actor = clutter_texture_new();
75 gtk_clutter_texture_set_from_pixbuf(CLUTTER_TEXTURE(actor), fd->thumb_pixbuf); 75 gtk_clutter_texture_set_from_pixbuf(CLUTTER_TEXTURE(actor), fd->thumb_pixbuf, NULL);
76 champlain_marker_set_image(CHAMPLAIN_MARKER(marker), actor); 76 champlain_marker_set_image(CHAMPLAIN_MARKER(marker), actor);
77 } 77 }
78 thumb_loader_free(tl); 78 thumb_loader_free(tl);
79 } 79 }
80 80
125 * thumb_loader callback 125 * thumb_loader callback
126 */ 126 */
127 if (fd->thumb_pixbuf != NULL) 127 if (fd->thumb_pixbuf != NULL)
128 { 128 {
129 actor = clutter_texture_new(); 129 actor = clutter_texture_new();
130 gtk_clutter_texture_set_from_pixbuf(CLUTTER_TEXTURE(actor), fd->thumb_pixbuf); 130 gtk_clutter_texture_set_from_pixbuf(CLUTTER_TEXTURE(actor), fd->thumb_pixbuf, NULL);
131 champlain_marker_set_image(CHAMPLAIN_MARKER(marker), actor); 131 champlain_marker_set_image(CHAMPLAIN_MARKER(marker), actor);
132 } 132 }
133 else if (fd->pixbuf != NULL) 133 else if (fd->pixbuf != NULL)
134 { 134 {
135 actor = clutter_texture_new(); 135 actor = clutter_texture_new();
150 rotate = GDK_PIXBUF_ROTATE_NONE; 150 rotate = GDK_PIXBUF_ROTATE_NONE;
151 } 151 }
152 152
153 gtk_clutter_texture_set_from_pixbuf(CLUTTER_TEXTURE(actor), 153 gtk_clutter_texture_set_from_pixbuf(CLUTTER_TEXTURE(actor),
154 gdk_pixbuf_rotate_simple(gdk_pixbuf_scale_simple(fd->pixbuf, THUMB_SIZE, height * THUMB_SIZE / width, 154 gdk_pixbuf_rotate_simple(gdk_pixbuf_scale_simple(fd->pixbuf, THUMB_SIZE, height * THUMB_SIZE / width,
155 GDK_INTERP_NEAREST), rotate)); 155 GDK_INTERP_NEAREST), rotate), NULL);
156 champlain_marker_set_image(CHAMPLAIN_MARKER(marker), actor); 156 champlain_marker_set_image(CHAMPLAIN_MARKER(marker), actor);
157 } 157 }
158 else 158 else
159 { 159 {
160 tl = thumb_loader_new(THUMB_SIZE, THUMB_SIZE); 160 tl = thumb_loader_new(THUMB_SIZE, THUMB_SIZE);
343 void bar_pane_gps_set_map_source(PaneGPSData *pgd, const gchar *map_id) 343 void bar_pane_gps_set_map_source(PaneGPSData *pgd, const gchar *map_id)
344 { 344 {
345 ChamplainMapSource *map_source; 345 ChamplainMapSource *map_source;
346 ChamplainMapSourceFactory *map_factory; 346 ChamplainMapSourceFactory *map_factory;
347 347
348 #if CHAMPLAIN_CHECK_VERSION(0,3,2)
349 map_factory = champlain_map_source_factory_dup_default(); 348 map_factory = champlain_map_source_factory_dup_default();
350 #else
351 map_factory = champlain_map_source_factory_get_default();
352 #endif
353 map_source = champlain_map_source_factory_create(map_factory, map_id); 349 map_source = champlain_map_source_factory_create(map_factory, map_id);
354 350
355 if (map_source != NULL) 351 if (map_source != NULL)
356 { 352 {
357 g_object_set(G_OBJECT(pgd->gps_view), "map-source", map_source, NULL); 353 g_object_set(G_OBJECT(pgd->gps_view), "map-source", map_source, NULL);
569 ChamplainMapSourceDesc *map_desc; 565 ChamplainMapSourceDesc *map_desc;
570 const gchar *current; 566 const gchar *current;
571 567
572 menu = popup_menu_short_lived(); 568 menu = popup_menu_short_lived();
573 569
574 #if CHAMPLAIN_CHECK_VERSION(0,3,2)
575 map_factory = champlain_map_source_factory_dup_default(); 570 map_factory = champlain_map_source_factory_dup_default();
576 map_list = champlain_map_source_factory_dup_list(map_factory); 571 map_list = champlain_map_source_factory_dup_list(map_factory);
577 #else
578 map_factory = champlain_map_source_factory_get_default();
579 map_list = champlain_map_source_factory_get_list(map_factory);
580 #endif
581 current = bar_pane_gps_get_map_id(pgd); 572 current = bar_pane_gps_get_map_id(pgd);
582 573
583 while (map_list) 574 while (map_list)
584 { 575 {
585 map_desc = (ChamplainMapSourceDesc *)(map_list->data); 576 map_desc = (ChamplainMapSourceDesc *)(map_list->data);
703 pgd->height = height; 694 pgd->height = height;
704 695
705 scrolled = gtk_scrolled_window_new(NULL, NULL); 696 scrolled = gtk_scrolled_window_new(NULL, NULL);
706 vbox = gtk_vbox_new(FALSE, 0); 697 vbox = gtk_vbox_new(FALSE, 0);
707 698
708 #ifdef GTK_CHAMPLAIN_EMBED
709 gpswidget = gtk_champlain_embed_new(); 699 gpswidget = gtk_champlain_embed_new();
710 view = gtk_champlain_embed_get_view(GTK_CHAMPLAIN_EMBED(gpswidget)); 700 view = gtk_champlain_embed_get_view(GTK_CHAMPLAIN_EMBED(gpswidget));
711 #else
712 view = champlain_view_new();
713 gpswidget = champlain_view_embed_new(view);
714 #endif
715 viewport = gtk_viewport_new(NULL, NULL); 701 viewport = gtk_viewport_new(NULL, NULL);
716 702
717 gtk_container_add(GTK_CONTAINER(viewport), gpswidget); 703 gtk_container_add(GTK_CONTAINER(viewport), gpswidget);
718 gtk_box_pack_start(GTK_BOX(vbox),viewport, TRUE, TRUE, 0); 704 gtk_box_pack_start(GTK_BOX(vbox),viewport, TRUE, TRUE, 0);
719 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolled), vbox); 705 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolled), vbox);