[emerillon] Remove markers together with placemarks
- From: Łukasz Jernaś <ljernas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [emerillon] Remove markers together with placemarks
- Date: Thu, 17 Jun 2010 11:14:32 +0000 (UTC)
commit 90be7c712632901bbc65ec7af2ee7ef902546843
Author: Å?ukasz JernaÅ? <deejay1 srem org>
Date: Thu Jun 17 13:11:04 2010 +0200
Remove markers together with placemarks
TODO | 1 -
plugins/placemarks/manage-dialog.c | 4 +++-
plugins/placemarks/placemarks-model.h | 1 +
plugins/placemarks/placemarks.c | 19 ++++++++++++-------
4 files changed, 16 insertions(+), 9 deletions(-)
---
diff --git a/TODO b/TODO
index 585aafc..1947d30 100644
--- a/TODO
+++ b/TODO
@@ -1,4 +1,3 @@
Plugins:
- placemarks:
- - removing placemarks should also remove the marker
- ability to specify placemark color in the manager dialog
diff --git a/plugins/placemarks/manage-dialog.c b/plugins/placemarks/manage-dialog.c
index 52f0668..34c2b93 100644
--- a/plugins/placemarks/manage-dialog.c
+++ b/plugins/placemarks/manage-dialog.c
@@ -149,6 +149,7 @@ delete_activated_cb (EmpathyCellRendererActivatable *cell,
GtkWidget *msg_dialog;
gint response;
guint ui_id;
+ ChamplainMarker *marker;
model = dialog->priv->model;
@@ -158,6 +159,7 @@ delete_activated_cb (EmpathyCellRendererActivatable *cell,
gtk_tree_model_get (model, &iter,
COL_NAME, &name,
COL_UI_ID, &ui_id,
+ COL_MARKER, &marker,
-1);
msg_dialog = gtk_message_dialog_new (GTK_WINDOW (dialog),
@@ -183,7 +185,7 @@ delete_activated_cb (EmpathyCellRendererActivatable *cell,
ui_id);
gtk_list_store_remove (GTK_LIST_STORE (model), &iter);
-
+ clutter_actor_destroy (CLUTTER_ACTOR(marker));
g_object_unref (window);
}
diff --git a/plugins/placemarks/placemarks-model.h b/plugins/placemarks/placemarks-model.h
index 3abd882..470162f 100644
--- a/plugins/placemarks/placemarks-model.h
+++ b/plugins/placemarks/placemarks-model.h
@@ -31,6 +31,7 @@ enum {
COL_ZOOM,
COL_ZOOM_STR,
COL_UI_ID,
+ COL_MARKER,
COL_COUNT
};
diff --git a/plugins/placemarks/placemarks.c b/plugins/placemarks/placemarks.c
index b31b9b8..b8e8784 100644
--- a/plugins/placemarks/placemarks.c
+++ b/plugins/placemarks/placemarks.c
@@ -100,15 +100,16 @@ go_cb (GtkAction *action,
champlain_view_center_on (priv->map_view, lat, lon);
}
-static void
+static ChamplainMarker *
add_marker(PlacemarksPlugin *plugin, const gchar *name, gdouble lat, gdouble lon)
{
PlacemarksPluginPrivate *priv;
priv = PLACEMARKS_PLUGIN (plugin)->priv;
- ClutterActor *marker;
+ ChamplainMarker *marker;
ClutterColor orange = { 0xf3, 0x94, 0x07, 0xbb };
- marker = champlain_marker_new_with_text (name, "Serif 14", NULL, NULL);
+ marker = CHAMPLAIN_MARKER ( champlain_marker_new_with_text (name, "Serif 14",
+ NULL, NULL));
champlain_marker_set_use_markup (CHAMPLAIN_MARKER (marker), TRUE);
champlain_marker_set_alignment (CHAMPLAIN_MARKER (marker), PANGO_ALIGN_RIGHT);
champlain_marker_set_color (CHAMPLAIN_MARKER (marker), &orange);
@@ -116,6 +117,8 @@ add_marker(PlacemarksPlugin *plugin, const gchar *name, gdouble lat, gdouble lon
champlain_base_marker_set_position (CHAMPLAIN_BASE_MARKER (marker),
lat, lon);
champlain_layer_add_marker (priv->markers_layer, CHAMPLAIN_BASE_MARKER (marker));
+
+ return marker;
}
static guint
@@ -266,12 +269,14 @@ add_placemark (PlacemarksPlugin *plugin,
gchar *lat_str, *lon_str, *zoom_str;
GtkTreeIter iter;
PlacemarksPluginPrivate *priv;
+ ChamplainMarker *marker;
priv = PLACEMARKS_PLUGIN (plugin)->priv;
lat_str = g_strdup_printf ("%f", lat);
lon_str = g_strdup_printf ("%f", lon);
zoom_str = g_strdup_printf ("%d", zoom);
+ marker = add_marker (plugin, name, lat, lon);
gtk_list_store_append (GTK_LIST_STORE (priv->model), &iter);
gtk_list_store_set (GTK_LIST_STORE (priv->model), &iter,
@@ -283,6 +288,7 @@ add_placemark (PlacemarksPlugin *plugin,
COL_LON_STR, lon_str,
COL_ZOOM, zoom,
COL_ZOOM_STR, zoom_str,
+ COL_MARKER, marker,
-1);
g_free (lat_str);
@@ -437,9 +443,8 @@ load_placemarks (PlacemarksPlugin *plugin)
}
add_placemark (plugin, groups[i], name, lat, lon, zoom);
- add_marker (plugin, name, lat, lon);
- g_free (name);
+ g_free (name);
}
g_strfreev (groups);
@@ -481,7 +486,6 @@ add_cb (GtkAction *action,
add_menu (plugin, id, name, &iter);
save_placemarks (plugin);
- add_marker (plugin, name, lat, lon);
g_free (id);
}
@@ -587,7 +591,8 @@ activated (EthosPlugin *plugin)
G_TYPE_STRING, /* Longitude as a string */
G_TYPE_INT, /* Zoom level */
G_TYPE_STRING, /* Zoom level as a string */
- G_TYPE_UINT); /* UI ID */
+ G_TYPE_UINT, /* UI ID */
+ G_TYPE_POINTER); /* Marker pointer */
priv->model = GTK_TREE_MODEL (store);
priv->deleted_cb_id = g_signal_connect (priv->model,
"row-deleted",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]