[Pkg-wmaker-commits] [wmforecast] 08/63: refresh on double click

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 bbd52b062d753a641a4e1039f7c7819a0fe24998
Author: Doug Torrance <dtorrance at monmouthcollege.edu>
Date:   Sat Apr 19 08:55:15 2014 -0500

    refresh on double click
---
 ChangeLog    |  6 ++++++
 wmforecast.c | 22 +++++++++++++++-------
 2 files changed, 21 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 965893c..f0716c4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2015-04-18  Doug Torrance <dtorrance at monmouthcollege.edu>
+	* wmforecast.c (updateDockapp): added "loading" text while downloading
+	  new weather data
+	* wmforecast.c (refresh, main): new function, refreshes weather data
+	  when icon double clicked
+
 2015-04-17  Doug Torrance <dtorrance at monmouthcollege.edu>
 	* wmforecast.c: improved error handling -- Weather struct now contains
 	  errorFlag and errorText.  If errorFlag set to 1, "ERROR" is displayed
diff --git a/wmforecast.c b/wmforecast.c
index e6bdaf7..f54de23 100755
--- a/wmforecast.c
+++ b/wmforecast.c
@@ -243,7 +243,6 @@ Dockapp *newDockapp(WMScreen *screen, int argc, char **argv)
 	dockapp->icon = WMCreateLabel(frame);
 	WMSetWidgetBackgroundColor(dockapp->icon,color("black"));
 	WMRealizeWidget(dockapp->icon);
-
 	WMSetLabelImagePosition(dockapp->icon,WIPImageOnly);
 	WMResizeWidget(dockapp->icon,32,32);
 	WMMoveWidget(dockapp->icon,12,5);
@@ -449,9 +448,12 @@ void updateDockapp(WMScreen *screen, Dockapp *dockapp, Preferences *prefs)
 	Weather *weather;
 	WMPixmap *icon;
 
+	WMSetLabelText(dockapp->text,"loading");
+	WMRedisplayWidget(dockapp->text);
+
 	weather = getWeather(screen, prefs);
 
-	if (weather->errorFlag == 1) {
+	if (weather->errorFlag) {
 		RContext *context;
 
 		WMSetLabelText(dockapp->text,"ERROR");
@@ -613,6 +615,13 @@ void *timerLoop(void *args)
 	}
 }
 
+static void refresh(XEvent *event, void *args)
+{
+	ThreadData *data = args;
+	if (WMIsDoubleClick(event) && event->xbutton.button == Button1) 
+		updateDockapp(data->screen, data->dockapp, data->prefs);
+}
+
 int main(int argc, char **argv)
 {
 	Display *display;
@@ -634,10 +643,9 @@ int main(int argc, char **argv)
 	data = newThreadData(screen, dockapp, prefs);
 
 	pthread_create(&thread, NULL, timerLoop, data);
-	WMScreenMainLoop(screen);
-}
-
-
-
 
+	WMCreateEventHandler(WMWidgetView(dockapp->icon), ButtonPressMask,
+			     refresh, 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