Re: gnome applets with gtkmm



On Fri, 2006-30-06 at 09:42 +0200, Murray Cumming wrote:
> On Fri, 2006-06-30 at 01:01 -0600, Gezim Hoxha wrote:
> >     Gtk::EventBox gtkmmApplet = static_cast<Gtk::EventBox> (*applet);
> >     gtkmmApplet.add (*panelLabel);
> > 
> > BTW, I get this error: no matching function for call to
> > 'Gtk::EventBox::EventBox (_PanelApplet &)'
> 
> Widgets do not have copy constructors (because there would be no
> sensible behaviour when copying a widget). You should use a pointer or
> reference in this case.

>From my understanding (forgive me if I didn't understand), you're
implying that the assignment operator '=' will call the copy constructor
in this line "Gtk::EventBox gtkmmApplet = static_cast<Gtk::EventBox>
(*applet)" with that in mind I changed that line to:
Gtk::EventBox &gtkmmApplet = static_cast <Gtk::EventBox> (*applet);

However, that gives me the same error as above, specifically:
error: no matching function for call to 'Gtk::EventBox::EventBox
(_PanelApplet&)'

I attached the full source, too.


#include <iostream>
#include <panel-applet.h>
#include <gtkmm/label.h>
#include <gtkmm/eventbox.h>

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

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

    Gtk::Label *panelLabel = Gtk::manage (new Gtk::Label ("Hello World" ) );

    Gtk::EventBox &gtkmmApplet = static_cast <Gtk::EventBox> (*applet);
    gtkmmApplet.add (*panelLabel);

    //gtk_container_add (GTK_CONTAINER (applet),
    //                             GTK_WIDGET (panelLabel->gobj ()));

    gtk_widget_show_all (GTK_WIDGET (applet));

    return true;
}

//PANEL_APPLET_BONOBO_FACTORY ("OAFIID:gPrayerTimesApplet_Factory",
//	PANEL_TYPE_APPLET, "The Prayer Times Applet",
//	"0.1",
//	(PanelAppletFactoryCallback) gPrayerTimesDashboard,
//	NULL);


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