Re: libchamplain 0.8 python bindings



Am 18.10.2010 14:28, schrieb Patrick Salecker:
ChamplainMarker.set_image(None) doesn’t work because it requires a Clutter.Actor in the generated gir file and doesn't allow the parameter None to remove the image. Maybe this could be fixed in libchamplain.
It took a while, but now I have looked into it, the right introspection annotation is "(allow-none)":
Only valid for parameters. Means that the caller may pass in NULL instead of a pointer to a string/struct/object.
For more information see: http://live.gnome.org/GObjectIntrospection/Annotations

I also changed it for a few other methods, I simply used "grep 'or NULL' *.c| grep @".

I noticed that I have to manually copy/move/link the .typelib files from /usr/local/lib/girepository-1.0 to /usr/lib/girepository-1.0/, otherwise PyGi can't find Champlain.
diff --git a/champlain/champlain-map-source-factory.c b/champlain/champlain-map-source-factory.c
index f4e57e8..7c0786a 100644
--- a/champlain/champlain-map-source-factory.c
+++ b/champlain/champlain-map-source-factory.c
@@ -458,7 +458,7 @@ champlain_map_source_factory_create_error_source (ChamplainMapSourceFactory *fac
  * @factory: A #ChamplainMapSourceFactory
  * @desc: the description of the map source
  * @constructor: the new map source constructor function
- * @data: data to be passed to the constructor function, or NULL
+ * @data: (allow-none): data to be passed to the constructor function, or NULL
  *
  * Registers the new map source with the given constructor.  When this map
  * source is requested, the given constructor will be used to build the
diff --git a/champlain/champlain-marker.c b/champlain/champlain-marker.c
index 3d68e43..9163cf1 100644
--- a/champlain/champlain-marker.c
+++ b/champlain/champlain-marker.c
@@ -1032,7 +1032,7 @@ champlain_marker_set_text (ChamplainMarker *marker,
 /**
  * champlain_marker_set_image:
  * @marker: The marker.
- * @image: The image as a @ClutterActor or NULL to remove the current image.
+ * @image: (allow-none): The image as a @ClutterActor or NULL to remove the current image.
  *
  * Sets the marker's image.
  *
@@ -1107,7 +1107,7 @@ champlain_marker_set_alignment (ChamplainMarker *marker,
 /**
  * champlain_marker_set_color:
  * @marker: The marker
- * @color: The marker's background color or NULL to reset the background to the
+ * @color: (allow-none): The marker's background color or NULL to reset the background to the
  *         default color. The color parameter is copied.
  *
  * Set the marker's background color.
@@ -1137,7 +1137,7 @@ champlain_marker_set_color (ChamplainMarker *marker,
 /**
  * champlain_marker_set_text_color:
  * @marker: The marker
- * @color: The marker's text color or NULL to reset the text to the default
+ * @color: (allow-none): The marker's text color or NULL to reset the text to the default
  *         color. The color parameter is copied.
  *
  * Set the marker's text color.
@@ -1167,7 +1167,7 @@ champlain_marker_set_text_color (ChamplainMarker *marker,
 /**
  * champlain_marker_set_font_name:
  * @marker: The marker
- * @font_name: The marker's font name or NULL to reset the font to the default
+ * @font_name: (allow-none): The marker's font name or NULL to reset the font to the default
  *             value.
  *
  * Set the marker's font name such as "Sans 12".
diff --git a/champlain/champlain-polygon.c b/champlain/champlain-polygon.c
index 9bc7ad2..04d5b44 100644
--- a/champlain/champlain-polygon.c
+++ b/champlain/champlain-polygon.c
@@ -492,7 +492,7 @@ champlain_polygon_get_points (ChamplainPolygon *polygon)
 /**
  * champlain_polygon_set_fill_color:
  * @polygon: The polygon
- * @color: The polygon's fill color or NULL to reset to the
+ * @color: (allow-none): The polygon's fill color or NULL to reset to the
  *         default color. The color parameter is copied.
  *
  * Set the polygon's fill color.
@@ -521,7 +521,7 @@ champlain_polygon_set_fill_color (ChamplainPolygon *polygon,
 /**
  * champlain_polygon_set_stroke_color:
  * @polygon: The polygon
- * @color: The polygon's stroke color or NULL to reset to the
+ * @color: (allow-none): The polygon's stroke color or NULL to reset to the
  *         default color. The color parameter is copied.
  *
  * Set the polygon's stroke color.


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