Fw: activity bars



 Here is a small example. Just you know, when I'm starting a work, I'm
 launching before IHM_BeginActivity and once finished IHM_EndActivity.
 aWindowsInfo_X is a global structure holding few informations about each
 GUI, iTimer is just an integer (the i stand for it!),
 IHM_ACTIVITY_REFRESH_TIME is a #define = 50, pbrActivityDisplay is a
 GtkWidget* pointing to the Progress(Activity) Bar. But have a look at the
 thread called "How to handle long I/O operations" because how I'm using it
 right now might not be the most efficient.

 void IHM_EndActivity()
 {
     /* Remove the timer callback */
     gtk_timeout_remove(aWindowsInfo_X.paIHMData->iTimer);
 }

 void IHM_BeginActivity()
 {
     /* Add a timer callback to update the value of the progress bar */
     aWindowsInfo_X.paIHMData->iTimer =
 gtk_timeout_add(IHM_ACTIVITY_REFRESH_TIME,
       IHM_ActivityTimeout, aWindowsInfo_X.paIHMData->pbrActivityDisplay);
 }

 int IHM_ActivityTimeout
  (
   gpointer paData                    /* The GtkWidget which point on the
 ProgressBar */
  )
 {
  double   dNewValue;
  GtkAdjustment  *adjActivityBarAdjustment;


  /* Calculate the value of the progress bar using the
  * value range set in the adjustment object */
  dNewValue = gtk_progress_get_value(GTK_PROGRESS(paData)) + 1;


  adjActivityBarAdjustment = GTK_PROGRESS(paData)->adjustment;

  if (dNewValue > adjActivityBarAdjustment->upper)
  {
   dNewValue = adjActivityBarAdjustment->lower;
  }

  /* Set the new value */
  gtk_progress_set_value(GTK_PROGRESS(paData), dNewValue);


  /* As this is a timeout function, return TRUE so that it
   * continues to get called */
  return(TRUE);
 }



 Best regards,
 ---
 Jean-Christophe Berthon

 Cap Gemini -- Ernst & Young
 France
 Skill Integration System -- Image Quality
 Email: Jean-Christophe Berthon cgey com
 Tel: (+33) 561 31 6639


 ----- Original Message -----
 From: "Will Frishe" <slyder earendel org>
 To: <gtk-app-devel-list gnome org>
 Sent: Tuesday, August 14, 2001 3:33 PM
 Subject: activity bars

>
> > Hey ppls.
> >
> > I've got normal progress bars working just fine, but in one place I just
> > want it to show activity. I found gtk_progress_set_activity_mode and
> > friends, which seems to set it up right (it looks ok when it pops up),
> > but how do I make it go??? I've tried a couple of things, none of which
> > seem to work, so I'm guessing I'm doing something dumb.
> >
> > Any help would be appreciated. Thanks.
> >
> > --
> > Slyder earendel org                  |      "Live to win, dare to fail."
> > Earendel / <insert here>             |                  -James Hetfield
> > Sing your dreams, Scream your song   |                   /\/\etallic/-\
> >
> > _______________________________________________
> > gtk-app-devel-list mailing list
> > gtk-app-devel-list gnome org
> > http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]