Progress Bar Question.

Hi all,

Two questions in one.  

The example code in the online tutorial shows how to increment the
status bar using adjustments .... but I don't want to increment ... I
want to let it loose in the yard for a while to get some exercise and
fresh air while I change the water bowl.  How does one tell the progress
bar to run back and forth without having to tend to it or worry about it
the whole time?

I'd like to fork a process and start the progress bar off on it's merry
little jog.  Then when the process is finished, I'd need to stop the
progress bar.  But I don't know how to start/stop the progress bar OR
how to handle the forking of a process.

Could you help? Please ;-)

Here's what I have so far:

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/wait.h>

#include <glib.h>

void find_files (GtkButton *button, gchar *day)
  pid_t pid;
  GtkLabel *main_label;
  main_label = (gpointer)lookup_widget(GTK_BUTTON(button),

  GtkProgress *progress_bar;
  progress_bar = (gpointer)lookup_widget(GTK_BUTTON(button),

  gchar *update_label = g_strconcat("Please wait: Finding ", day, "
Files\n", NULL);
  gtk_label_set_text(main_label, update_label);

  pid = fork();
  if (pid == -1) {
    g_error("Forking Failed")
  } else if (pid == 0) {

    // Somehow start the progress bar on it's skip-to-the-loo ...

    g_print("CHILD: My process id: %d\n", (gint)getpid();
    execlp("find", "find", "/home/tony", NULL);

    // Stop the progress bar somehow ....


Thanks for any help ;-)


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