Re: gnome applets with gtkmm



Thanks for that. Yes it helped :)

Good to hear that :-)

I got the GTK+ version working but I have no idea how to convert it to
GTKMM.
Okay, cool.

[...]

okay, here is what I get after quickly changing the code:
#include <iostream>
#include <panel-applet.h>
#include <gtkmm/label.h>

using namespace std ;
using namespace Glib ;
using namespace Gtk ;

=~=

static bool
myexample_applet_fill (PanelApplet *applet, const gchar *iid, gpointer data)
{
   if (!iid) {
       return false ;
   }

   if (ustring (iid) != "OAFIID:ExampleApplet") {
       cerr << "got a call for an other applet\n" ;
       return false ;
   }

   Label *label = manage( new Label ("Hello World"));
   gtk_container_add (GTK_CONTAINER (applet),
                                GTK_WIDGET (label->gobj ()));

   gtk_widget_show_all (GTK_WIDGET (applet));

   return true;
}

PANEL_APPLET_BONOBO_FACTORY ("OAFIID:ExampleApplet_Factory",
                           PANEL_TYPE_APPLET,
                           "The Hello World Applet",
                           "0",
                           (PanelAppletFactoryCallback) myexample_applet_fill,
                           NULL);
=~=

To compile it, I ran:
g++ -o test-applet `pkg-config --libs --cflags libpanelapplet-2.0
gtkmm-2.4` test-applet.cc

I don't know if it runs okay though :-) But you should get the idea .

Cheers,

Dodji.



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