[gnome-applets] gweather: build with libgweather 3.7.3 or newer



commit 7a7d04817b858bc140e10d6788b0259744787a4a
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Fri Jul 4 15:36:45 2014 +0300

    gweather: build with libgweather 3.7.3 or newer
    
    - Bump gweather required version to 3.7.3. With this version
      gweather-xml.[c/h] files was removed.
    - Use added gweather-xml.h file not from libgweather library.
    - Update gweather-xml.c.

 configure.ac             |    4 ++--
 gweather/Makefile.am     |    1 +
 gweather/gweather-pref.c |    2 +-
 gweather/gweather-xml.c  |   46 ++++++++++++++++++++++++++++------------------
 gweather/gweather-xml.h  |    1 -
 5 files changed, 32 insertions(+), 22 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 4a2621b..753fdfe 100644
--- a/configure.ac
+++ b/configure.ac
@@ -27,7 +27,7 @@ DBUS_REQUIRED=1.1.2
 DBUS_GLIB_REQUIRED=0.74
 GNOME_ICON_THEME_REQUIRED=2.15.91
 LIBXML_REQUIRED=2.5.0
-GWEATHER_REQUIRED=3.5.0
+GWEATHER_REQUIRED=3.7.3
 GUCHARMAP3_REQUIRED=2.33.0
 POLKIT_REQUIRED=0.92
 NETWORKMANAGER_REQUIRED=0.7
@@ -268,7 +268,7 @@ AC_SUBST(XML2_LIBS)
 
  dnl -- check for libgweather (required for gweather applet) ------------------
 build_libgweather_applets=false
