[libgweather] Reintroduce the minimum API required to get apps to build



commit 183010914c3d3ce02552f2739f0bd230427f70d8
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Sun Jul 21 15:45:33 2013 +0200

    Reintroduce the minimum API required to get apps to build
    
    gnome-weather can be follow the API break (and it's a runtime
    dependency anyway), but I don't want to break the other apps,
    so let's reintroduce the minimum deprecated stuff to make them
    build.

 libgweather/gweather-enums.h    |    6 ++++++
 libgweather/gweather-location.c |    7 +++++++
 libgweather/gweather-location.h |    4 ++++
 libgweather/gweather-weather.h  |    7 ++++++-
 libgweather/weather.c           |   35 ++++++++++++++++++++++++++++++++++-
 5 files changed, 57 insertions(+), 2 deletions(-)
---
diff --git a/libgweather/gweather-enums.h b/libgweather/gweather-enums.h
index 57a34e1..e994a5b 100644
--- a/libgweather/gweather-enums.h
+++ b/libgweather/gweather-enums.h
@@ -58,4 +58,10 @@ typedef enum { /*< underscore_name=gweather_distance_unit >*/
     GWEATHER_DISTANCE_UNIT_MILES
 } GWeatherDistanceUnit;
 
+typedef enum { /*< underscore_name=gweather_forecast_type >*/
+    GWEATHER_FORECAST_STATE,
+    GWEATHER_FORECAST_ZONE,
+    GWEATHER_FORECAST_LIST
+} GWeatherForecastType;
+
 #endif /* __GWEATHER_ENUMS_H_ */
diff --git a/libgweather/gweather-location.c b/libgweather/gweather-location.c
index 7bdec54..acf54c8 100644
--- a/libgweather/gweather-location.c
+++ b/libgweather/gweather-location.c
@@ -324,6 +324,13 @@ gweather_location_get_world (void)
     return global_world;
 }
 
+/* deprecated */
+GWeatherLocation *
+gweather_location_new_world (gboolean use_regions)
+{
+    return gweather_location_ref (gweather_location_get_world ());
+}
+
 /**
  * gweather_location_ref:
  * @loc: a #GWeatherLocation
diff --git a/libgweather/gweather-location.h b/libgweather/gweather-location.h
index 72dfac2..c221ea6 100644
--- a/libgweather/gweather-location.h
+++ b/libgweather/gweather-location.h
@@ -49,6 +49,10 @@ GType gweather_location_get_type (void);
 #define GWEATHER_TYPE_LOCATION (gweather_location_get_type ())
 
 GWeatherLocation      *gweather_location_get_world      (void);
+
+G_DEPRECATED_FOR(gweather_location_get_world)
+GWeatherLocation      *gweather_location_new_world      (gboolean use_regions);
+
 GWeatherLocation      *gweather_location_ref            (GWeatherLocation  *loc);
 void                   gweather_location_unref          (GWeatherLocation  *loc);
 
diff --git a/libgweather/gweather-weather.h b/libgweather/gweather-weather.h
index e05e304..c473991 100644
--- a/libgweather/gweather-weather.h
+++ b/libgweather/gweather-weather.h
@@ -77,7 +77,8 @@ struct _GWeatherInfoClass {
 };
 
 GType                    gweather_info_get_type            (void) G_GNUC_CONST;
-GWeatherInfo *           gweather_info_new                 (GWeatherLocation *location);
+GWeatherInfo *           gweather_info_new                 (GWeatherLocation     *location,
+                                                           GWeatherForecastType  type);
 void                     gweather_info_update              (GWeatherInfo *info);
 void                    gweather_info_abort               (GWeatherInfo *info);
 void                     gweather_info_store_cache         (void);
@@ -96,6 +97,10 @@ gchar *                       gweather_info_get_location_name   (GWeatherInfo *info);
 gchar *                 gweather_info_get_update          (GWeatherInfo *info);
 gchar *                 gweather_info_get_sky             (GWeatherInfo *info);
 gchar *                         gweather_info_get_conditions      (GWeatherInfo *info);
+
+G_DEPRECATED_FOR(gweather_info_get_forecast_list)
+gchar *                  gweather_info_get_forecast        (GWeatherInfo *info);
+
 gchar *                 gweather_info_get_temp            (GWeatherInfo *info);
 gchar *                 gweather_info_get_temp_min        (GWeatherInfo *info);
 gchar *                 gweather_info_get_temp_max        (GWeatherInfo *info);
diff --git a/libgweather/weather.c b/libgweather/weather.c
index 78ae93e..072045e 100644
--- a/libgweather/weather.c
+++ b/libgweather/weather.c
@@ -2166,6 +2166,7 @@ gweather_info_class_init (GWeatherInfoClass *klass)
 /**
  * gweather_info_new:
  * @location: (allow-none): the desidered #GWeatherLocation (%NULL for default)
+ * @type: deprecated and ignored
  *
  * Builds a new #GWeatherInfo that will provide weather information about
  * @location.
@@ -2173,7 +2174,8 @@ gweather_info_class_init (GWeatherInfoClass *klass)
  * Returns: (transfer full): a new #GWeatherInfo
  */
 GWeatherInfo *
-gweather_info_new (GWeatherLocation    *location)
+gweather_info_new (GWeatherLocation     *location,
+                  GWeatherForecastType  type)
 {
     GWeatherInfo *self;
 
@@ -2182,6 +2184,7 @@ gweather_info_new (GWeatherLocation    *location)
     else
        self = g_object_new (GWEATHER_TYPE_INFO, NULL);
 
+    gweather_info_update (self);
     return self;
 }
 
@@ -2190,3 +2193,33 @@ _gweather_info_new_clone (GWeatherInfo *other)
 {
     return g_object_new (GWEATHER_TYPE_INFO, "location", other->priv->glocation, NULL);
 }
+
+/* deprecated */
+char *
+gweather_info_get_forecast (GWeatherInfo *info)
+{
+    GString *buffer;
+    GSList *iter;
+
+    buffer = g_string_new ("");
+
+    for (iter = info->priv->forecast_list; iter; iter = iter->next) {
+       char *date, *summary, *temp;
+
+       date = gweather_info_get_update (iter->data);
+       summary = gweather_info_get_conditions (iter->data);
+       if (g_str_equal (summary, "-")) {
+           g_free (summary);
+           summary = gweather_info_get_sky (iter->data);
+       }
+       temp = gweather_info_get_temp_summary (iter->data);
+
+       g_string_append_printf (buffer, " * %s: %s, %s", date, summary, temp);
+
+       g_free (date);
+       g_free (summary);
+       g_free (temp);
+    }
+
+    return g_string_free (buffer, FALSE);
+}


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