Panel Applet

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

 



I'm getting segfault when I try to add popup menu.
I'm using gtkmm & libpanelappletmm (the c++ wrappers)
The rest of the program works if the setup_menu() is commented out. But popup menus just doesn't seem to work.

This is the related functions

Label *valstr,*l1,*l2;
HBox *hbox;

static bool update_value()
{
    static int j=1;
    ++j;

    valstr->set_text(g_strdup_printf("%d",j));
    return true;
}


static void about_dialog (BonoboUIComponent *ui_container,gpointer user_data,const gchar *cname)
{

    MessageDialog *d=new MessageDialog("About");

       {
           l1->set_text("hello");
            d->hide();
       }
}

static const ustring menu_xml =
    "<popup name=\"button3\">\n"
    "   <menuitem name=\"Get Size Item\"\n"
    "             verb=\"SimpleGetSize\" _label=\"Get _Size...\"\n"
    "             pixtype=\"stock\" pixname=\"gtk-properties\"/>\n"
    "</popup>\n";



 BonoboUIVerb menu_verbs[] =
    {
        BONOBO_UI_VERB ("SimpleGetSize", &about_dialog),
        BONOBO_UI_VERB_END
    };

//main
static bool myapplet(Applet *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 ;
     }

     Glib::init();

     hbox=new HBox;

     l1=new Label(" my own 1 ");
     l2=new Label(" my own 2 ");
     Image *i=new Image("/usr/share/pixmaps/apple-red.png");

     hbox->add(*l1);
    // hbox->add(*i);
     hbox->add(*l2);

     valstr=new Label(" ");

     valstr->set_text("valstr");

     hbox->add(*valstr);
     hbox->show();



     sigc::slot<bool> timeslot(&update_value);
     sigc::connection conn = signal_timeout().connect(timeslot,500);

      applet->setup_menu(menu_xml,menu_verbs,NULL);
//    panel_applet_setup_menu(applet->gobj(),menu_xml,menu_verbs,NULL);

     gtk_container_add(GTK_CONTAINER(applet), GTK_WIDGET(hbox->gobj()));
     gtk_widget_show_all(GTK_WIDGET(applet));

    return true;
}    int result=d->run();

    if(result==RESPONSE_OK)
       {
           l1->set_text("hello");
            d->hide();
       }
}

static const ustring menu_xml =
    "<popup name=\"button3\">\n"
    "   <menuitem name=\"Get Size Item\"\n"
    "             verb=\"SimpleGetSize\" _label=\"Get _Size...\"\n"
    "             pixtype=\"stock\" pixname=\"gtk-properties\"/>\n"
    "</popup>\n";



 BonoboUIVerb menu_verbs[] =
    {
        BONOBO_UI_VERB ("SimpleGetSize", &about_dialog),
        BONOBO_UI_VERB_END
    };

//main
static bool myapplet(Applet *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 ;
     }

     Glib::init();

     hbox=new HBox;

     l1=new Label(" my own 1 ");
     l2=new Label(" my own 2 ");
     Image *i=new Image("/usr/share/pixmaps/apple-red.png");

     hbox->add(*l1);
    // hbox->add(*i);
     hbox->add(*l2);

     valstr=new Label(" ");

     valstr->set_text("valstr");

     hbox->add(*valstr);
     hbox->show();



     sigc::slot<bool> timeslot(&update_value);
     sigc::connection conn = signal_timeout().connect(timeslot,500);

      applet->setup_menu(menu_xml,menu_verbs,NULL);
//    panel_applet_setup_menu(applet->gobj(),menu_xml,menu_verbs,NULL);

     gtk_container_add(GTK_CONTAINER(applet), GTK_WIDGET(hbox->gobj()));
     gtk_widget_show_all(GTK_WIDGET(applet));

    return true;
}

This is the gdb back trace.


Program received signal SIGSEGV, Segmentation fault.
0x004a7d39 in panel_applet_setup_menu (applet=0x3,
    xml=0x804f624 "<popup name=\"button3\">\n   <menuitem name=\"Get Size Item\"\n", ' ' <repeats 13 times>, "verb=\"SimpleGetSize\" _label=\"Get _Size...\"\n", ' ' <repeats 13 times>, "pixtype=\"stock\" pixname=\"gtk-properties\"/>\n</popup>\n", verb_list=0x804d120, user_data=0x0) at panel-applet.c:509
509    panel-applet.c: No such file or directory.
    in panel-applet.c
