[libgweather] GWeatherInfo: namespace an internal function
- From: Giovanni Campagna <gcampagna src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgweather] GWeatherInfo: namespace an internal function
- Date: Sun, 2 Dec 2012 19:08:56 +0000 (UTC)
commit 9e675cf0c45420ee074db061349d0994c2ceba63
Author: Giovanni Campagna <gcampagna src gnome org>
Date: Sun Dec 2 19:46:09 2012 +0100
GWeatherInfo: namespace an internal function
Just a code cleanup, reduces the pollution on the global namespace.
This does not affect applications, as we use a symbol regex to filter
the ABI.
libgweather/weather-bom.c | 4 ++--
libgweather/weather-iwin.c | 4 ++--
libgweather/weather-met.c | 4 ++--
libgweather/weather-metar.c | 5 +++--
libgweather/weather-priv.h | 4 +---
libgweather/weather-wx.c | 4 ++--
libgweather/weather-yahoo.c | 5 ++---
libgweather/weather-yrno.c | 9 ++++-----
libgweather/weather.c | 12 +++---------
9 files changed, 21 insertions(+), 30 deletions(-)
---
diff --git a/libgweather/weather-bom.c b/libgweather/weather-bom.c
index 4c1853e..11ac80a 100644
--- a/libgweather/weather-bom.c
+++ b/libgweather/weather-bom.c
@@ -36,7 +36,7 @@ bom_finish (SoupSession *session, SoupMessage *msg, gpointer data)
if (!SOUP_STATUS_IS_SUCCESSFUL (msg->status_code)) {
g_warning ("Failed to get BOM forecast data: %d %s.\n",
msg->status_code, msg->reason_phrase);
- request_done (info, FALSE);
+ _gweather_info_request_done (info);
return;
}
@@ -53,7 +53,7 @@ bom_finish (SoupSession *session, SoupMessage *msg, gpointer data)
info->priv->forecast = g_strdup (msg->response_body->data);
g_print ("%s\n", info->priv->forecast);
- request_done (info, TRUE);
+ _gweather_info_request_done (info);
}
void
diff --git a/libgweather/weather-iwin.c b/libgweather/weather-iwin.c
index 82bdf03..2c255f8 100644
--- a/libgweather/weather-iwin.c
+++ b/libgweather/weather-iwin.c
@@ -367,7 +367,7 @@ iwin_finish (SoupSession *session, SoupMessage *msg, gpointer data)
/* forecast data is not really interesting anyway ;) */
g_warning ("Failed to get IWIN forecast data: %d %s\n",
msg->status_code, msg->reason_phrase);
- request_done (info, FALSE);
+ _gweather_info_request_done (info);
return;
}
@@ -378,7 +378,7 @@ iwin_finish (SoupSession *session, SoupMessage *msg, gpointer data)
else
priv->forecast = formatWeatherMsg (g_strdup (msg->response_body->data));
- request_done (info, TRUE);
+ _gweather_info_request_done (info);
}
/* Get forecast into newly alloc'ed string */
diff --git a/libgweather/weather-met.c b/libgweather/weather-met.c
index 3ef88dc..281c384 100644
--- a/libgweather/weather-met.c
+++ b/libgweather/weather-met.c
@@ -156,12 +156,12 @@ met_finish (SoupSession *session, SoupMessage *msg, gpointer data)
if (!SOUP_STATUS_IS_SUCCESSFUL (msg->status_code)) {
g_warning ("Failed to get Met Office forecast data: %d %s.\n",
msg->status_code, msg->reason_phrase);
- request_done (info, FALSE);
+ _gweather_info_request_done (info);
return;
}
info->priv->forecast = met_parse (msg->response_body->data);
- request_done (info, TRUE);
+ _gweather_info_request_done (info);
}
void
diff --git a/libgweather/weather-metar.c b/libgweather/weather-metar.c
index 682eac7..44c0820 100644
--- a/libgweather/weather-metar.c
+++ b/libgweather/weather-metar.c
@@ -523,7 +523,8 @@ metar_finish (SoupSession *session, SoupMessage *msg, gpointer data)
g_warning (_("Failed to get METAR data: %d %s.\n"),
msg->status_code, msg->reason_phrase);
}
- request_done (info, FALSE);
+
+ _gweather_info_request_done (info);
return;
}
@@ -550,7 +551,7 @@ metar_finish (SoupSession *session, SoupMessage *msg, gpointer data)
}
priv->valid = success;
- request_done (info, TRUE);
+ _gweather_info_request_done (info);
}
/* Read current conditions and fill in info structure */
diff --git a/libgweather/weather-priv.h b/libgweather/weather-priv.h
index ad25f6b..1c3344f 100644
--- a/libgweather/weather-priv.h
+++ b/libgweather/weather-priv.h
@@ -192,9 +192,7 @@ gboolean yrno_start_open (GWeatherInfo *info);
gboolean metar_parse (gchar *metar,
GWeatherInfo *info);
-gboolean requests_init (GWeatherInfo *info);
-void request_done (GWeatherInfo *info,
- gboolean ok);
+void _gweather_info_request_done (GWeatherInfo *info);
void ecl2equ (gdouble t,
gdouble eclipLon,
diff --git a/libgweather/weather-wx.c b/libgweather/weather-wx.c
index 711d80e..567e072 100644
--- a/libgweather/weather-wx.c
+++ b/libgweather/weather-wx.c
@@ -37,7 +37,7 @@ wx_finish (SoupSession *session, SoupMessage *msg, gpointer data)
g_warning ("Failed to get radar map image: %d %s.\n",
msg->status_code, msg->reason_phrase);
g_object_unref (priv->radar_loader);
- request_done (info, FALSE);
+ _gweather_info_request_done (info);
return;
}
@@ -51,7 +51,7 @@ wx_finish (SoupSession *session, SoupMessage *msg, gpointer data)
}
g_object_unref (priv->radar_loader);
- request_done (info, TRUE);
+ _gweather_info_request_done (info);
}
static void
diff --git a/libgweather/weather-yahoo.c b/libgweather/weather-yahoo.c
index c47bdc9..60a6f9b 100644
--- a/libgweather/weather-yahoo.c
+++ b/libgweather/weather-yahoo.c
@@ -255,13 +255,12 @@ yahoo_finish (SoupSession *session,
/* forecast data is not really interesting anyway ;) */
g_warning ("Failed to get Yahoo! Weather forecast data: %d %s\n",
msg->status_code, msg->reason_phrase);
- request_done (info, FALSE);
+ _gweather_info_request_done (info);
return;
}
parse_forecast_xml (info, msg->response_body);
-
- request_done (info, TRUE);
+ _gweather_info_request_done (info);
}
gboolean
diff --git a/libgweather/weather-yrno.c b/libgweather/weather-yrno.c
index 40c2341..f2ce7a7 100644
--- a/libgweather/weather-yrno.c
+++ b/libgweather/weather-yrno.c
@@ -431,13 +431,12 @@ yrno_finish_old (SoupSession *session,
/* forecast data is not really interesting anyway ;) */
g_message ("Failed to get Yr.no forecast data: %d %s\n",
msg->status_code, msg->reason_phrase);
- request_done (info, FALSE);
+ _gweather_info_request_done (info);
return;
}
parse_forecast_xml_old (info, msg->response_body);
-
- request_done (info, TRUE);
+ _gweather_info_request_done (info);
}
static gboolean
@@ -494,13 +493,13 @@ yrno_finish_new (SoupSession *session,
/* forecast data is not really interesting anyway ;) */
g_message ("Failed to get Yr.no forecast data: %d %s\n",
msg->status_code, msg->reason_phrase);
- request_done (info, FALSE);
+ _gweather_info_request_done (info);
return;
}
parse_forecast_xml_new (info, msg->response_body);
- request_done (info, TRUE);
+ _gweather_info_request_done (info);
}
static gboolean
diff --git a/libgweather/weather.c b/libgweather/weather.c
index 6e1a9e4..e360440 100644
--- a/libgweather/weather.c
+++ b/libgweather/weather.c
@@ -226,10 +226,7 @@ gweather_conditions_to_string (GWeatherConditions *cond)
}
}
-/* Locals turned global to facilitate asynchronous HTTP requests */
-
-
-gboolean
+static gboolean
requests_init (GWeatherInfo *info)
{
if (info->priv->requests_pending)
@@ -238,12 +235,9 @@ requests_init (GWeatherInfo *info)
return TRUE;
}
-void request_done (GWeatherInfo *info, gboolean ok)
+void
+_gweather_info_request_done (GWeatherInfo *info)
{
- if (ok) {
- calc_sun_time (info, info->priv->update);
- info->priv->moonValid = info->priv->valid && calc_moon (info);
- }
if (!--info->priv->requests_pending)
g_signal_emit (info, gweather_info_signals[SIGNAL_UPDATED], 0);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]