[Pkg-wmaker-commits] [wmforecast] 02/63: finished fixing memory bugs, added email address to PACKAGE_BUGREPORT
Doug Torrance
dtorrance-guest at moszumanska.debian.org
Mon Aug 17 11:20:32 UTC 2015
This is an automated email from the git hooks/post-receive script.
dtorrance-guest pushed a commit to branch master
in repository wmforecast.
commit 2d8f33f3f860adabcc590023438600118a3840ef
Author: Doug Torrance <dtorrance at monmouthcollege.edu>
Date: Thu Apr 17 14:11:44 2014 -0500
finished fixing memory bugs, added email address to PACKAGE_BUGREPORT
---
ChangeLog | 11 ++++++++++-
README | 36 +++++++++++++++++++++++-------------
configure.ac | 2 +-
wmforecast.c | 53 ++++++++++++++++++++++++++++++++++++++---------------
4 files changed, 72 insertions(+), 30 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 66bca55..0a4c3ea 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2015-04-16 Doug Torrance <dtorrance at monmouthcollege.edu>
+ * wmforecast.c: bugfix -- After downloading the weather, the Weather
+ struct was being freed, but it contained the pointer to the icon
+ currently used by the dockapp, causing a crash. This has been fixed.
+ In addition, functions have been added to properly free the
+ Forecast and ForecastArray structs inside each Weather struct.
+ * wmforecast.c, configure.ac: PACKAGE_BUGREPORT now set to my email
+ address, printed by --help (for the benefit fo help2man)
+ * README: expanded description
+
2015-04-15 Doug Torrance <dtorrance at monmouthcollege.edu>
* wmforecast.c: fixed bug where window was still drawn with --help or
@@ -7,4 +17,3 @@
* configure.ac, Makefile.am: call help2man during make to automatically
build manpage
* configure.ac: set version 0.2
-
diff --git a/README b/README
index 48d15f2..a2f51e9 100644
--- a/README
+++ b/README
@@ -5,9 +5,23 @@
===========================================================
+http://wmforecast.sourceforge.net
+
wmforecast is a weather dockapp for Window Maker using the Yahoo Weather API
(https://developer.yahoo.com/weather/)
+It is designed to combine the look and field of traditional dockapps, e.g.,
+light sea green text on a black background, with a more modern simplicity.
+Instead of cramming lots of information in one 64x64 icon, only the current
+temperature and an icon representing the conditions are given. Further
+information is available via a balloon tooltip.
+
+Note that wmforecast is written using WINGs, Window Maker's native widget
+toolkit.
+
+The icons were designed by MerlinTheRed and are available at
+http://merlinthered.deviantart.com/art/plain-weather-icons-157162192
+
Installation
============
./configure
@@ -17,17 +31,21 @@ sudo make install
Usage
=====
-wmforecast [<options>]
+wmforecast [OPTIONS]
+
+Options:
-v, --version print the version number
-h, --help print this help screen
-u, --units <c|f> whether to use Celsius or Fahrenheit (default is f)
- -w, --woeid <woeid> Where on Earth ID (default is 2502265 for Sunnyvale,
- CA -- to find your WOEID, search for your city at
- http://weather.yahoo.com and look in the URL.)
+ -w, --woeid <woeid> Where on Earth ID (default is 2502265 for
+ Sunnyvale, CA -- to find your WOEID, search
+ for your city at http://weather.yahoo.com and
+ look in the URL.)
-z, --zip <zip> ZIP code or Location ID (Yahoo has deprecated this
option and it is not guaranteed to work)
(note that one of -w or -z may be used, not both)
+
Copyright
=========
wmforecast:
@@ -36,12 +54,4 @@ wmforecast:
icons:
2010 MerlinTheRed <http://merlinthered.deviantart.com/>
- Creative Commons Attribution-NonCommercial-ShareAlike License
-
-
-
-
-
-
-
-
+ Creative Commons Attribution-NonCommercial-ShareAlike License
\ No newline at end of file
diff --git a/configure.ac b/configure.ac
index d92df36..963129a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
-AC_INIT([wmforecast], [0.2])
+AC_INIT([wmforecast], [0.2], [dtorrance at monmouthcollege.edu])
AM_INIT_AUTOMAKE([-Wall -Werror])
AC_CONFIG_SRCDIR([configure.ac])
AC_CONFIG_HEADER([config.h])
diff --git a/wmforecast.c b/wmforecast.c
index af68b29..e715532 100755
--- a/wmforecast.c
+++ b/wmforecast.c
@@ -52,7 +52,7 @@ typedef struct {
char *text;
char *title;
ForecastArray *forecasts;
- WMPixmap *icon;
+ RImage *icon;
} Weather;
typedef struct {
@@ -104,24 +104,44 @@ Weather *newWeather()
return weather;
}
+void freeForecast(Forecast *forecast)
+{
+ if (forecast->day)
+ free(forecast->day);
+ if (forecast->low)
+ free(forecast->low);
+ if (forecast->high)
+ free(forecast->high);
+ if (forecast->text)
+ free(forecast->text);
+
+}
+void freeForecastArray(ForecastArray *array)
+{
+ int i;
+ for (i = 0; i < array->length; i++)
+ if (&array->forecasts[i])
+ freeForecast(&array->forecasts[i]);
+ if (array)
+ free(array);
+}
void freeWeather(Weather *weather)
{
- if (weather->temp)
+ if (weather->temp)
free(weather->temp);
if (weather->text)
free(weather->text);
if (weather->title)
free(weather->title);
- if (weather->icon)
- free(weather->icon);
if (weather->forecasts) {
if (weather->forecasts->forecasts)
free(weather->forecasts->forecasts);
free(weather->forecasts);
}
- free(weather);
+ if (weather)
+ free(weather);
}
void setTitle(Weather *weather, const char *title)
@@ -138,7 +158,6 @@ void setConditions(Weather *weather,
)
{
RContext *context;
- RImage *image;
char *filename;
weather->temp = realloc(weather->temp, strlen(temp) + 1);
@@ -148,9 +167,7 @@ void setConditions(Weather *weather,
context = WMScreenRContext(screen);
filename = wstrconcat(wstrconcat(DATADIR"/",code),".png");
- image = RLoadImage(context,filename,0);
- weather->icon = WMCreatePixmapFromRImage(screen,image,0);
-
+ weather->icon = RLoadImage(context,filename,0);
}
void setForecast(Forecast *forecast,
@@ -418,11 +435,17 @@ Weather *getWeather(WMScreen *screen, Preferences *prefs)
void updateDockapp(WMScreen *screen, Dockapp *dockapp, Preferences *prefs)
{
Weather *weather;
+ WMPixmap *icon;
weather = getWeather(screen, prefs);
+
WMSetLabelText(dockapp->text,wstrconcat(weather->temp,"°"));
- WMSetLabelImage(dockapp->icon,weather->icon);
+
+ icon = WMCreatePixmapFromRImage(screen,weather->icon,0);
+ WMSetLabelImage(dockapp->icon,icon);
+
WMSetBalloonTextForView(getBalloonText(weather), WMWidgetView(dockapp->icon));
+
WMRedisplayWidget(dockapp->icon);
WMRedisplayWidget(dockapp->text);
@@ -494,7 +517,8 @@ Preferences *setPreferences(int argc, char **argv)
" -z, --zip <zip> ZIP code or Location ID (Yahoo has deprecated this\n"
" option and it is not guaranteed to work)\n"
"(note that only one of -w or -z may be used, not both)\n\n"
- "Report bugs to <dtorrance at monmouthcollege.edu>.\n"
+ "Report bugs to <%s>.\n",
+ PACKAGE_BUGREPORT
);
exit(0);
@@ -546,9 +570,9 @@ ThreadData *newThreadData(WMScreen *screen, Dockapp *dockapp, Preferences *prefs
return data;
}
-void *timerLoop(void *args)
+void *timerLoop(void *dataVoid)
{
- ThreadData *data = args;
+ ThreadData *data = dataVoid;
for (;;) {
updateDockapp(data->screen, data->dockapp, data->prefs);
sleep(60*60);
@@ -559,7 +583,6 @@ int main(int argc, char **argv)
{
Display *display;
Dockapp *dockapp;
- int interval = 5;
Preferences *prefs;
pthread_t thread;
ThreadData *data;
@@ -575,7 +598,7 @@ int main(int argc, char **argv)
screen = WMCreateScreen(display, DefaultScreen(display));
dockapp = newDockapp(screen, argc, argv);
data = newThreadData(screen, dockapp, prefs);
-
+
pthread_create(&thread, NULL, timerLoop, data);
WMScreenMainLoop(screen);
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-wmaker/wmforecast.git
More information about the Pkg-wmaker-commits
mailing list