[Goodies-dev] xfce_panel_plugin_menu_insert_item() example ?

Stefan Stuhr xfcelists at sstuhr.dk
Sun Oct 22 20:59:33 CEST 2006


søn, 22 10 2006 kl. 19:46 +0200, skrev Landry Breuil:
> Hi !
> 
> I'm trying to customize my mpc panel-plugin, and add some
> GtkCheckMenuItem to the right-click menu.. but it never shows up. I
> only have the standard right-click menu.
> 
> Is the following code correct ? Is the item correctly initialized ?
> This code is called upon creation of plugin widget. 
> 
> GtkWidget* random = gtk_check_menu_item_new_with_label (_("Random"));
> gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(random), TRUE);
> xfce_panel_plugin_menu_insert_item(plugin,GTK_MENU_ITEM(random)); 
> 
> I didn't found any example of use for this function... so i can't
> figure how it works.

Remember that you have to gtk_widget_show your menuitem. Something like
this:

GtkWidget* random = gtk_check_menu_item_new_with_label (_("Random"));
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(random), TRUE);
xfce_panel_plugin_menu_insert_item(plugin,GTK_MENU_ITEM(random)); 
gtk_widget_show(GTK_WIDGET(random));

Warning: I am not used to C or GTK+ in C; I am used to PyGTK. If am
basing the above on your code, and how it's done in Python.

> Thanks,
> Landry

Stefan




More information about the Goodies-dev mailing list