Commit 43321a41 authored by Jiří Techet's avatar Jiří Techet Committed by Pierre-Luc Beaudoin

Coding style fixes

The most boring hour in my life...
Signed-off-by: default avatarJiří Techet <techet@gmail.com>
parent e7693b79
......@@ -90,7 +90,6 @@ champlain_bounding_box_copy (const ChamplainBoundingBox *bbox)
void
champlain_bounding_box_free (ChamplainBoundingBox *bbox)
{
if (G_UNLIKELY (bbox == NULL))
return;
......
......@@ -39,7 +39,8 @@ struct _ChamplainErrorTileSourcePrivate
ClutterActor *error_actor;
};
static void fill_tile (ChamplainMapSource *map_source, ChamplainTile *tile);
static void fill_tile (ChamplainMapSource *map_source,
ChamplainTile *tile);
static void
champlain_error_tile_source_dispose (GObject *object)
......@@ -90,7 +91,8 @@ ChamplainErrorTileSource* champlain_error_tile_source_new_full (guint tile_size)
}
static void
fill_tile (ChamplainMapSource *map_source, ChamplainTile *tile)
fill_tile (ChamplainMapSource *map_source,
ChamplainTile *tile)
{
g_return_if_fail (CHAMPLAIN_IS_ERROR_TILE_SOURCE (map_source));
g_return_if_fail (CHAMPLAIN_IS_TILE (tile));
......
......@@ -66,9 +66,12 @@ struct _ChamplainFileCachePrivate
static void finalize_sql (ChamplainFileCache *file_cache);
static void delete_temp_cache (ChamplainFileCache *file_cache);
static void init_cache (ChamplainFileCache *file_cache);
static gchar *get_filename (ChamplainFileCache *file_cache, ChamplainTile *tile);
static gboolean tile_is_expired (ChamplainFileCache *file_cache, ChamplainTile *tile);
static void delete_tile (ChamplainFileCache *file_cache, const gchar *filename);
static gchar *get_filename (ChamplainFileCache *file_cache,
ChamplainTile *tile);
static gboolean tile_is_expired (ChamplainFileCache *file_cache,
ChamplainTile *tile);
static void delete_tile (ChamplainFileCache *file_cache,
const gchar *filename);
static void delete_dir_recursive (GFile *parent);
static gboolean create_cache_dir (const gchar *dir_name);
......@@ -79,8 +82,10 @@ static void store_tile (ChamplainTileCache *tile_cache,
ChamplainTile *tile,
const gchar *contents,
gsize size);
static void refresh_tile_time (ChamplainTileCache *tile_cache, ChamplainTile *tile);
static void on_tile_filled (ChamplainTileCache *tile_cache, ChamplainTile *tile);
static void refresh_tile_time (ChamplainTileCache *tile_cache,
ChamplainTile *tile);
static void on_tile_filled (ChamplainTileCache *tile_cache,
ChamplainTile *tile);
static void clean (ChamplainTileCache *tile_cache);
static void
......@@ -442,7 +447,8 @@ ChamplainFileCache* champlain_file_cache_new (void)
* Since: 0.6
*/
ChamplainFileCache* champlain_file_cache_new_full (guint size_limit,
const gchar *cache_dir, gboolean persistent)
const gchar *cache_dir,
gboolean persistent)
{
ChamplainFileCache * cache;
cache = g_object_new (CHAMPLAIN_TYPE_FILE_CACHE, "size-limit", size_limit,
......@@ -510,7 +516,8 @@ champlain_file_cache_set_size_limit (ChamplainFileCache *file_cache,
}
static gchar *
get_filename (ChamplainFileCache *file_cache, ChamplainTile *tile)
get_filename (ChamplainFileCache *file_cache,
ChamplainTile *tile)
{
ChamplainFileCachePrivate *priv = GET_PRIVATE (file_cache);
......@@ -533,7 +540,8 @@ get_filename (ChamplainFileCache *file_cache, ChamplainTile *tile)
}
static gboolean
tile_is_expired (ChamplainFileCache *file_cache, ChamplainTile *tile)
tile_is_expired (ChamplainFileCache *file_cache,
ChamplainTile *tile)
{
g_return_val_if_fail (CHAMPLAIN_FILE_CACHE (file_cache), FALSE);
g_return_val_if_fail (CHAMPLAIN_TILE (tile), FALSE);
......@@ -717,7 +725,8 @@ fill_tile (ChamplainMapSource *map_source,
}
static void
refresh_tile_time (ChamplainTileCache *tile_cache, ChamplainTile *tile)
refresh_tile_time (ChamplainTileCache *tile_cache,
ChamplainTile *tile)
{
g_return_if_fail (CHAMPLAIN_IS_FILE_CACHE (tile_cache));
......@@ -828,9 +837,7 @@ store_tile (ChamplainTileCache *tile_cache,
store_next:
if (CHAMPLAIN_IS_TILE_CACHE(next_source))
{
store_tile (CHAMPLAIN_TILE_CACHE(next_source), tile, contents, size);
}
g_free (filename);
g_free (path);
......@@ -838,7 +845,8 @@ store_next:
}
static void
on_tile_filled (ChamplainTileCache *tile_cache, ChamplainTile *tile)
on_tile_filled (ChamplainTileCache *tile_cache,
ChamplainTile *tile)
{
g_return_if_fail (CHAMPLAIN_IS_FILE_CACHE (tile_cache));
g_return_if_fail (CHAMPLAIN_IS_TILE (tile));
......@@ -871,9 +879,7 @@ on_tile_filled (ChamplainTileCache *tile_cache, ChamplainTile *tile)
call_next:
if (CHAMPLAIN_IS_TILE_CACHE(next_source))
{
on_tile_filled (CHAMPLAIN_TILE_CACHE(next_source), tile);
}
}
static void
......
......@@ -258,7 +258,8 @@ assign_cache_of_next_source_sequence (ChamplainMapSourceChain *source_chain,
}
static void
reload_tiles_cb (ChamplainMapSource *map_source, ChamplainMapSourceChain *source_chain)
reload_tiles_cb (ChamplainMapSource *map_source,
ChamplainMapSourceChain *source_chain)
{
/* propagate the signal from the chain that is inside champlain_map_source_chain */
g_signal_emit_by_name (source_chain, "reload-tiles", NULL);
......@@ -274,7 +275,8 @@ reload_tiles_cb (ChamplainMapSource *map_source, ChamplainMapSourceChain *source
* Since: 0.6
*/
void
champlain_map_source_chain_push (ChamplainMapSourceChain *source_chain, ChamplainMapSource *map_source)
champlain_map_source_chain_push (ChamplainMapSourceChain *source_chain,
ChamplainMapSource *map_source)
{
ChamplainMapSourceChainPrivate *priv = GET_PRIVATE(source_chain);
gboolean is_cache = FALSE;
......
......@@ -53,7 +53,8 @@ GType champlain_map_source_chain_get_type (void);
ChamplainMapSourceChain* champlain_map_source_chain_new (void);
void champlain_map_source_chain_push (ChamplainMapSourceChain *source_chain, ChamplainMapSource *map_source);
void champlain_map_source_chain_push (ChamplainMapSourceChain *source_chain,
ChamplainMapSource *map_source);
void champlain_map_source_chain_pop (ChamplainMapSourceChain *source_chain);
G_END_DECLS
......
......@@ -426,7 +426,8 @@ ChamplainMapSource * champlain_map_source_factory_create_cached_source (Champlai
*/
gboolean
champlain_map_source_factory_register (ChamplainMapSourceFactory *factory,
ChamplainMapSourceDesc *desc, ChamplainMapSourceConstructor constructor,
ChamplainMapSourceDesc *desc,
ChamplainMapSourceConstructor constructor,
gpointer data)
{
......
......@@ -101,14 +101,16 @@ struct _WorkerThreadData
/* lock to protect the renderer state while rendering */
GStaticRWLock MemphisLock = G_STATIC_RW_LOCK_INIT;
static void fill_tile (ChamplainMapSource *map_source, ChamplainTile *tile);
static void fill_tile (ChamplainMapSource *map_source,
ChamplainTile *tile);
static void reload_tiles (ChamplainMemphisTileSource *tile_source);
static void memphis_worker_thread (gpointer data, gpointer user_data);
static void map_data_changed_cb (ChamplainMapDataSource *map_data_source,
GParamSpec *gobject,
ChamplainMemphisTileSource *tile_source);
void argb_to_rgba (guchar *data, guint size);
void argb_to_rgba (guchar *data,
guint size);
static void
champlain_memphis_tile_source_get_property (GObject *object,
......@@ -326,7 +328,8 @@ map_data_changed_cb (ChamplainMapDataSource *map_data_source,
Transform ARGB (Cairo) to RGBA (GdkPixbuf). RGBA is actualy reversed in
memory, so the transformation is ARGB -> ABGR (i.e. swapping B and R)
*/
void argb_to_rgba (guchar *data, guint size)
void argb_to_rgba (guchar *data,
guint size)
{
guint32 *ptr;
guint32 *endptr = (guint32 *)data + size / 4;
......@@ -389,19 +392,11 @@ tile_loaded_cb (gpointer worker_data)
cairo_image_surface_get_stride (cst) * cairo_image_surface_get_height (cst));
pixbuf = gdk_pixbuf_new_from_data (cairo_image_surface_get_data (cst),
GDK_COLORSPACE_RGB,
TRUE,
8,
size,
size,
cairo_image_surface_get_stride (cst),
NULL,
NULL);
GDK_COLORSPACE_RGB, TRUE, 8, size, size,
cairo_image_surface_get_stride (cst), NULL, NULL);
if (gdk_pixbuf_save_to_buffer (pixbuf, &buffer, &buffer_size, "png", &error, NULL))
{
champlain_tile_cache_store_tile (tile_cache, tile, buffer, buffer_size);
}
g_free (buffer);
g_object_unref (pixbuf);
......@@ -419,7 +414,8 @@ cleanup:
}
static void
memphis_worker_thread (gpointer worker_data, gpointer user_data)
memphis_worker_thread (gpointer worker_data,
gpointer user_data)
{
WorkerThreadData *data = (WorkerThreadData *)worker_data;
ChamplainMapSource *map_source = data->map_source;
......@@ -453,7 +449,8 @@ memphis_worker_thread (gpointer worker_data, gpointer user_data)
}
static void
fill_tile (ChamplainMapSource *map_source, ChamplainTile *tile)
fill_tile (ChamplainMapSource *map_source,
ChamplainTile *tile)
{
g_return_if_fail (CHAMPLAIN_IS_MEMPHIS_TILE_SOURCE (map_source));
......@@ -622,7 +619,8 @@ champlain_memphis_tile_source_get_map_data_source (
*
* Since: 0.6
*/
ClutterColor * champlain_memphis_tile_source_get_background_color (
ClutterColor *
champlain_memphis_tile_source_get_background_color (
ChamplainMemphisTileSource *tile_source)
{
g_return_val_if_fail (CHAMPLAIN_IS_MEMPHIS_TILE_SOURCE (tile_source), NULL);
......
......@@ -495,7 +495,8 @@ get_tile_uri (ChamplainNetworkTileSource *source,
}
static void
tile_destroyed_cb (ChamplainTile *tile, TileDestroyedCbData *data)
tile_destroyed_cb (ChamplainTile *tile,
TileDestroyedCbData *data)
{
if (data->map_source && data->msg)
{
......@@ -507,7 +508,8 @@ tile_destroyed_cb (ChamplainTile *tile, TileDestroyedCbData *data)
}
static void
destroy_cb_data (TileDestroyedCbData *data, GClosure *closure)
destroy_cb_data (TileDestroyedCbData *data,
GClosure *closure)
{
if (data->map_source)
g_object_remove_weak_pointer(G_OBJECT (data->map_source), (gpointer*)&data->map_source);
......@@ -634,9 +636,7 @@ load_next_cleanup:
load_next:
if (next_source)
{
champlain_map_source_fill_tile (next_source, tile);
}
g_object_unref (map_source);
return;
......
......@@ -744,8 +744,10 @@ void
champlain_polygon_draw_polygon (ChamplainPolygon *polygon,
ChamplainMapSource *map_source,
guint zoom_level,
gfloat width, gfloat height,
gfloat shift_x, gfloat shift_y)
gfloat width,
gfloat height,
gfloat shift_x,
gfloat shift_y)
{
ChamplainPolygonPrivate *priv = GET_PRIVATE (polygon);
ClutterActor *cairo_texture;
......
......@@ -103,8 +103,10 @@ void champlain_polygon_hide (ChamplainPolygon *polygon);
void champlain_polygon_draw_polygon (ChamplainPolygon *polygon,
ChamplainMapSource *map_source,
guint zoom_level,
gfloat width, gfloat height,
gfloat shift_x, gfloat shift_y);
gfloat width,
gfloat height,
gfloat shift_x,
gfloat shift_y);
G_END_DECLS
......
......@@ -214,7 +214,8 @@ champlain_tile_cache_store_tile (ChamplainTileCache *tile_cache,
* Since: 0.6
*/
void
champlain_tile_cache_refresh_tile_time (ChamplainTileCache *tile_cache, ChamplainTile *tile)
champlain_tile_cache_refresh_tile_time (ChamplainTileCache *tile_cache,
ChamplainTile *tile)
{
g_return_if_fail (CHAMPLAIN_IS_TILE_CACHE (tile_cache));
......@@ -237,7 +238,8 @@ champlain_tile_cache_refresh_tile_time (ChamplainTileCache *tile_cache, Champlai
* Since: 0.6
*/
void
champlain_tile_cache_on_tile_filled (ChamplainTileCache *tile_cache, ChamplainTile *tile)
champlain_tile_cache_on_tile_filled (ChamplainTileCache *tile_cache,
ChamplainTile *tile)
{
g_return_if_fail (CHAMPLAIN_IS_TILE_CACHE (tile_cache));
......
......@@ -51,8 +51,10 @@ struct _ChamplainTileCacheClass
ChamplainTile *tile,
const gchar *contents,
gsize size);
void (*refresh_tile_time) (ChamplainTileCache *tile_cache, ChamplainTile *tile);
void (*on_tile_filled) (ChamplainTileCache *tile_cache, ChamplainTile *tile);
void (*refresh_tile_time) (ChamplainTileCache *tile_cache,
ChamplainTile *tile);
void (*on_tile_filled) (ChamplainTileCache *tile_cache,
ChamplainTile *tile);
void (*clean) (ChamplainTileCache *tile_cache);
};
......@@ -64,8 +66,10 @@ void champlain_tile_cache_store_tile (ChamplainTileCache *tile_cache,
ChamplainTile *tile,
const gchar *contents,
gsize size);
void champlain_tile_cache_refresh_tile_time (ChamplainTileCache *tile_cache, ChamplainTile *tile);
void champlain_tile_cache_on_tile_filled (ChamplainTileCache *tile_cache, ChamplainTile *tile);
void champlain_tile_cache_refresh_tile_time (ChamplainTileCache *tile_cache,
ChamplainTile *tile);
void champlain_tile_cache_on_tile_filled (ChamplainTileCache *tile_cache,
ChamplainTile *tile);
void champlain_tile_cache_clean (ChamplainTileCache *tile_cache);
G_END_DECLS
......
......@@ -513,7 +513,8 @@ fade_in_completed (ClutterAnimation *animation, ChamplainTile *self)
* Since: 0.4
*/
void
champlain_tile_set_state (ChamplainTile *self, ChamplainState state)
champlain_tile_set_state (ChamplainTile *self,
ChamplainState state)
{
g_return_if_fail (CHAMPLAIN_TILE (self));
......@@ -749,7 +750,8 @@ champlain_tile_get_fade_in (ChamplainTile *self)
* Since: 0.6
*/
void
champlain_tile_set_fade_in (ChamplainTile *self, gboolean fade_in)
champlain_tile_set_fade_in (ChamplainTile *self,
gboolean fade_in)
{
g_return_if_fail (CHAMPLAIN_TILE (self));
......
......@@ -77,7 +77,8 @@ gboolean champlain_tile_get_fade_in (ChamplainTile *self);
void champlain_tile_set_x (ChamplainTile *self,
gint x);
void champlain_tile_set_y (ChamplainTile *self, gint y);
void champlain_tile_set_y (ChamplainTile *self,
gint y);
void champlain_tile_set_zoom_level (ChamplainTile *self,
gint zoom_level);
void champlain_tile_set_size (ChamplainTile *self,
......@@ -90,7 +91,8 @@ void champlain_tile_set_etag (ChamplainTile *self,
const gchar *etag);
void champlain_tile_set_modified_time (ChamplainTile *self,
const GTimeVal *time);
void champlain_tile_set_fade_in (ChamplainTile *self, gboolean fade_in);
void champlain_tile_set_fade_in (ChamplainTile *self,
gboolean fade_in);
G_END_DECLS
......
......@@ -189,39 +189,55 @@ G_DEFINE_TYPE (ChamplainView, champlain_view, CLUTTER_TYPE_GROUP);
static gdouble viewport_get_current_longitude (ChamplainViewPrivate *priv);
static gdouble viewport_get_current_latitude (ChamplainViewPrivate *priv);
static gdouble viewport_get_longitude_at (ChamplainViewPrivate *priv, gint x);
static gdouble viewport_get_latitude_at (ChamplainViewPrivate *priv, gint y);
static gboolean scroll_event (ClutterActor *actor, ClutterScrollEvent *event,
static gdouble viewport_get_longitude_at (ChamplainViewPrivate *priv,
gint x);
static gdouble viewport_get_latitude_at (ChamplainViewPrivate *priv,
gint y);
static gboolean scroll_event (ClutterActor *actor,
ClutterScrollEvent *event,
ChamplainView *view);
static void marker_reposition_cb (ChamplainMarker *marker,
ChamplainView *view);
static void layer_reposition_cb (ClutterActor *layer,
ChamplainView *view);
static void marker_reposition_cb (ChamplainMarker *marker, ChamplainView *view);
static void layer_reposition_cb (ClutterActor *layer, ChamplainView *view);
static gboolean marker_reposition (gpointer data);
static void resize_viewport (ChamplainView *view);
static void champlain_view_get_property (GObject *object, guint prop_id,
GValue *value, GParamSpec *pspec);
static void champlain_view_set_property (GObject *object, guint prop_id,
const GValue *value, GParamSpec *pspec);
static void champlain_view_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec);
static void champlain_view_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec);
static void champlain_view_dispose (GObject *object);
static void champlain_view_class_init (ChamplainViewClass *champlainViewClass);
static void champlain_view_init (ChamplainView *view);
static void viewport_pos_changed_cb (GObject *gobject, GParamSpec *arg1,
static void viewport_pos_changed_cb (GObject *gobject,
GParamSpec *arg1,
ChamplainView *view);
static void notify_marker_reposition_cb (ChamplainMarker *marker,
GParamSpec *arg1, ChamplainView *view);
static void layer_add_marker_cb (ClutterGroup *layer, ChamplainMarker *marker,
GParamSpec *arg1,
ChamplainView *view);
static void layer_add_marker_cb (ClutterGroup *layer,
ChamplainMarker *marker,
ChamplainView *view);
static void connect_marker_notify_cb (ChamplainMarker *marker,
ChamplainView *view);
static gboolean finger_scroll_button_press_cb (ClutterActor *actor,
ClutterButtonEvent *event, ChamplainView *view);
ClutterButtonEvent *event,
ChamplainView *view);
static void update_license (ChamplainView *view);
static void update_scale (ChamplainView *view);
static void view_load_visible_tiles (ChamplainView *view);
static void view_position_tile (ChamplainView* view, ChamplainTile* tile);
static void view_position_tile (ChamplainView* view,
ChamplainTile* tile);
static void view_reload_tiles_cb (ChamplainMapSource *map_source,
ChamplainView* view);
static void view_update_state (ChamplainView *view);
static void view_update_anchor (ChamplainView *view, gint x, gint y);
static void view_update_anchor (ChamplainView *view,
gint x,
gint y);
static gboolean view_set_zoom_level_at (ChamplainView *view,
gint zoom_level,
gint x,
......@@ -246,7 +262,8 @@ static gboolean fill_tile_cb (FillTileCallbackData *data);
#define SCALE_LINE_WIDTH 2
static gdouble
viewport_get_longitude_at (ChamplainViewPrivate *priv, gint x)
viewport_get_longitude_at (ChamplainViewPrivate *priv,
gint x)
{
if (!priv->map_source)
return 0.0;
......@@ -263,7 +280,8 @@ viewport_get_current_longitude (ChamplainViewPrivate *priv)
}
static gdouble
viewport_get_latitude_at (ChamplainViewPrivate *priv, gint y)
viewport_get_latitude_at (ChamplainViewPrivate *priv,
gint y)
{
if (!priv->map_source)
return 0.0;
......@@ -434,10 +452,10 @@ redraw_polygon_on_idle (PolygonRedrawContext *ctx)
if (ctx->polygon)
champlain_polygon_draw_polygon (ctx->polygon,
priv->map_source,
priv->zoom_level,
priv->map_source, priv->zoom_level,
priv->viewport_size.width, priv->viewport_size.height,
priv->viewport_size.x + priv->anchor.x, priv->viewport_size.y + priv->anchor.y);
priv->viewport_size.x + priv->anchor.x,
priv->viewport_size.y + priv->anchor.y);
priv->polygon_redraw_id = 0;
// ctx is freed by g_idle_add_full
......
......@@ -109,11 +109,16 @@ void champlain_view_set_scroll_mode (ChamplainView *view,
ChamplainScrollMode mode);
void champlain_view_set_keep_center_on_resize (ChamplainView *view,
gboolean value);
void champlain_view_set_show_license (ChamplainView *view, gboolean value);
void champlain_view_set_license_text (ChamplainView *view, const gchar *text);
void champlain_view_set_show_scale (ChamplainView *view, gboolean value);
void champlain_view_set_scale_unit (ChamplainView *view, ChamplainUnit unit);
void champlain_view_set_max_scale_width (ChamplainView *view, guint value);
void champlain_view_set_show_license (ChamplainView *view,
gboolean value);
void champlain_view_set_license_text (ChamplainView *view,
const gchar *text);
void champlain_view_set_show_scale (ChamplainView *view,
gboolean value);
void champlain_view_set_scale_unit (ChamplainView *view,
ChamplainUnit unit);
void champlain_view_set_max_scale_width (ChamplainView *view,
guint value);
void champlain_view_set_zoom_on_double_click (ChamplainView *view,
gboolean value);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment