[libchamplain] Remove the 'map-data-changed' signal from MapDataSource



commit 6e4f4234e6b5bf7c94fd24af925aec31b2fb9ede
Author: Simon Wenner <simon wenner ch>
Date:   Thu Jul 30 16:36:15 2009 +0200

    Remove the 'map-data-changed' signal from MapDataSource
    
    The 'notify::state' signal makes this signal redundant.

 champlain/champlain-local-map-data-source.c   |    3 ---
 champlain/champlain-map-data-source.c         |   19 +------------------
 champlain/champlain-memphis-map-source.c      |    8 +++++++-
 champlain/champlain-network-map-data-source.c |    3 ---
 4 files changed, 8 insertions(+), 25 deletions(-)
---
diff --git a/champlain/champlain-local-map-data-source.c b/champlain/champlain-local-map-data-source.c
index a108ecb..016dfec 100644
--- a/champlain/champlain-local-map-data-source.c
+++ b/champlain/champlain-local-map-data-source.c
@@ -146,7 +146,4 @@ champlain_local_map_data_source_load_map_data (ChamplainLocalMapDataSource *self
   champlain_bounding_box_free (bbox);
 
   g_object_set (G_OBJECT (self), "state", CHAMPLAIN_STATE_DONE, NULL);
-
-  g_signal_emit_by_name (CHAMPLAIN_MAP_DATA_SOURCE (self),
-      "map-data-changed", NULL);
 }
diff --git a/champlain/champlain-map-data-source.c b/champlain/champlain-map-data-source.c
index 774af0d..5477fd4 100644
--- a/champlain/champlain-map-data-source.c
+++ b/champlain/champlain-map-data-source.c
@@ -30,7 +30,6 @@ G_DEFINE_TYPE (ChamplainMapDataSource, champlain_map_data_source, G_TYPE_OBJECT)
 
 enum
 {
-  MAP_DATA_CHANGED,
   LAST_SIGNAL
 };
 
@@ -41,14 +40,13 @@ enum
   PROP_STATE
 };
 
-static guint signals[LAST_SIGNAL] = { 0, };
-
 typedef struct _ChamplainMapDataSourcePrivate ChamplainMapDataSourcePrivate;
 
 struct _ChamplainMapDataSourcePrivate {
   ChamplainBoundingBox *bounding_box;
   /* the area that is covered by this data source */
   ChamplainState state;
+  /* the state of the map data */
 };
 
 static void
@@ -165,21 +163,6 @@ champlain_map_data_source_class_init (ChamplainMapDataSourceClass *klass)
            CHAMPLAIN_TYPE_STATE,
            CHAMPLAIN_STATE_INIT,
            G_PARAM_READWRITE));
-
-  /**
-  * ChamplainMapDataSource::map-data-changed:
-  * @map_data_source: the #ChamplainMapDataSource that received the signal
-  *
-  * The ::map-data-changed signal is emitted when the map data was
-  * replaced or modified
-  *
-  * Since: 0.6
-  */
-  signals[MAP_DATA_CHANGED] =
-      g_signal_new ("map-data-changed", G_OBJECT_CLASS_TYPE (object_class),
-          G_SIGNAL_RUN_LAST, 0, NULL, NULL,
-          g_cclosure_marshal_VOID__VOID, G_TYPE_NONE,
-          0, NULL);
 }
 
 static void
diff --git a/champlain/champlain-memphis-map-source.c b/champlain/champlain-memphis-map-source.c
index 4b2df63..c577393 100644
--- a/champlain/champlain-memphis-map-source.c
+++ b/champlain/champlain-memphis-map-source.c
@@ -155,6 +155,7 @@ champlain_memphis_map_source_finalize (GObject *object)
 
 static void
 map_data_changed_cb (ChamplainMapDataSource *map_data_source,
+    GParamSpec *gobject,
     ChamplainMemphisMapSource *map_source)
 {
   g_assert (CHAMPLAIN_IS_MAP_DATA_SOURCE (map_data_source) &&
@@ -162,6 +163,11 @@ map_data_changed_cb (ChamplainMapDataSource *map_data_source,
 
   MemphisMap *map;
   ChamplainMemphisMapSourcePrivate *priv = GET_PRIVATE(map_source);
+  ChamplainState state;
+
+  g_object_get (G_OBJECT (map_data_source), "state", &state, NULL);
+  if (state != CHAMPLAIN_STATE_DONE)
+    return;
 
   map = champlain_map_data_source_get_map_data (map_data_source);
   if (map == NULL)
@@ -438,7 +444,7 @@ champlain_memphis_map_source_new_full (ChamplainMapSourceDesc *desc,
   priv = GET_PRIVATE(source);
   priv->map_data_source = g_object_ref (map_data_source);
 
-  g_signal_connect (priv->map_data_source, "map-data-changed",
+  g_signal_connect (priv->map_data_source, "notify::state",
       G_CALLBACK (map_data_changed_cb), source);
 
   priv->rules = memphis_rule_set_new ();
diff --git a/champlain/champlain-network-map-data-source.c b/champlain/champlain-network-map-data-source.c
index c48f926..19b1c69 100644
--- a/champlain/champlain-network-map-data-source.c
+++ b/champlain/champlain-network-map-data-source.c
@@ -249,9 +249,6 @@ load_map_data_cb (SoupSession *session, SoupMessage *msg,
   champlain_bounding_box_free (bbox);
 
   g_object_set (G_OBJECT (self), "state", CHAMPLAIN_STATE_DONE, NULL);
-
-  g_signal_emit_by_name (CHAMPLAIN_MAP_DATA_SOURCE (self),
-       "map-data-changed", NULL);
 }
 
 



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