]> err.no Git - libchamplain/commitdiff
Change markers constructors: new_from_file, new_with_image and new_full
authorPierre-Luc Beaudoin <pierre-luc@pierlux.com>
Mon, 13 Apr 2009 18:45:29 +0000 (14:45 -0400)
committerPierre-Luc Beaudoin <pierre-luc@pierlux.com>
Mon, 13 Apr 2009 18:45:29 +0000 (14:45 -0400)
champlain/champlain-marker.c
champlain/champlain-marker.h
demos/markers.c

index b1008409877d0db53ef3cd3498d4afa097e3fc1c..415e1bb0195444ebcf982408d6bf54740e0de7ee 100644 (file)
@@ -595,9 +595,9 @@ champlain_marker_new (void)
  */
 ClutterActor *
 champlain_marker_new_with_text (const gchar *text,
-                                 const gchar *font,
-                                 ClutterColor *text_color,
-                                 ClutterColor *marker_color)
+    const gchar *font,
+    ClutterColor *text_color,
+    ClutterColor *marker_color)
 {
   ChamplainMarker *marker = CHAMPLAIN_MARKER (champlain_marker_new ());
 
@@ -626,7 +626,31 @@ champlain_marker_new_with_text (const gchar *text,
  * Since: 0.2
  */
 ClutterActor *
-champlain_marker_new_with_image (const gchar *filename, GError **error)
+champlain_marker_new_with_image (ClutterActor *actor,
+    GError **error)
+{
+  ChamplainMarker *marker = CHAMPLAIN_MARKER (champlain_marker_new ());
+  if (actor != NULL)
+    {
+      champlain_marker_set_image (marker, actor);
+    }
+
+  return CLUTTER_ACTOR (marker);
+}
+
+/**
+ * champlain_marker_new_from_file:
+ * @filename: The filename of the image.
+ * @error: Return location for an error.
+ *
+ * Returns a new #ChamplainMarker with a drawn marker containing the given
+ * image.
+ *
+ * Since: 0.2
+ */
+ClutterActor *
+champlain_marker_new_from_file (const gchar *filename,
+    GError **error)
 {
   if (filename == NULL)
     return NULL;
@@ -643,12 +667,9 @@ champlain_marker_new_with_image (const gchar *filename, GError **error)
 }
 
 /**
- * champlain_marker_new_with_image_full:
- * @filename: The name of an image file to load.
- * @width: Width of the image in pixel or -1.
- * @height: Height of the image in pixel or -1.
- * @anchor_x: X coordinate of the anchor point.
- * @anchor_y: Y coordinate of the anchor point.
+ * champlain_marker_new_full:
+ * @text: The text
+ * @actor: The image
  * @error: Return location for an error.
  *
  * Returns a new #ChamplainMarker with a drawn marker containing the given
@@ -658,15 +679,10 @@ champlain_marker_new_with_image (const gchar *filename, GError **error)
  */
 ClutterActor *
 champlain_marker_new_full (const gchar *text,
-    const gchar *filename,
+    ClutterActor *actor,
     GError **error)
 {
-  if (filename == NULL)
-    return NULL;
-
   ChamplainMarker *marker = CHAMPLAIN_MARKER (champlain_marker_new ());
-  ClutterActor *actor = clutter_texture_new_from_file (filename, error);
-
   if (actor != NULL)
     {
       champlain_marker_set_image (marker, actor);
index 7269bd470ca31de20bd25383fa70bc881b0b28e8..f7d2157434b5af6731f366b1fa5e8238c792ab01 100644 (file)
@@ -61,11 +61,14 @@ ClutterActor *champlain_marker_new (void);
 ClutterActor *champlain_marker_new_with_text (const gchar *text,
     const gchar *font, ClutterColor *text_color, ClutterColor *marker_color);
 
-ClutterActor *champlain_marker_new_with_image (const gchar *filename,
+ClutterActor *champlain_marker_new_with_image (ClutterActor *actor,
+    GError **error);
+
+ClutterActor *champlain_marker_new_from_file (const gchar *filename,
     GError **error);
 
 ClutterActor *champlain_marker_new_full (const gchar *text,
-    const gchar *image_filename,
+    ClutterActor *actor,
     GError **error);
 
 void champlain_marker_set_text (ChamplainMarker *marker,
index 6bfa883c2b264d3e5a1ea3f7d05858ccd1942634..19a65e11178b9a665cdc1fb256b3ef349ba8a9a4 100644 (file)
@@ -54,16 +54,17 @@ create_marker_layer (ChamplainView *view)
   g_signal_connect_after (marker, "button-release-event",
       G_CALLBACK (marker_button_release_cb), view);
 
-  marker = champlain_marker_new_full ("New York", "/usr/share/icons/gnome/24x24/emblems/emblem-generic.png", NULL);
+  marker = champlain_marker_new_from_file ("/usr/share/icons/gnome/24x24/emblems/emblem-generic.png", NULL);
+  champlain_marker_set_text (CHAMPLAIN_MARKER (marker), "New York");
   champlain_base_marker_set_position (CHAMPLAIN_BASE_MARKER (marker), 40.77, -73.98);
   clutter_container_add (CLUTTER_CONTAINER (layer), marker, NULL);
 
-  marker = champlain_marker_new_with_image ("/usr/share/icons/Tango/24x24/emblems/emblem-important.png", NULL);
+  marker = champlain_marker_new_from_file ("/usr/share/icons/Tango/24x24/emblems/emblem-important.png", NULL);
   champlain_base_marker_set_position (CHAMPLAIN_BASE_MARKER (marker), 47.130885,
       -70.764141);
   clutter_container_add (CLUTTER_CONTAINER (layer), marker, NULL);
 
-  marker = champlain_marker_new_with_image ("/usr/share/icons/Tango/24x24/emblems/emblem-favorite.png", NULL);
+  marker = champlain_marker_new_from_file ("/usr/share/icons/Tango/24x24/emblems/emblem-favorite.png", NULL);
   champlain_marker_set_draw_background (CHAMPLAIN_MARKER (marker), FALSE);
   champlain_base_marker_set_position (CHAMPLAIN_BASE_MARKER (marker), 45.41484,
       -71.918907);