[libgweather] Add gweather_info_new_for_world()
- From: Giovanni Campagna <gcampagna src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgweather] Add gweather_info_new_for_world()
- Date: Fri, 8 Jun 2012 11:38:01 +0000 (UTC)
commit 7f23e24ae389b23a875c1475db3e7c918b87b2e7
Author: Giovanni Campagna <gcampagna src gnome org>
Date: Sun Mar 25 16:09:45 2012 +0200
Add gweather_info_new_for_world()
A constructor to be used from C, that allows to control the world
property and thus the hierarchy to which location belongs.
libgweather/gweather-weather.h | 3 +++
libgweather/weather.c | 32 ++++++++++++++++++++++++++++++++
2 files changed, 35 insertions(+), 0 deletions(-)
---
diff --git a/libgweather/gweather-weather.h b/libgweather/gweather-weather.h
index 5ebea40..68d5854 100644
--- a/libgweather/gweather-weather.h
+++ b/libgweather/gweather-weather.h
@@ -61,6 +61,9 @@ typedef void (*GWeatherInfoFunc) (GWeatherInfo *info, gpointer data);
GType gweather_info_get_type (void) G_GNUC_CONST;
GWeatherInfo * gweather_info_new (GWeatherLocation *location,
GWeatherForecastType forecast_type);
+GWeatherInfo * gweather_info_new_for_world (GWeatherLocation *world,
+ GWeatherLocation *location,
+ GWeatherForecastType forecast_type);
void gweather_info_update (GWeatherInfo *info);
void gweather_info_abort (GWeatherInfo *info);
diff --git a/libgweather/weather.c b/libgweather/weather.c
index 91738e8..7841280 100644
--- a/libgweather/weather.c
+++ b/libgweather/weather.c
@@ -1864,6 +1864,10 @@ gweather_info_class_init (GWeatherInfoClass *klass)
* @location: (allow-none): the desidered #GWeatherLocation (NULL for default)
* @forecast_type: the type of forecast requested
*
+ * Builds a new #GWeatherInfo that will provide weather information about
+ * @location. The returned info will not be ready until the ::updated signal
+ * is emitted.
+ *
* Returns: (transfer full): a new #GWeatherInfo
*/
GWeatherInfo *
@@ -1881,6 +1885,34 @@ gweather_info_new (GWeatherLocation *location,
return self;
}
+/**
+ * gweather_info_new_for_world:
+ * @world: a #GWeatherLocation representing the whole world
+ * @location: (allow-none): the desidered #GWeatherLocation (NULL for default)
+ * @forecast_type: the type of forecast requested
+ *
+ * Similar to g_weather_info_new(), but also has a @world parameter, that allow controlling
+ * the hierarchy of #GWeatherLocation to which @location (or the default one taken from
+ * GSettings) belongs.
+ *
+ * Returns: (transfer full): a new #GWeatherInfo
+ */
+GWeatherInfo *
+gweather_info_new_for_world (GWeatherLocation *world,
+ GWeatherLocation *location,
+ GWeatherForecastType forecast_type)
+{
+ GWeatherInfo *self;
+
+ if (location != NULL)
+ self = g_object_new (GWEATHER_TYPE_INFO, "world", world, "location", location, "forecast-type", forecast_type, NULL);
+ else
+ self = g_object_new (GWEATHER_TYPE_INFO, "world", world, "forecast-type", forecast_type, NULL);
+ gweather_info_update (self);
+
+ return self;
+}
+
GWeatherInfo *
_gweather_info_new_clone (GWeatherInfo *other)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]