diff options
Diffstat (limited to 'src/Applet/Applet.cpp')
-rw-r--r-- | src/Applet/Applet.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/Applet/Applet.cpp b/src/Applet/Applet.cpp new file mode 100644 index 00000000..39b0cc41 --- /dev/null +++ b/src/Applet/Applet.cpp @@ -0,0 +1,40 @@ +#include "CCApplet.h" +#include "DBusManager.h" +#include <iostream> + +//@@global applet object +CApplet *applet; +static void +crash_notify_cb(DBusGProxy *proxy, char* progname, gpointer user_data) +{ + DBusError error; + dbus_error_init (&error); +#ifdef DEBUG + std::cerr << "Application " << progname << " has crashed!" << std::endl; +#endif + /* smth happend, show the blinking icon */ + applet->BlinkIcon(true); + applet->ShowIcon(); +} + +int main(int argc, char **argv) +{ + Gtk::Main kit(argc, argv); + applet = new CApplet(); + CDBusManager dm; + /* connect to the daemon */ + try + { + dm.ConnectToDaemon(); + } + catch(std::string err) + { + std::cerr << "Applet: " << err << std::endl; + return -1; + } + /* catch the CC crash notify on the dbus */ + dm.RegisterToMessage("Crash",G_CALLBACK(crash_notify_cb),NULL,NULL); + /* run the main loop and wait for some events */ + Gtk::Main::run(); + return 0; +} |