1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921
|
/*
* Copyright (C) 2008-2009 Pierre-Luc Beaudoin <pierre-luc@pierlux.com>
* Copyright (C) 2010-2013 Jiri Techet <techet@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* SECTION:champlain-tile
* @short_description: An object that represent map tiles
*
* This object represents map tiles. Tiles are loaded by #ChamplainMapSource.
*/
#include "champlain-tile.h"
#include "champlain-enum-types.h"
#include "champlain-private.h"
#include <math.h>
#include <errno.h>
#include <libsoup/soup.h>
#include <gio/gio.h>
#include <clutter/clutter.h>
#include <cairo-gobject.h>
static void set_surface (ChamplainExportable *exportable,
cairo_surface_t *surface);
static cairo_surface_t *get_surface (ChamplainExportable *exportable);
static void exportable_interface_init (ChamplainExportableIface *iface);
struct _ChamplainTilePrivate
{
guint x; /* The x position on the map (in pixels) */
guint y; /* The y position on the map (in pixels) */
guint size; /* The tile's width and height (only support square tiles */
guint zoom_level; /* The tile's zoom level */
ChamplainState state; /* The tile state: loading, validation, done */
/* The tile actor that will be displayed after champlain_tile_display_content () */
ClutterActor *content_actor;
gboolean fade_in;
GTimeVal *modified_time; /* The last modified time of the cache */
gchar *etag; /* The HTTP ETag sent by the server */
gboolean content_displayed;
cairo_surface_t *surface;
};
G_DEFINE_TYPE_WITH_CODE (ChamplainTile, champlain_tile, CLUTTER_TYPE_ACTOR,
G_ADD_PRIVATE (ChamplainTile)
G_IMPLEMENT_INTERFACE (CHAMPLAIN_TYPE_EXPORTABLE, exportable_interface_init))
enum
{
PROP_0,
PROP_X,
PROP_Y,
PROP_ZOOM_LEVEL,
PROP_SIZE,
PROP_STATE,
PROP_CONTENT,
PROP_ETAG,
PROP_FADE_IN,
PROP_SURFACE
};
enum
{
/* normal signals */
RENDER_COMPLETE,
LAST_SIGNAL
};
static guint champlain_tile_signals[LAST_SIGNAL] = { 0, };
static void
champlain_tile_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec)
{
ChamplainTile *self = CHAMPLAIN_TILE (object);
switch (property_id)
{
case PROP_X:
g_value_set_uint (value, champlain_tile_get_x (self));
break;
case PROP_Y:
g_value_set_uint (value, champlain_tile_get_y (self));
break;
case PROP_ZOOM_LEVEL:
g_value_set_uint (value, champlain_tile_get_zoom_level (self));
break;
case PROP_SIZE:
g_value_set_uint (value, champlain_tile_get_size (self));
break;
case PROP_STATE:
g_value_set_enum (value, champlain_tile_get_state (self));
break;
case PROP_CONTENT:
g_value_set_object (value, champlain_tile_get_content (self));
break;
case PROP_ETAG:
g_value_set_string (value, champlain_tile_get_etag (self));
break;
case PROP_FADE_IN:
g_value_set_boolean (value, champlain_tile_get_fade_in (self));
break;
case PROP_SURFACE:
g_value_set_boxed (value, get_surface (CHAMPLAIN_EXPORTABLE (self)));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
}
static void
champlain_tile_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec)
{
ChamplainTile *self = CHAMPLAIN_TILE (object);
switch (property_id)
{
case PROP_X:
champlain_tile_set_x (self, g_value_get_uint (value));
break;
case PROP_Y:
champlain_tile_set_y (self, g_value_get_uint (value));
break;
case PROP_ZOOM_LEVEL:
champlain_tile_set_zoom_level (self, g_value_get_uint (value));
break;
case PROP_SIZE:
champlain_tile_set_size (self, g_value_get_uint (value));
break;
case PROP_STATE:
champlain_tile_set_state (self, g_value_get_enum (value));
break;
case PROP_CONTENT:
champlain_tile_set_content (self, g_value_get_object (value));
break;
case PROP_ETAG:
champlain_tile_set_etag (self, g_value_get_string (value));
break;
case PROP_FADE_IN:
champlain_tile_set_fade_in (self, g_value_get_boolean (value));
break;
case PROP_SURFACE:
set_surface (CHAMPLAIN_EXPORTABLE (self), g_value_get_boxed (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
}
static void
champlain_tile_dispose (GObject *object)
{
ChamplainTilePrivate *priv = CHAMPLAIN_TILE (object)->priv;
if (!priv->content_displayed && priv->content_actor)
{
clutter_actor_destroy (priv->content_actor);
priv->content_actor = NULL;
}
g_clear_pointer (&priv->surface, cairo_surface_destroy);
G_OBJECT_CLASS (champlain_tile_parent_class)->dispose (object);
}
static void
champlain_tile_finalize (GObject *object)
{
ChamplainTilePrivate *priv = CHAMPLAIN_TILE (object)->priv;
g_free (priv->modified_time);
g_free (priv->etag);
G_OBJECT_CLASS (champlain_tile_parent_class)->finalize (object);
}
static void
champlain_tile_class_init (ChamplainTileClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->get_property = champlain_tile_get_property;
object_class->set_property = champlain_tile_set_property;
object_class->dispose = champlain_tile_dispose;
object_class->finalize = champlain_tile_finalize;
/**
* ChamplainTile:x:
*
* The x position of the tile
*
* Since: 0.4
*/
g_object_class_install_property (object_class,
PROP_X,
g_param_spec_uint ("x",
"x",
"The X position of the tile",
0,
G_MAXINT,
0,
G_PARAM_READWRITE));
/**
* ChamplainTile:y:
*
* The y position of the tile
*
* Since: 0.4
*/
g_object_class_install_property (object_class,
PROP_Y,
g_param_spec_uint ("y",
"y",
"The Y position of the tile",
0,
G_MAXINT,
0,
G_PARAM_READWRITE));
/**
* ChamplainTile:zoom-level:
*
* The zoom level of the tile
*
* Since: 0.4
*/
g_object_class_install_property (object_class,
PROP_ZOOM_LEVEL,
g_param_spec_uint ("zoom-level",
"Zoom Level",
"The zoom level of the tile",
0,
G_MAXINT,
0,
G_PARAM_READWRITE));
/**
* ChamplainTile:size:
*
* The size of the tile in pixels
*
* Since: 0.4
*/
g_object_class_install_property (object_class,
PROP_SIZE,
g_param_spec_uint ("size",
"Size",
"The size of the tile",
0,
G_MAXINT,
256,
G_PARAM_READWRITE));
/**
* ChamplainTile:state:
*
* The state of the tile
*
* Since: 0.4
*/
g_object_class_install_property (object_class,
PROP_STATE,
g_param_spec_enum ("state",
"State",
"The state of the tile",
CHAMPLAIN_TYPE_STATE,
CHAMPLAIN_STATE_NONE,
G_PARAM_READWRITE));
/**
* ChamplainTile:content:
*
* The #ClutterActor with the specific image content. When changing this
* property, the new actor will be faded in.
*
* Since: 0.4
*/
g_object_class_install_property (object_class,
PROP_CONTENT,
g_param_spec_object ("content",
"Content",
"The tile's content",
CLUTTER_TYPE_ACTOR,
G_PARAM_READWRITE));
/**
* ChamplainTile:etag:
*
* The tile's ETag. This information is sent by some web servers as a mean
* to identify if a tile has changed. This information is saved in the cache
* and sent in GET queries.
*
* Since: 0.4
*/
g_object_class_install_property (object_class,
PROP_ETAG,
g_param_spec_string ("etag",
"Entity Tag",
"The entity tag of the tile",
NULL,
G_PARAM_READWRITE));
/**
* ChamplainTile:fade-in:
*
* Specifies whether the tile should fade in when loading
*
* Since: 0.6
*/
g_object_class_install_property (object_class,
PROP_FADE_IN,
g_param_spec_boolean ("fade-in",
"Fade In",
"Tile should fade in",
FALSE,
G_PARAM_READWRITE));
g_object_class_override_property (object_class,
PROP_SURFACE,
"surface");
/**
* ChamplainTile::render-complete:
* @self: a #ChamplainTile
* @data: the result of the rendering
* @size: size of data
* @error: TRUE if there was an error during rendering
*
* The #ChamplainTile::render-complete signal is emitted when rendering of the tile is
* completed by the renderer.
*
* Since: 0.10
*/
champlain_tile_signals[RENDER_COMPLETE] =
g_signal_new ("render-complete",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST,
0,
NULL,
NULL,
NULL,
G_TYPE_NONE,
3,
G_TYPE_POINTER, G_TYPE_UINT, G_TYPE_BOOLEAN);
}
static void
champlain_tile_init (ChamplainTile *self)
{
ChamplainTilePrivate *priv = champlain_tile_get_instance_private (self);
self->priv = priv;
priv->state = CHAMPLAIN_STATE_NONE;
priv->x = 0;
priv->y = 0;
priv->zoom_level = 0;
priv->size = 0;
priv->modified_time = NULL;
priv->etag = NULL;
priv->fade_in = FALSE;
priv->content_displayed = FALSE;
priv->content_actor = NULL;
}
static void
set_surface (ChamplainExportable *exportable,
cairo_surface_t *surface)
{
g_return_if_fail (CHAMPLAIN_TILE (exportable));
g_return_if_fail (surface != NULL);
ChamplainTile *self = CHAMPLAIN_TILE (exportable);
if (self->priv->surface == surface)
return;
cairo_surface_destroy (self->priv->surface);
self->priv->surface = cairo_surface_reference (surface);
g_object_notify (G_OBJECT (self), "surface");
}
static cairo_surface_t *
get_surface (ChamplainExportable *exportable)
{
g_return_val_if_fail (CHAMPLAIN_IS_TILE (exportable), NULL);
return CHAMPLAIN_TILE (exportable)->priv->surface;
}
static void
exportable_interface_init (ChamplainExportableIface *iface)
{
iface->get_surface = get_surface;
iface->set_surface = set_surface;
}
/**
* champlain_tile_new:
*
* Creates an instance of #ChamplainTile.
*
* Returns: a new #ChamplainTile
*
* Since: 0.4
*/
ChamplainTile *
champlain_tile_new (void)
{
return g_object_new (CHAMPLAIN_TYPE_TILE, NULL);
}
/**
* champlain_tile_get_x:
* @self: the #ChamplainTile
*
* Gets the tile's x position.
*
* Returns: the tile's x position
*
* Since: 0.4
*/
guint
champlain_tile_get_x (ChamplainTile *self)
{
g_return_val_if_fail (CHAMPLAIN_TILE (self), 0);
return self->priv->x;
}
/**
* champlain_tile_get_y:
* @self: the #ChamplainTile
*
* Gets the tile's y position.
*
* Returns: the tile's y position
*
* Since: 0.4
*/
guint
champlain_tile_get_y (ChamplainTile *self)
{
g_return_val_if_fail (CHAMPLAIN_TILE (self), 0);
return self->priv->y;
}
/**
* champlain_tile_get_zoom_level:
* @self: the #ChamplainTile
*
* Gets the tile's zoom level.
*
* Returns: the tile's zoom level
*
* Since: 0.4
*/
guint
champlain_tile_get_zoom_level (ChamplainTile *self)
{
g_return_val_if_fail (CHAMPLAIN_TILE (self), 0);
return self->priv->zoom_level;
}
/**
* champlain_tile_get_size:
* @self: the #ChamplainTile
*
* Gets the tile's size.
*
* Returns: the tile's size in pixels
*
* Since: 0.4
*/
guint
champlain_tile_get_size (ChamplainTile *self)
{
g_return_val_if_fail (CHAMPLAIN_TILE (self), 0);
return self->priv->size;
}
/**
* champlain_tile_get_state:
* @self: the #ChamplainTile
*
* Gets the current state of tile loading.
*
* Returns: the tile's #ChamplainState
*
* Since: 0.4
*/
ChamplainState
champlain_tile_get_state (ChamplainTile *self)
{
g_return_val_if_fail (CHAMPLAIN_TILE (self), CHAMPLAIN_STATE_NONE);
return self->priv->state;
}
/**
* champlain_tile_set_x:
* @self: the #ChamplainTile
* @x: the position
*
* Sets the tile's x position
*
* Since: 0.4
*/
void
champlain_tile_set_x (ChamplainTile *self,
guint x)
{
g_return_if_fail (CHAMPLAIN_TILE (self));
self->priv->x = x;
g_object_notify (G_OBJECT (self), "x");
}
/**
* champlain_tile_set_y:
* @self: the #ChamplainTile
* @y: the position
*
* Sets the tile's y position
*
* Since: 0.4
*/
void
champlain_tile_set_y (ChamplainTile *self,
guint y)
{
g_return_if_fail (CHAMPLAIN_TILE (self));
self->priv->y = y;
g_object_notify (G_OBJECT (self), "y");
}
/**
* champlain_tile_set_zoom_level:
* @self: the #ChamplainTile
* @zoom_level: the zoom level
*
* Sets the tile's zoom level
*
* Since: 0.4
*/
void
champlain_tile_set_zoom_level (ChamplainTile *self,
guint zoom_level)
{
g_return_if_fail (CHAMPLAIN_TILE (self));
self->priv->zoom_level = zoom_level;
g_object_notify (G_OBJECT (self), "zoom-level");
}
/**
* champlain_tile_set_size:
* @self: the #ChamplainTile
* @size: the size in pixels
*
* Sets the tile's size
*
* Since: 0.4
*/
void
champlain_tile_set_size (ChamplainTile *self,
guint size)
{
g_return_if_fail (CHAMPLAIN_TILE (self));
self->priv->size = size;
g_object_notify (G_OBJECT (self), "size");
}
/**
* champlain_tile_set_state:
* @self: the #ChamplainTile
* @state: a #ChamplainState
*
* Sets the tile's #ChamplainState
*
* Since: 0.4
*/
void
champlain_tile_set_state (ChamplainTile *self,
ChamplainState state)
{
g_return_if_fail (CHAMPLAIN_TILE (self));
ChamplainTilePrivate *priv = self->priv;
if (state == priv->state)
return;
priv->state = state;
g_object_notify (G_OBJECT (self), "state");
}
/**
* champlain_tile_new_full:
* @x: the x position
* @y: the y position
* @size: the size in pixels
* @zoom_level: the zoom level
*
* Creates an instance of #ChamplainTile.
*
* Returns: a #ChamplainTile
*
* Since: 0.4
*/
ChamplainTile *
champlain_tile_new_full (guint x,
guint y,
guint size,
guint zoom_level)
{
return g_object_new (CHAMPLAIN_TYPE_TILE,
"x", x,
"y", y,
"zoom-level", zoom_level,
"size", size,
NULL);
}
/**
* champlain_tile_get_modified_time:
* @self: the #ChamplainTile
*
* Gets the tile's last modified time.
*
* Returns: the tile's last modified time
*
* Since: 0.4
*/
G_CONST_RETURN GTimeVal *
champlain_tile_get_modified_time (ChamplainTile *self)
{
g_return_val_if_fail (CHAMPLAIN_TILE (self), NULL);
return self->priv->modified_time;
}
/**
* champlain_tile_set_modified_time:
* @self: the #ChamplainTile
* @time: a #GTimeVal, the value will be copied
*
* Sets the tile's modified time
*
* Since: 0.4
*/
void
champlain_tile_set_modified_time (ChamplainTile *self,
const GTimeVal *time_)
{
g_return_if_fail (CHAMPLAIN_TILE (self));
g_return_if_fail (time_ != NULL);
ChamplainTilePrivate *priv = self->priv;
g_free (priv->modified_time);
priv->modified_time = g_memdup (time_, sizeof (GTimeVal));
}
/**
* champlain_tile_get_etag:
* @self: the #ChamplainTile
*
* Gets the tile's ETag.
*
* Returns: the tile's ETag
*
* Since: 0.4
*/
G_CONST_RETURN gchar *
champlain_tile_get_etag (ChamplainTile *self)
{
g_return_val_if_fail (CHAMPLAIN_TILE (self), "");
return self->priv->etag;
}
/**
* champlain_tile_set_etag:
* @self: the #ChamplainTile
* @etag: the tile's ETag as sent by the server
*
* Sets the tile's ETag
*
* Since: 0.4
*/
void
champlain_tile_set_etag (ChamplainTile *self,
const gchar *etag)
{
g_return_if_fail (CHAMPLAIN_TILE (self));
ChamplainTilePrivate *priv = self->priv;
g_free (priv->etag);
priv->etag = g_strdup (etag);
g_object_notify (G_OBJECT (self), "etag");
}
/**
* champlain_tile_set_content:
* @self: the #ChamplainTile
* @actor: the new content
*
* Sets the tile's content. To also disppay the tile, you have to call
* champlain_tile_display_content() in addition.
*
* Since: 0.4
*/
void
champlain_tile_set_content (ChamplainTile *self,
ClutterActor *actor)
{
g_return_if_fail (CHAMPLAIN_TILE (self));
g_return_if_fail (CLUTTER_ACTOR (actor));
ChamplainTilePrivate *priv = self->priv;
if (!priv->content_displayed && priv->content_actor)
clutter_actor_destroy (priv->content_actor);
priv->content_actor = g_object_ref_sink (actor);
priv->content_displayed = FALSE;
g_object_notify (G_OBJECT (self), "content");
}
static void
fade_in_completed (ClutterActor *actor,
const gchar *transition_name,
gboolean is_finished,
ChamplainTile *self)
{
if (clutter_actor_get_n_children (CLUTTER_ACTOR (self)) > 1)
clutter_actor_destroy (clutter_actor_get_first_child (CLUTTER_ACTOR (self)));
g_signal_handlers_disconnect_by_func (actor, fade_in_completed, self);
}
/**
* champlain_tile_display_content:
* @self: the #ChamplainTile
*
* Displays the tile's content.
*
* Since: 0.8
*/
void
champlain_tile_display_content (ChamplainTile *self)
{
g_return_if_fail (CHAMPLAIN_TILE (self));
ChamplainTilePrivate *priv = self->priv;
if (!priv->content_actor || priv->content_displayed)
return;
clutter_actor_add_child (CLUTTER_ACTOR (self), priv->content_actor);
g_object_unref (priv->content_actor);
priv->content_displayed = TRUE;
clutter_actor_set_opacity (priv->content_actor, 0);
clutter_actor_save_easing_state (priv->content_actor);
if (priv->fade_in)
{
clutter_actor_set_easing_mode (priv->content_actor, CLUTTER_EASE_IN_CUBIC);
clutter_actor_set_easing_duration (priv->content_actor, 500);
}
else
{
clutter_actor_set_easing_mode (priv->content_actor, CLUTTER_LINEAR);
clutter_actor_set_easing_duration (priv->content_actor, 150);
}
clutter_actor_set_opacity (priv->content_actor, 255);
clutter_actor_restore_easing_state (priv->content_actor);
g_signal_connect (priv->content_actor, "transition-stopped::opacity", G_CALLBACK (fade_in_completed), self);
}
/**
* champlain_tile_get_content:
* @self: the #ChamplainTile
*
* Gets the tile's content actor.
*
* Returns: (transfer none): the tile's content, this actor will change each time the tile's content changes.
* You should not unref this content, it is owned by the tile.
*
* Since: 0.4
*/
ClutterActor *
champlain_tile_get_content (ChamplainTile *self)
{
g_return_val_if_fail (CHAMPLAIN_TILE (self), NULL);
return self->priv->content_actor;
}
/**
* champlain_tile_get_fade_in:
* @self: the #ChamplainTile
*
* Checks whether the tile should fade in.
*
* Returns: the return value determines whether the tile should fade in when loading.
*
* Since: 0.6
*/
gboolean
champlain_tile_get_fade_in (ChamplainTile *self)
{
g_return_val_if_fail (CHAMPLAIN_TILE (self), FALSE);
return self->priv->fade_in;
}
/**
* champlain_tile_set_fade_in:
* @self: the #ChamplainTile
* @fade_in: determines whether the tile should fade in when loading
*
* Sets the flag determining whether the tile should fade in when loading
*
* Since: 0.6
*/
void
champlain_tile_set_fade_in (ChamplainTile *self,
gboolean fade_in)
{
g_return_if_fail (CHAMPLAIN_TILE (self));
self->priv->fade_in = fade_in;
g_object_notify (G_OBJECT (self), "fade-in");
}
|