[Xfce4-commits] <xfce4-weather-plugin:master> Cleanup: Remove cruft from weather-translate.
Harald Judt
noreply at xfce.org
Fri Jul 13 16:50:16 CEST 2012
Updating branch refs/heads/master
to 34dce9dba0dda76277f6fc00fefe22f06ef638fb (commit)
from 732d1bc7b6c7a9dfc4f1aa0370c76feb43cb85f0 (commit)
commit 34dce9dba0dda76277f6fc00fefe22f06ef638fb
Author: Harald Judt <h.judt at gmx.at>
Date: Wed Jul 11 17:12:39 2012 +0200
Cleanup: Remove cruft from weather-translate.
Remove everything that is not needed anymore. Git can bring it back.
panel-plugin/weather-translate.c | 304 +-------------------------------------
panel-plugin/weather-translate.h | 12 +--
2 files changed, 4 insertions(+), 312 deletions(-)
diff --git a/panel-plugin/weather-translate.c b/panel-plugin/weather-translate.c
index 6b70efd..e78e222 100644
--- a/panel-plugin/weather-translate.c
+++ b/panel-plugin/weather-translate.c
@@ -27,178 +27,7 @@
#include "weather.h"
#include "weather-translate.h"
-
-
-#define HDATE_N (sizeof(gchar) * 100)
#define DAY_LOC_N (sizeof(gchar) * 100)
-#define TIME_LOC_N (sizeof(gchar) * 20)
-
-
-
-static const gchar *desc_strings[] = {
- N_("AM Clouds / PM Sun"),
- N_("AM Light Rain"),
- N_("AM Light Snow"),
- N_("AM Rain / Snow Showers"),
- N_("AM Rain / Wind"),
- N_("AM Showers"),
- N_("AM Showers / Wind"),
- N_("AM Snow Showers"),
- N_("AM Snow Showers / Wind"),
- N_("AM T-Storms"),
- N_("Becoming Cloudy"),
- N_("Blizzard"),
- N_("Blizzard Conditions"),
- N_("Blowing Snow"),
- N_("Chance of Rain"),
- N_("Chance of Rain/Snow"),
- N_("Chance of Showers"),
- N_("Chance of Snow"),
- N_("Chance of Snow/Rain"),
- N_("Chance of T-Storm"),
- N_("Clear"),
- N_("Clearing"),
- N_("Clouds"),
- N_("Clouds Early / Clearing Late"),
- N_("Cloudy"),
- N_("Cloudy / Wind"),
- N_("Cloudy Periods"),
- N_("Continued Hot"),
- N_("Cumulonimbus Clouds Observed"),
- N_("Drifting Snow"),
- N_("Drifting Snow and Windy"),
- N_("Drizzle"),
- N_("Dry"),
- N_("Dust"),
- N_("Fair"),
- N_("Few Showers"),
- N_("Few Snow Showers"),
- N_("Fog"),
- N_("Freezing Drizzle"),
- N_("Freezing Rain"),
- N_("Freezing Rain/Snow"),
- N_("Frigid"),
- N_("Frozen Precip"),
- N_("Hail"),
- N_("Haze"),
- N_("Hazy"),
- N_("Heavy Rain"),
- N_("Heavy Rain Shower"),
- N_("Heavy Snow"),
- N_("Hot And Humid"),
- N_("Hot!"),
- N_("Ice Crystals"),
- N_("Ice/Snow Mixture"),
- N_("Increasing Clouds"),
- N_("Isolated Showers"),
- N_("Isolated T-Storms"),
- N_("Light Drizzle"),
- N_("Light Drizzle and Windy"),
- N_("Light Rain"),
- N_("Light Rain / Wind"),
- N_("Light rain late"),
- N_("Light Rain Shower"),
- N_("Light Snow"),
- N_("Lightning Observed"),
- N_("Mild and Breezy"),
- N_("Mist"),
- N_("Mostly Clear"),
- N_("Mostly Cloudy"),
- N_("Mostly Cloudy / Wind"),
- N_("Mostly Cloudy and Windy"),
- N_("Mostly Sunny"),
- N_("Mostly Sunny / Wind"),
- N_("N/A Not Available"),
- N_("Occasional Sunshine"),
- N_("Overcast"),
- N_("Partial Clearing"),
- N_("Partial Fog"),
- N_("Partial Sunshine"),
- N_("Partly Cloudy"),
- N_("Partly Cloudy / Wind"),
- N_("Partly Cloudy and Windy"),
- N_("Partly Sunny"),
- N_("PM Light Rain"),
- N_("PM Light Snow"),
- N_("PM Rain / Wind"),
- N_("PM Rain / Snow Showers"),
- N_("PM Showers"),
- N_("PM Snow Showers"),
- N_("PM T-Storms"),
- N_("Rain"),
- N_("Rain / Snow"),
- N_("Rain / Snow / Wind"),
- N_("Rain / Snow Late"),
- N_("Rain / Snow Showers"),
- N_("Rain / Snow Showers Early"),
- N_("Rain / Thunder"),
- N_("Rain / Wind"),
- N_("Rain and Sleet"),
- N_("Rain and Snow"),
- N_("Rain or Snow"),
- N_("Rain Shower"),
- N_("Rain Shower and Windy"),
- N_("Rain to snow"),
- N_("Rain/Lightning"),
- N_("Scattered Showers"),
- N_("Scattered Snow Showers"),
- N_("Scattered Snow Showers / Wind"),
- N_("Scattered T-Storms"),
- N_("Showers"),
- N_("Showers / Wind"),
- N_("Showers Early"),
- N_("Showers in the Vicinity"),
- N_("Showers Late"),
- N_("Sleet and Snow"),
- N_("Smoke"),
- N_("Snow"),
- N_("Snow and Rain"),
- N_("Snow or Rain"),
- N_("Snow Shower"),
- N_("Light Snow Shower"),
- N_("Snow Shower / Wind"),
- N_("Snow Showers Early"),
- N_("Snow Showers early"),
- N_("Snow Showers Late"),
- N_("Snow to Rain"),
- N_("Sunny"),
- N_("Sunny / Wind"),
- N_("T-Showers"),
- N_("T-Storm"),
- N_("T-Storms"),
- N_("T-Storms / Wind"),
- N_("T-Storms Early"),
- N_("Thunder"),
- N_("Thunder in the Vicinity"),
- N_("Thunder in the Vincinity"),
- N_("Variable Cloudiness"),
- N_("Variable Clouds"),
- N_("Windy/Rain"),
- N_("Windy/Snow"),
- N_("Wintry Mix"),
- NULL
-};
-
-
-
-static const gchar *bard_strings[] = {
- N_("rising"),
- N_("steady"),
- N_("falling"),
- NULL
-};
-
-
-
-static const gchar *risk_strings[] = {
- N_("Low"),
- N_("Moderate"),
- N_("High"),
- N_("Very High"),
- N_("Extreme"),
- NULL
-};
-
static const gchar *wdirs[] = {
@@ -223,7 +52,6 @@ static const gchar *wdirs[] = {
};
-
static const gchar *
translate_str (const gchar **loc_strings,
const gchar *str)
@@ -257,21 +85,6 @@ translate_str (const gchar **loc_strings,
}
-
-const gchar *
-translate_bard (const gchar *bard)
-{
- return translate_str (bard_strings, bard);
-}
-
-
-
-const gchar *
-translate_risk (const gchar *risk)
-{
- return translate_str (risk_strings, risk);
-}
-
typedef struct {
gint id;
gchar *symbol;
@@ -286,8 +99,8 @@ static const SymbolToDesc symbol_to_desc[] = {
{ 5, "LIGHTRAINSUN", N_("Sunny, rain showers"), N_("Clear, rain showers") },
{ 6, "LIGHTRAINTHUNDERSUN", N_("Sunny, rain showers with thunder"),
N_("Clear, rain showers with thunder") },
- { 7, "SLEETSUN", N_("Sunny, Sleet"), N_("Clear, Sleet") },
- { 8, "SNOWSUN", N_("Sunny, Snow"), N_("Clear, Snow") },
+ { 7, "SLEETSUN", N_("Sunny, sleet"), N_("Clear, sleet") },
+ { 8, "SNOWSUN", N_("Sunny, snow"), N_("Clear, snow") },
{ 9, "LIGHTRAIN", N_("Rain showers"), N_("Rain showers") },
{ 10,"RAIN", N_("Rain"), N_("Rain") },
{ 11,"RAINTHUNDER", N_("Rain with thunder"), N_("Rain with thunder") },
@@ -306,6 +119,7 @@ static const SymbolToDesc symbol_to_desc[] = {
};
#define NUM_SYMBOLS (sizeof(symbol_to_desc)/sizeof(symbol_to_desc[0]))
+
const gchar *
translate_desc (const gchar *desc, gboolean nighttime)
{
@@ -321,78 +135,6 @@ translate_desc (const gchar *desc, gboolean nighttime)
}
-
-/* used by translate_lsup and translate_time */
-static void
-_fill_time (struct tm *time_tm,
- const gchar *hour,
- const gchar *minute,
- const gchar *am)
-{
- time_tm->tm_hour = atoi (hour);
-
- if (am[0] == 'P' && time_tm->tm_hour != 12) /* PM or AM */
- time_tm->tm_hour += 12;
-
- time_tm->tm_min = atoi (minute);
- time_tm->tm_sec = 0;
- time_tm->tm_isdst = -1;
-}
-
-
-
-gchar *
-translate_lsup (const gchar *lsup)
-{
- gchar *hdate;
- struct tm time_tm;
- gint size = 0, i = 0;
- gchar **lsup_split;
- int len;
-
- if (lsup == NULL || strlen (lsup) == 0)
- return NULL;
-
- /* 10/17/04 5:55 PM Local Time */
- if ((lsup_split = g_strsplit_set (lsup, " /:", 8)) == NULL)
- return NULL;
-
- while (lsup_split[i++])
- size++;
-
- if (size != 8)
- {
- g_strfreev (lsup_split);
- return NULL;
- }
-
- time_tm.tm_mon = atoi (lsup_split[0]) - 1;
- time_tm.tm_mday = atoi (lsup_split[1]);
- time_tm.tm_year = atoi (lsup_split[2]) + 100;
-
- _fill_time (&time_tm, lsup_split[3], lsup_split[4], lsup_split[5]);
-
- g_strfreev (lsup_split);
-
- if (mktime (&time_tm) != -1)
- {
- hdate = g_malloc (HDATE_N);
-
- len = strftime (hdate, HDATE_N, _("%x at %X Local Time"), &time_tm);
- hdate[len] = 0;
- if (!g_utf8_validate(hdate, -1, NULL)) {
- gchar *utf8 = g_locale_to_utf8(hdate, -1, NULL, NULL, NULL);
- g_free(hdate);
- hdate = utf8;
- }
- return hdate;
- }
- else
- return NULL;
-}
-
-
-
gchar *
translate_day (gint weekday)
{
@@ -419,8 +161,6 @@ translate_day (gint weekday)
}
-
-/* NNW VAR */
gchar *
translate_wind_direction (const gchar *wdir)
{
@@ -463,7 +203,6 @@ translate_wind_direction (const gchar *wdir)
}
-
/* calm or a number */
gchar *
translate_wind_speed (xml_time *timeslice,
@@ -483,40 +222,3 @@ translate_wind_speed (xml_time *timeslice,
return wspeed_loc;
}
-
-
-
-gchar *
-translate_time (const gchar *timestr)
-{
- gchar **time_split, *time_loc;
- gint i = 0, size = 0;
- struct tm time_tm;
- int len;
-
- if (strlen (timestr) == 0)
- return NULL;
-
- time_split = g_strsplit_set (timestr, ": ", 3);
-
- while (time_split[i++])
- size++;
-
- if (size != 3)
- return NULL;
-
- time_loc = g_malloc (TIME_LOC_N);
-
- _fill_time (&time_tm, time_split[0], time_split[1], time_split[2]);
- g_strfreev (time_split);
-
- len = strftime (time_loc, TIME_LOC_N, "%X", &time_tm);
- time_loc[len] = 0;
- if (!g_utf8_validate(time_loc, -1, NULL)) {
- gchar *utf8 = g_locale_to_utf8(time_loc, -1, NULL, NULL, NULL);
- g_free(time_loc);
- time_loc = utf8;
- }
-
- return time_loc;
-}
diff --git a/panel-plugin/weather-translate.h b/panel-plugin/weather-translate.h
index 5f24881..e1703bd 100644
--- a/panel-plugin/weather-translate.h
+++ b/panel-plugin/weather-translate.h
@@ -25,23 +25,13 @@ G_BEGIN_DECLS
const gchar *translate_desc (const gchar *, gboolean);
-const gchar *translate_bard (const gchar *);
-
-const gchar *translate_risk (const gchar *);
-
-/* these return a newly alocted string, that should be freed */
-gchar *translate_lsup (const gchar *);
-
+/* these return a newly allocated string, that should be freed */
gchar *translate_day (gint);
gchar *translate_wind_direction (const gchar *);
gchar *translate_wind_speed (xml_time *, const gchar *, unit_systems);
-gchar *translate_time (const gchar *);
-
-gchar *translate_visibility (const gchar *, unit_systems);
-
G_END_DECLS
#endif
More information about the Xfce4-commits
mailing list