Thats the only way i know, remove the "_" and then compare ...

In my C# code


textView.PopulatePopup+=(o,args)=>
{
if(args.PopupisMenumenu)
{
menu.Forall((widget)=>
{
if(widgetisMenuItemmenuItem)
{
switch(menuItem.Label.Replace("_",string.Empty))
{
case"InsertĀ Emoji":
menu.Remove(menuItem);
break;


Am 06.02.19 um 00:44 schrieb Mitko Haralanov:
Yes, I got that far as well. However, the question is a bit more
involved. How do find out which menu item corresponds to entries that
I don't want? I could start doing string compares against the menu
item name but that gets tricky with the underscore/keyboard shortcut
notation. For example: if I were to compare the string "_Copy"
expecting to find the Copy menu item but the implementation has
changed the item string to be "C_opy", it just breaks.

As I mentioned, "populate-popup" (as the name implies) seems more
meant to *add* items, not necessarily remove.

Thank you,
- Mitko

On Tue, Feb 5, 2019 at 2:34 PM Wolfgang Mauer
<[email protected]> wrote:
Within the signal you can get the menu an then just 
remove(gtk_container_remove) the items you don't want..


Am 05.02.19 um 22:43 schrieb Mitko Haralanov via gnome-devtools:

Can no-one help? Are there any GtkSourceView devs reading this forum?

On Mon, Dec 10, 2018 at 10:29 AM Mitko Haralanov <[email protected]> wrote:

Any ideas on this?

Thanks.

On Mon, Oct 15, 2018 at 8:23 AM Mitko Haralanov <[email protected]> wrote:

Hi,

I am writing an application that uses GtkSourceView but examines source files 
in read-only mode. As such, I don't need a lot of the menu items in the pop-up 
menu that deal with editing/changing the source code. In addition, I would like 
to add some menu items of my own.

I know that I can connect to the "populate-popup" signal in order to edit the 
menu that is displayed but that only makes sense for adding more items to the menu.

How would I go about removing items? I'd like to avoid clearing the entire menu as I would like to 
keep items like "Copy" and "Select All".

Thank you,
Mitko

_______________________________________________
gnome-devtools mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/gnome-devtools
_______________________________________________
gnome-devtools mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/gnome-devtools

Reply via email to