added infopipe_bar preliminary
authorPhilip Kovacs <pkovacs@users.sourceforge.net>
Fri, 6 Jan 2006 00:02:59 +0000 (00:02 +0000)
committerPhilip Kovacs <pkovacs@users.sourceforge.net>
Fri, 6 Jan 2006 00:02:59 +0000 (00:02 +0000)
git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky@468 7f574dfc-610e-0410-a909-a81674777703

src/conky.c
src/infopipe.c

index 802e0aa..fc1cd6f 100644 (file)
@@ -915,6 +915,7 @@ enum text_object_type {
        OBJ_infopipe_channels,
        OBJ_infopipe_title,
        OBJ_infopipe_file,
+       OBJ_infopipe_bar,
 #endif
 #ifdef TCP_PORT_MONITOR
        OBJ_tcp_portmon,
@@ -1839,6 +1840,7 @@ int a = stippled_borders, b = 1;
        OBJ(infopipe_channels, INFO_INFOPIPE) END
        OBJ(infopipe_title, INFO_INFOPIPE) END
        OBJ(infopipe_file, INFO_INFOPIPE) END
+       OBJ(infopipe_bar, INFO_INFOPIPE) END
 #endif
 #ifdef TCP_PORT_MONITOR
        OBJ(tcp_portmon, INFO_TCP_PORT_MONITOR) 
@@ -3158,6 +3160,12 @@ static void generate_text_internal(char *p, int p_max_size, struct text_object *
                         OBJ(infopipe_file) {
                                snprintf(p, p_max_size, "%s", cur->infopipe.items[INFOPIPE_FILE]);
                        }
+                       OBJ(infopipe_bar) {
+                               double progress;
+                               progress= atof(cur->infopipe.items[INFOPIPE_USEC_POSITION]) /
+                                         atof(cur->infopipe.items[INFOPIPE_USEC_TIME]);
+                               new_bar(p,obj->a,obj->b,(int)(progress*255.0f));
+                       }
 #endif
                        OBJ(top) {
                                if (obj->data.top.type == TOP_NAME
index 6a01f0b..ef93ad9 100644 (file)
@@ -69,7 +69,7 @@ void *infopipe_thread_func(void *pvoid)
     pvoid=(void*)pvoid; /* useless cast to avoid unused var warning */
 
     /* I/O multiplexing timer */
-    tm.tv_sec=10;  /* high enough to reduce persistent select() failures */
+    tm.tv_sec=30;  /* high enough to reduce persistent select() failures */
     tm.tv_usec=0;
 
     /* Grab the runnable signal.  Should be non-zero here or we do nothing. */
@@ -96,7 +96,7 @@ void *infopipe_thread_func(void *pvoid)
                ideally suited for a worker thread such as this.  We don't want 
                to slow down ui updates in the main thread as there is already 
               excess latency there. */
-            if ((i=select(fd+1,&readset,NULL,NULL,&tm)) == 1) { /* something to read */
+            if (select(fd+1,&readset,NULL,NULL,&tm) == 1) { /* something to read */
                    
                 if (read(fd,buf,sizeof(buf)) > 0) { /* buf has data */
                    
@@ -113,9 +113,6 @@ void *infopipe_thread_func(void *pvoid)
                     */
                }
            }
-           else {
-               printf("select() says nothing to read: %d, fd %d\n",i,fd);
-           }
 
            if (close(fd) < 0) {
                 break;