GTK+ Forums Forum Index GTK+ Forums
Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

estimated time

 
Post new topic   Reply to topic    GTK+ Forums Forum Index -> GTK+ Programming
Author Message
ramesh
Familiar Face


Joined: 16 Nov 2006
Posts: 40

PostPosted: Thu Jun 21, 2007 11:04 am    Post subject: estimated time Reply with quote

i am doing the progressbar pulse oreintations...
like (100/filesize in bytes) and am convering file size in to float value using atof()
but for 1.2M(1221948 bytes)
100/1221948=====
taking progressbar is very slow...

and here how can i know estimated time to copy perticular size of a file...
remaining time to copy a file....

can you please help me

thank you in advance
Back to top
openldev
Never Seen the Sunlight


Joined: 21 Sep 2005
Posts: 386
Location: Fairfax, Virginia

PostPosted: Thu Jun 21, 2007 12:17 pm    Post subject: Reply with quote

Why not just take the total file size and divide it by 100? Move the progress bar every time it downloads that much data. I mean, if the user is downloading a huge file, she isn't going to be expecting the bar to move too quickly.
Back to top
ramesh
Familiar Face


Joined: 16 Nov 2006
Posts: 40

PostPosted: Thu Jun 21, 2007 12:37 pm    Post subject: Reply with quote

openldev wrote:
Why not just take the total file size and divide it by 100? Move the progress bar every time it downloads that much data. I mean, if the user is downloading a huge file, she isn't going to be expecting the bar to move too quickly.

yeah i am taking total size..
Quote:

float jj=0;
gdouble new_val;
flaot prog_filesize;
jj=100/prog_filesize;
printf("jjjjjjjj %f \n",jj);
new_val = gtk_progress_bar_get_fraction (GTK_PROGRESS_BAR (pbar)) + jj;


here file size is 1221948.
and here how can i know estimated time to copy perticular size of a file...
remaining time to copy a file....

gor example i selected a folder of 1Gb
and copied to other file.
here a window will appeared with progressbar...
there is a progress and estimated time to copy...

after copying the 1Gb file the window will closing.

how can i do this all by programatically

thank you in advance
Back to top
openldev
Never Seen the Sunlight


Joined: 21 Sep 2005
Posts: 386
Location: Fairfax, Virginia

PostPosted: Thu Jun 21, 2007 12:53 pm    Post subject: Reply with quote

I think what you need to do is use a timer. Every so often, check how long it has been, and how much data has been transfered. From that, you can estimate how much time it will take for the rest of the data to transfer.
Back to top
ramesh
Familiar Face


Joined: 16 Nov 2006
Posts: 40

PostPosted: Thu Jun 21, 2007 1:04 pm    Post subject: Reply with quote

openldev wrote:
I think what you need to do is use a timer. Every so often, check how long it has been, and how much data has been transfered. From that, you can estimate how much time it will take for the rest of the data to transfer.


sorry i cat understand i am new to this progressbar..
can u please explin it clearly..
or else i am very glad if you are sending a sample code for me ...

thank you in advance
Back to top
openldev
Never Seen the Sunlight


Joined: 21 Sep 2005
Posts: 386
Location: Fairfax, Virginia

PostPosted: Thu Jun 21, 2007 2:22 pm    Post subject: Reply with quote

Sorry, I am very busy at work, so I can't really post any sample code, but I can point you in the right direction. You can create a timeout that is called every 500 milliseconds or so:

http://developer.gnome.org/doc/API/2.0/glib/glib-The-Main-Event-Loop.html#g-timeout-add

Then, you figure out how much of the file has been transferred thus far. If you have a global variable that is incremented every time the timeout is called, you will know about how long it has taken to transfer that much data. For example, let us assume that your file is 500KB, and when the timeout is called the second time, 100KB has already been copied. Then, we know it took 1000 milliseconds (2 timeouts * 500 milliseconds) to transfer 20% of the file. So, it should take about 4000 milliseconds to transfer the remaining 80%. You continually do this until the file is transferred.
Back to top
ramesh
Familiar Face


Joined: 16 Nov 2006
Posts: 40

PostPosted: Fri Jun 22, 2007 11:02 am    Post subject: Reply with quote

openldev wrote:
Sorry, I am very busy at work, so I can't really post any sample code, but I can point you in the right direction. You can create a timeout that is called every 500 milliseconds or so:

http://developer.gnome.org/doc/API/2.0/glib/glib-The-Main-Event-Loop.html#g-timeout-add

Then, you figure out how much of the file has been transferred thus far. If you have a global variable that is incremented every time the timeout is called, you will know about how long it has taken to transfer that much data. For example, let us assume that your file is 500KB, and when the timeout is called the second time, 100KB has already been copied. Then, we know it took 1000 milliseconds (2 timeouts * 500 milliseconds) to transfer 20% of the file. So, it should take about 4000 milliseconds to transfer the remaining 80%. You continually do this until the file is transferred.


i used g_timeot_add()
ok its working but it continously pulsing... progress bar.
after reaching the end point it have to stop or close the copy window..

and am again soory to tell this..
i am unable to do the estimated time and %of receiving data..

please help with some code

thank you in advance
Back to top
Display posts from previous:   
Post new topic   Reply to topic    GTK+ Forums Forum Index -> GTK+ Programming All times are GMT
Page 1 of 1

 


Powered by phpBB © 2001, 2005 phpBB Group
CodeBB 1.0 Beta 2
Protected by Anti-Spam ACP