[Pkg-wmaker-commits] [wmforecast] 14/63: image error handling; added auto-generated files to .gitignore
Doug Torrance
dtorrance-guest at moszumanska.debian.org
Mon Aug 17 11:20:33 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 da396f50745dcae0055ef4821650935e1bf39402
Author: Doug Torrance <dtorrance at monmouthcollege.edu>
Date: Mon Apr 21 00:33:29 2014 -0500
image error handling; added auto-generated files to .gitignore
---
.gitignore | 9 +++++++++
ChangeLog | 6 ++++++
wmforecast.c | 27 ++++++++++++++-------------
3 files changed, 29 insertions(+), 13 deletions(-)
diff --git a/.gitignore b/.gitignore
index 6d40894..fd2c69d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,11 @@
config.h.in~
autom4te.cache/
+.deps/
+Makefile
+config.h
+config.log
+config.status
+icons/Makefile
+stamp-h1
+wmforecast
+wmforecast.o
diff --git a/ChangeLog b/ChangeLog
index a1bd9d4..be411f6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,12 @@
* wmforecast.c: changed all calls to free to use WINGs's native wfree;
removed if statements before calls to free, since wfree already does
this
+ * wmforecast.c (setError): moved earlier, so that it can be called from
+ setConditions
+ * wmforecast.c (setConditions): now returns an error when icon image
+ not found
+ * wmforecast.c (updateDockapp): checks to see if na.png will load before
+ using it
* wmforecast.c (WriteMemoryCallback): removed check to see if result of
wrealloc was NULL (wrealloc already does this)
* ChangeLog: corrected year in all entries (it's not 2015 yet...)
diff --git a/wmforecast.c b/wmforecast.c
index f253ea3..5d99fd3 100755
--- a/wmforecast.c
+++ b/wmforecast.c
@@ -143,6 +143,14 @@ void setTitle(Weather *weather, const char *title)
strcpy(weather->title, title);
}
+void setError(Weather *weather, WMScreen *screen, const char *errorText)
+{
+ weather->errorFlag = 1;
+ weather->errorText = wrealloc(weather->errorText, strlen(errorText) + 1);
+ strcpy(weather->errorText, errorText);
+}
+
+
void setConditions(Weather *weather,
WMScreen *screen,
const char *temp,
@@ -161,6 +169,8 @@ void setConditions(Weather *weather,
context = WMScreenRContext(screen);
filename = wstrconcat(wstrconcat(DATADIR"/",code),".png");
weather->icon = RLoadImage(context,filename,0);
+ if (!weather->icon)
+ setError(weather, screen, wstrconcat(filename, " not found"));
}
void setForecast(Forecast *forecast,
@@ -272,16 +282,6 @@ char *getBalloonText(Weather *weather)
return text;
}
-void setError(Weather *weather, WMScreen *screen, const char *errorText)
-{
- weather->errorFlag = 1;
- weather->errorText = wrealloc(weather->errorText, strlen(errorText) + 1);
- strcpy(weather->errorText, errorText);
-
-
-
-
-}
@@ -448,9 +448,10 @@ static void updateDockapp(void *data)
context = WMScreenRContext(screen);
weather->icon = RLoadImage(context,DATADIR"/na.png",0);
-
- icon = WMCreatePixmapFromRImage(screen,weather->icon,0);
- WMSetLabelImage(dockapp->icon,icon);
+ if (weather->icon) {
+ icon = WMCreatePixmapFromRImage(screen,weather->icon,0);
+ WMSetLabelImage(dockapp->icon,icon);
+ }
WMSetBalloonTextForView(weather->errorText, WMWidgetView(dockapp->icon));
--
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