-PKG_CHECK_MODULES(LIBGWEATHER, gweather-3.0 >= $GWEATHER_REQUIRED gweather-3.0 <= 3.7,
+PKG_CHECK_MODULES(LIBGWEATHER, gweather-3.0 >= $GWEATHER_REQUIRED,
                  build_libgweather_applets=true,
                  AC_MSG_WARN([libgweather not found. Not building the weather applet.]))
 AC_SUBST(LIBGWEATHER_CFLAGS)
diff --git a/gweather/Makefile.am b/gweather/Makefile.am
index 24e93a1..265a4e6 100644
--- a/gweather/Makefile.am
+++ b/gweather/Makefile.am
@@ -21,6 +21,7 @@ gweather_applet_2_SOURCES = \
        main.c \
        gweather-about.c gweather-about.h \
        gweather-pref.c gweather-pref.h \
+       gweather-xml.c gweather-xml.h \
        gweather-dialog.c gweather-dialog.h \
        gweather-applet.c gweather-applet.h
 
diff --git a/gweather/gweather-pref.c b/gweather/gweather-pref.c
index 23dd571..738d3b2 100644
--- a/gweather/gweather-pref.c
+++ b/gweather/gweather-pref.c
@@ -29,7 +29,7 @@
 
 #define GWEATHER_I_KNOW_THIS_IS_UNSTABLE
 
-#include <libgweather/gweather-xml.h>
+#include "gweather-xml.h"
 #include "gweather.h"
 #include "gweather-pref.h"
 #include "gweather-applet.h"
diff --git a/gweather/gweather-xml.c b/gweather/gweather-xml.c
index fa39618..2aa515f 100644
--- a/gweather/gweather-xml.c
+++ b/gweather/gweather-xml.c
@@ -29,8 +29,8 @@
 #include <libxml/xmlreader.h>
 
 #define GWEATHER_I_KNOW_THIS_IS_UNSTABLE
+#include <libgweather/gweather-weather.h>
 #include "gweather-xml.h"
-#include "weather-priv.h"
 
 
 /**
@@ -46,8 +46,9 @@ gweather_xml_parse_node (GWeatherLocation *gloc,
     GtkTreeIter iter, *self = &iter;
     GWeatherLocation **children, *parent_loc;
     GWeatherLocationLevel level;
-    WeatherLocation *wloc;
-    const char *name;
+    const char *name, *code;
+    double latitude, longitude;
+    gboolean has_coords;
     int i;
 
     name = gweather_location_get_name (gloc);
@@ -55,7 +56,6 @@ gweather_xml_parse_node (GWeatherLocation *gloc,
     level = gweather_location_get_level (gloc);
 
     if (!children[0] && level < GWEATHER_LOCATION_WEATHER_STATION) {
-       gweather_location_free_children (gloc, children);
        return TRUE;
     }
 
@@ -85,14 +85,19 @@ gweather_xml_parse_node (GWeatherLocation *gloc,
                            GWEATHER_XML_COL_LOCATION_NAME, name,
                            -1);
        if (children[0] && !children[1]) {
-           wloc = _weather_location_from_gweather_location (children[0], name);
+           code = gweather_location_get_code (children[0]);
+           has_coords = gweather_location_has_coords (children[0]);
+           latitude = longitude = 0;
+           if (has_coords) {
+               gweather_location_get_coords (children[0], &latitude, &longitude);
+           }
+
            gtk_tree_store_set (store, &iter,
-                               GWEATHER_XML_COL_METAR_CODE, wloc->code,
-                               GWEATHER_XML_COL_LATLON_VALID, wloc->latlon_valid,
-                               GWEATHER_XML_COL_LATITUDE, wloc->latitude,
-                               GWEATHER_XML_COL_LONGITUDE, wloc->longitude,
+                               GWEATHER_XML_COL_METAR_CODE, code,
+                               GWEATHER_XML_COL_LATLON_VALID, has_coords,
+                               GWEATHER_XML_COL_LATITUDE, latitude,
+                               GWEATHER_XML_COL_LONGITUDE, longitude,
                                -1);
-           _weather_location_free (wloc);
        }
        break;
 
@@ -105,14 +110,21 @@ gweather_xml_parse_node (GWeatherLocation *gloc,
        parent_loc = gweather_location_get_parent (gloc);
        if (parent_loc && gweather_location_get_level (parent_loc) == GWEATHER_LOCATION_CITY)
            name = gweather_location_get_name (parent_loc);
-       wloc = _weather_location_from_gweather_location (gloc, name);
+
+       code = gweather_location_get_code (gloc);
+       has_coords = gweather_location_has_coords (gloc);
+       latitude = longitude = 0;
+       if (has_coords) {
+               gweather_location_get_coords (gloc, &latitude, &longitude);
+       }
+       
        gtk_tree_store_set (store, &iter,
-                           GWEATHER_XML_COL_METAR_CODE, wloc->code,
-                           GWEATHER_XML_COL_LATLON_VALID, wloc->latlon_valid,
-                           GWEATHER_XML_COL_LATITUDE, wloc->latitude,
-                           GWEATHER_XML_COL_LONGITUDE, wloc->longitude,
+                           GWEATHER_XML_COL_METAR_CODE, code,
+                           GWEATHER_XML_COL_LATLON_VALID, has_coords,
+                           GWEATHER_XML_COL_LATITUDE, latitude,
+                           GWEATHER_XML_COL_LONGITUDE, longitude,
                            -1);
-       _weather_location_free (wloc);
+       break;
 
     case GWEATHER_LOCATION_DETACHED:
        g_assert_not_reached ();
@@ -122,12 +134,10 @@ gweather_xml_parse_node (GWeatherLocation *gloc,
 
     for (i = 0; children[i]; i++) {
        if (!gweather_xml_parse_node (children[i], store, self)) {
-           gweather_location_free_children (gloc, children);
            return FALSE;
        }
     }
 
-    gweather_location_free_children (gloc, children);
     return TRUE;
 }
 
diff --git a/gweather/gweather-xml.h b/gweather/gweather-xml.h
index b5679c4..117b2c9 100644
--- a/gweather/gweather-xml.h
+++ b/gweather/gweather-xml.h
@@ -22,7 +22,6 @@
 #define __GWEATHER_XML_H__
 
 #include <gtk/gtk.h>
-#include <libgweather/gweather-weather.h>
 
 enum
 {


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