(gdb) bt
#0  0x004a7d39 in panel_applet_setup_menu (applet=0x3,
    xml=0x804f624 "<popup name=\"button3\">\n   <menuitem name=\"Get Size Item\"\n", ' ' <repeats 13 times>, "verb=\"SimpleGetSize\" _label=\"Get _Size...\"\n", ' ' <repeats 13 times>, "pixtype=\"stock\" pixname=\"gtk-properties\"/>\n</popup>\n", verb_list=0x804d120, user_data=0x0) at panel-applet.c:509
#1  0x001387b8 in Gnome::Panel::Applet::setup_menu(Glib::ustring const&, BonoboUIVerb const*, void*) () from /usr/lib/libpanelappletmm-2.6.so.1
#2  0x08049d44 in myapplet (applet=0x80b2000, iid=0x80c3538 "OAFIID:ExampleApplet", data="" at /media/****/LINUX_PROGRAMS/usage_monitor/applet_gtkmm1/mine1.h:91
#3  0x004abb94 in panel_applet_marshal_BOOLEAN__STRING (closure=0x80ac860, return_value=0xbfffe8cc, n_param_values=2, param_values=0x80c3888, invocation_hint=0x0, marshal_data=0x804991b)
    at panel-applet-marshal.c:130
#4  0x00ffc412 in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0
#5  0x00f5b2cc in bonobo_closure_invoke_va_list () from /usr/lib/libbonobo-2.so.0
#6  0x00f5b549 in bonobo_closure_invoke () from /usr/lib/libbonobo-2.so.0
#7  0x004aa7cb in panel_applet_control_bound (control=0x80b3a90, applet=0x80b2000) at panel-applet.c:1394
#8  0x0100b93c in g_cclosure_marshal_VOID__VOID () from /usr/lib/libgobject-2.0.so.0
#9  0x00ffc412 in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0
#10 0x01012595 in ?? () from /usr/lib/libgobject-2.0.so.0
#11 0x010139bc in g_signal_emit_valist () from /usr/lib/libgobject-2.0.so.0
#12 0x01013e62 in g_signal_emit () from /usr/lib/libgobject-2.0.so.0
#13 0x0071641e in ?? () from /usr/lib/libbonoboui-2.so.0
#14 0x00f5cfe1 in _ORBIT_skel_small_Bonobo_Control_setFrame () from /usr/lib/libbonobo-2.so.0
#15 0x00fcc0b7 in ?? () from /usr/lib/libORBit-2.so.0
#16 0x00fd26d5 in ORBit_OAObject_invoke () from /usr/lib/libORBit-2.so.0
#17 0x00fbecfb in ORBit_small_invoke_adaptor () from /usr/lib/libORBit-2.so.0
#18 0x00fd01fd in ?? () from /usr/lib/libORBit-2.so.0
#19 0x00fd08e7 in ?? () from /usr/lib/libORBit-2.so.0
#20 0x00fd0a7e in ?? () from /usr/lib/libORBit-2.so.0
#21 0x00fd2981 in ORBit_handle_request () from /usr/lib/libORBit-2.so.0
#22 0x00fbb0e2 in giop_connection_handle_input () from /usr/lib/libORBit-2.so.0
#23 0x00fda203 in ?? () from /usr/lib/libORBit-2.so.0
#24 0x00fdca76 in ?? () from /usr/lib/libORBit-2.so.0
#25 0x0107d855 in g_main_context_dispatch () from /lib/libglib-2.0.so.0
#26 0x01081668 in ?? () from /lib/libglib-2.0.so.0
#27 0x01081ba7 in g_main_loop_run () from /lib/libglib-2.0.so.0
#28 0x00f47723 in bonobo_main () from /usr/lib/libbonobo-2.so.0
#29 0x00f4590e in bonobo_generic_factory_main_timeout () from /usr/lib/libbonobo-2.so.0
#30 0x00f45993 in bonobo_generic_factory_main () from /usr/lib/libbonobo-2.so.0
#31 0x004a6fd4 in panel_applet_factory_main_closure (iid=0x804a971 "OAFIID:ExampleApplet_Factory", applet_type=134924832, closure=0x80ac860) at panel-applet.c:1774
#32 0x004a70bb in panel_applet_factory_main (iid=0x804a971 "OAFIID:ExampleApplet_Factory", applet_type=134924832, callback=0x804991b <myapplet(Gnome::Panel::Applet*, gchar const*, gpointer)>,
    data="" at panel-applet.c:1798
#33 0x08049f38 in main (argc=1, argv=0xbffff424) at /media/****/LINUX_PROGRAMS/usage_monitor/applet_gtkmm1/main.cpp:16


Any thoughts?
_______________________________________________
gnome-list mailing list
gnome-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gnome-list

[Index of Archives]     [Fedora Desktop]     [Trinity Users]     [KDE]     [Gimp]     [Yosemite News]

  Powered by Linux