This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes C / C++ and the fly likes Using Glibmm Main Event Loop Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Languages » C / C++
Bookmark "Using Glibmm Main Event Loop" Watch "Using Glibmm Main Event Loop" New topic

Using Glibmm Main Event Loop

Sverre Moe
Ranch Hand

Joined: Jul 10, 2007
Posts: 110
I am trying to understand and use Glibmm Main Event Loop. I find it difficult to understand what it actually do.
A program that wants to use the Main Event Loop first defines it like this:
Glib::RefPtr<Glib::MainLoop> _mainloop;

Then the constructor creates it like this:
Application::Application () :
_mainloop (Glib::MainLoop::create())

The application must implement a run function where it calls on mainloop->run().

Now: What exactly is it its doing?
I have read, but I am still lost, don't know why. Maybe I need a dumbed down explanation...
I have also tried to understand the following example:
From Java I am familiar with event listeners that listens for specific events. Don't know if this is similar.

Anyway from this code I cannot see what the mainloop actually does for this Application...
Anand Hariharan

Joined: Aug 22, 2006
Posts: 272

Glibmm is a C++ wrapper for GLib's GObjects.

To understand Glibmm's Main Event Loop, you may want to read Glib's documentation of Main Event Loop:

"Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away." -- Antoine de Saint-Exupery
It is sorta covered in the JavaRanch Style Guide.
subject: Using Glibmm Main Event Loop
It's not a secret anymore!