[libshumate] map-source: Add fill_tile_finish to allow subclassing it.



commit cb870bed4daa732555192cf904ba694053f9f294
Author: Corentin Noël <corentin noel collabora com>
Date:   Mon Jan 3 09:43:45 2022 +0100

    map-source: Add fill_tile_finish to allow subclassing it.
    
    This makes sure that implementing this function is possible with bindings.
    
    Signed-off-by: Corentin Noël <corentin noel collabora com>

 shumate/shumate-map-source.c      |  4 ++--
 shumate/shumate-map-source.h      |  3 +++
 shumate/shumate-raster-renderer.c | 18 ++++++++++++++++++
 shumate/shumate-vector-renderer.c | 18 ++++++++++++++++++
 4 files changed, 41 insertions(+), 2 deletions(-)
---
diff --git a/shumate/shumate-map-source.c b/shumate/shumate-map-source.c
index 3f6509e..ebde962 100644
--- a/shumate/shumate-map-source.c
+++ b/shumate/shumate-map-source.c
@@ -701,9 +701,9 @@ shumate_map_source_fill_tile_finish (ShumateMapSource  *self,
                                      GError           **error)
 {
   g_return_val_if_fail (SHUMATE_IS_MAP_SOURCE (self), FALSE);
-  g_return_val_if_fail (g_task_is_valid (result, self), FALSE);
+  g_return_val_if_fail (G_IS_ASYNC_RESULT (result), FALSE);
 
-  return g_task_propagate_boolean (G_TASK (result), error);
+  return SHUMATE_MAP_SOURCE_GET_CLASS (self)->fill_tile_finish (self, result, error);
 }
 
 /**
diff --git a/shumate/shumate-map-source.h b/shumate/shumate-map-source.h
index 51a9c62..4046e9c 100644
--- a/shumate/shumate-map-source.h
+++ b/shumate/shumate-map-source.h
@@ -51,6 +51,9 @@ struct _ShumateMapSourceClass
                             GCancellable         *cancellable,
                             GAsyncReadyCallback   callback,
                             gpointer              user_data);
+  gboolean (*fill_tile_finish) (ShumateMapSource  *self,
+                                GAsyncResult      *result,
+                                GError           **error);
 };
 
 const char *shumate_map_source_get_id (ShumateMapSource *map_source);
diff --git a/shumate/shumate-raster-renderer.c b/shumate/shumate-raster-renderer.c
index c16a4b5..9363123 100644
--- a/shumate/shumate-raster-renderer.c
+++ b/shumate/shumate-raster-renderer.c
@@ -279,6 +279,10 @@ static void shumate_raster_renderer_fill_tile_async (ShumateMapSource    *map_so
                                                      GAsyncReadyCallback  callback,
                                                      gpointer             user_data);
 
+static gboolean shumate_raster_renderer_fill_tile_finish (ShumateMapSource  *map_source,
+                                                          GAsyncResult      *result,
+                                                          GError           **error);
+
 static void
 shumate_raster_renderer_class_init (ShumateRasterRendererClass *klass)
 {
@@ -291,6 +295,7 @@ shumate_raster_renderer_class_init (ShumateRasterRendererClass *klass)
   object_class->set_property = shumate_raster_renderer_set_property;
 
   map_source_class->fill_tile_async = shumate_raster_renderer_fill_tile_async;
+  map_source_class->fill_tile_finish = shumate_raster_renderer_fill_tile_finish;
 
   /**
    * ShumateRasterRenderer:data-source:
@@ -349,6 +354,19 @@ shumate_raster_renderer_fill_tile_async (ShumateMapSource    *map_source,
                                            g_steal_pointer (&task));
 }
 
+static gboolean
+shumate_raster_renderer_fill_tile_finish (ShumateMapSource  *map_source,
+                                          GAsyncResult      *result,
+                                          GError           **error)
+{
+  ShumateRasterRenderer *self = (ShumateRasterRenderer *)map_source;
+
+  g_return_val_if_fail (SHUMATE_IS_RASTER_RENDERER (self), FALSE);
+  g_return_val_if_fail (g_task_is_valid (result, self), FALSE);
+
+  return g_task_propagate_boolean (G_TASK (result), error);
+}
+
 static void
 on_data_source_done (GObject *object, GAsyncResult *res, gpointer user_data)
 {
diff --git a/shumate/shumate-vector-renderer.c b/shumate/shumate-vector-renderer.c
index c376aaa..4384604 100644
--- a/shumate/shumate-vector-renderer.c
+++ b/shumate/shumate-vector-renderer.c
@@ -309,6 +309,10 @@ static void shumate_vector_renderer_fill_tile_async (ShumateMapSource    *map_so
                                                      GAsyncReadyCallback  callback,
                                                      gpointer             user_data);
 
+static gboolean shumate_vector_renderer_fill_tile_finish (ShumateMapSource  *map_source,
+                                                          GAsyncResult      *result,
+                                                          GError           **error);
+
 static void
 shumate_vector_renderer_class_init (ShumateVectorRendererClass *klass)
 {
@@ -321,6 +325,7 @@ shumate_vector_renderer_class_init (ShumateVectorRendererClass *klass)
   object_class->set_property = shumate_vector_renderer_set_property;
 
   map_source_class->fill_tile_async = shumate_vector_renderer_fill_tile_async;
+  map_source_class->fill_tile_finish = shumate_vector_renderer_fill_tile_finish;
 
   /**
    * ShumateVectorRenderer:data-source:
@@ -526,6 +531,19 @@ shumate_vector_renderer_fill_tile_async (ShumateMapSource    *map_source,
                                            g_steal_pointer (&task));
 }
 
+static gboolean
+shumate_vector_renderer_fill_tile_finish (ShumateMapSource  *map_source,
+                                          GAsyncResult      *result,
+                                          GError           **error)
+{
+  ShumateVectorRenderer *self = (ShumateVectorRenderer *)map_source;
+
+  g_return_val_if_fail (SHUMATE_IS_VECTOR_RENDERER (self), FALSE);
+  g_return_val_if_fail (g_task_is_valid (result, self), FALSE);
+
+  return g_task_propagate_boolean (G_TASK (result), error);
+}
+
 static void
 on_data_source_done (GObject *object, GAsyncResult *res, gpointer user_data)
 {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]