On Sat, 10 Aug 2013 12:16:16 -0400
"L. D. James" <lja...@apollo3.com> wrote:
[snip]
> The VPN application currently have 500 lines.  I'll strip it down to
> 50, making sure it retains functionality and post it.
> 
> One of the reasons I didn't post it before, but posted "sleep(10)" to
> represent the application was doing something, because the program is
> designed to make changes to the system.  But, I'm sure I'll be able to
> comment and have such a flow that you might be able to easily follow
> it just by looking at it, or, on your own, comment out the parts that
> makes changes.

If an outline of your code just consists of:

void check_stuff() {
  if (vpn_connections_changed()) std::cout << "XXX changed\n";
}

int main(int argc, char* argv[]) {
  for (;;) {
    sleep(10);
    check_stuff();
  }
  return 0;
}

Then in gtkmm this just becomes:

bool check_stuff() {
  if (vpn_connections_changed()) std::cout << "XXX changed\n";
  return true;
}

int main(int argc, char* argv[]) {
  Gtk::Main app(argc, argv);
  Glib::signal_timeout().connect_seconds(sigc::ptr_fun(&check_stuff), 10);
  app.run();
  return 0;
}

You can go from there and add your graphical interface to check_stuff()
in place of the call to std::cout.  You might, for example, want to
display a Gtk::MessageDialog object.  With gtkmm-3.0, you might want
to use Gtk::Application instead of Gtk::Main.  But first things first.

Chris
_______________________________________________
gtkmm-list mailing list
gtkmm-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtkmm-list

Reply via email to