[Xfce4-commits] <xfce4-weather-plugin:master> Remove openstreetmap parsing code from weather-search.
Harald Judt
noreply at xfce.org
Fri Aug 3 01:06:05 CEST 2012
Updating branch refs/heads/master
to 623dbd0577340db59fa55f0b974c7ab5838f6fc2 (commit)
from 182e417afb7f522732e9038918f6e58c7a8ede0a (commit)
commit 623dbd0577340db59fa55f0b974c7ab5838f6fc2
Author: Harald Judt <h.judt at gmx.at>
Date: Fri Aug 3 00:36:20 2012 +0200
Remove openstreetmap parsing code from weather-search.
Use code which now resides in weather-parsers.
panel-plugin/weather-search.c | 39 +++++++++++++++------------------------
1 files changed, 15 insertions(+), 24 deletions(-)
diff --git a/panel-plugin/weather-search.c b/panel-plugin/weather-search.c
index 9a8f27c..6ed1780 100644
--- a/panel-plugin/weather-search.c
+++ b/panel-plugin/weather-search.c
@@ -86,7 +86,7 @@ cb_searchdone(const gboolean succeed,
search_dialog *dialog = (search_dialog *) user_data;
xmlDoc *doc;
xmlNode *cur_node;
- gchar *lat, *lon, *city;
+ xml_place *place;
gint found = 0;
GtkTreeIter iter;
GtkTreeSelection *selection;
@@ -110,31 +110,22 @@ cb_searchdone(const gboolean succeed,
cur_node = xmlDocGetRootElement(doc);
if (cur_node) {
- for (cur_node = cur_node->children; cur_node; cur_node = cur_node->next)
- if (NODE_IS_TYPE(cur_node, "place")) {
- lat = (gchar *) xmlGetProp(cur_node, (const xmlChar *) "lat");
- if (!lat)
- continue;
- lon = (gchar *) xmlGetProp(cur_node, (const xmlChar *) "lon");
- if (!lon) {
- g_free(lat);
- continue;
- }
- city = (gchar *) xmlGetProp(cur_node,
- (const xmlChar *) "display_name");
-
- if (!city) {
- g_free(lat);
- g_free(lon);
- continue;
- }
-
- append_result(dialog->result_mdl, lat, lon, city);
+ for (cur_node = cur_node->children; cur_node;
+ cur_node = cur_node->next) {
+ place = parse_place(cur_node);
+
+ if (place && place->lat && place->lon && place->display_name) {
+ append_result(dialog->result_mdl,
+ place->lat, place->lon, place->display_name);
found++;
- g_free(lat);
- g_free(lon);
- g_free(city);
}
+
+ if (place) {
+ xml_place_free(place);
+ place = NULL;
+ }
+
+ }
}
xmlFreeDoc(doc);
More information about the Xfce4-commits
mailing list