Re: Changing popup menu of GtkSourceView
Wolfgang Mauer <[email protected]> Wed, 6 Feb 2019 07:45:27 +0100
| Newsgroups | gmane.comp.gnome.devtools |
|---|---|
| Message-ID | <[email protected]> |
This is a multi-part message in MIME format.
--===============3749621788235169919==
Content-Type: multipart/alternative;
boundary="------------DFC9C4379511D3102CA9A6E8"
Content-Language: de-DE
This is a multi-part message in MIME format.
--------------DFC9C4379511D3102CA9A6E8
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: quoted-printable
X-MIME-Autoconverted: from 8bit to quoted-printable by smtp.kabelmail.de id x166jRYY024796
Thats the only way i know, remove the "_" and then compare ...
In my C# code
textView.PopulatePopup+=3D(o,args)=3D>
{
if(args.PopupisMenumenu)
{
menu.Forall((widget)=3D>
{
if(widgetisMenuItemmenuItem)
{
switch(menuItem.Label.Replace("_",string.Empty))
{
case"Insert=C2=A0Emoji":
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_contain=
er_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 sourc=
e 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 ad=
dition, 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 e=
dit 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 en=
tire 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
--------------DFC9C4379511D3102CA9A6E8
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-MIME-Autoconverted: from 8bit to quoted-printable by smtp.kabelmail.de id x166jRYY024796
<html>
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3DUTF=
-8">
</head>
<body text=3D"#000000" bgcolor=3D"#FFFFFF">
<p>Thats the only way i know, remove the "_" and then compare ...</p>
<p>In my C# code</p>
<p><br>
</p>
<p>
<font face=3D"Ubuntu Mono">
<span style=3D"color:#222222;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0 </span><span
style=3D"color:#222222;">textView</span><span
style=3D"color:#222222;">.</span><span style=3D"color:#222222;"=
>PopulatePopup</span><span
style=3D"color:#222222;">=C2=A0</span><span style=3D"color:#222=
222;">+=3D</span><span
style=3D"color:#222222;">=C2=A0</span><span style=3D"color:#222=
222;">(</span><span
style=3D"color:#222222;">o</span><span style=3D"color:#222222;"=
>,</span><span
style=3D"color:#222222;">=C2=A0</span><span style=3D"color:#222=
222;">args</span><span
style=3D"color:#222222;">)</span><span style=3D"color:#222222;"=
>=C2=A0</span><span
style=3D"color:#222222;">=3D></span><br>
<span style=3D"color:#222222;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0</span><span
style=3D"color:#222222;">{</span><br>
<span style=3D"color:#222222;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0</span><span
style=3D"color:#009695;">if</span><span style=3D"color:#222222;=
">=C2=A0</span><span
style=3D"color:#222222;">(</span><span style=3D"color:#222222;"=
>args</span><span
style=3D"color:#222222;">.</span><span style=3D"color:#222222;"=
>Popup</span><span
style=3D"color:#222222;">=C2=A0</span><span style=3D"color:#009=
695;">is</span><span
style=3D"color:#222222;">=C2=A0</span><span style=3D"color:#336=
3a4;">Menu</span><span
style=3D"color:#222222;">=C2=A0</span><span style=3D"color:#222=
222;">menu</span><span
style=3D"color:#222222;">)</span><br>
<span style=3D"color:#222222;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0</span><span
style=3D"color:#222222;">{</span><br>
<span style=3D"color:#222222;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0</span><span
style=3D"color:#222222;">menu</span><span style=3D"color:#22222=
2;">.</span><span
style=3D"color:#222222;">Forall</span><span
style=3D"color:#222222;">((</span><span style=3D"color:#222222;=
">widget</span><span
style=3D"color:#222222;">)</span><span style=3D"color:#222222;"=
>=C2=A0</span><span
style=3D"color:#222222;">=3D></span><br>
<span style=3D"color:#222222;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0</span><span
style=3D"color:#222222;">{</span><br>
<span style=3D"color:#222222;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0</span><span
style=3D"color:#009695;">if</span><span style=3D"color:#222222;=
">=C2=A0</span><span
style=3D"color:#222222;">(</span><span style=3D"color:#222222;"=
>widget</span><span
style=3D"color:#222222;">=C2=A0</span><span style=3D"color:#009=
695;">is</span><span
style=3D"color:#222222;">=C2=A0</span><span style=3D"color:#336=
3a4;">MenuItem</span><span
style=3D"color:#222222;">=C2=A0</span><span style=3D"color:#222=
222;">menuItem</span><span
style=3D"color:#222222;">)</span><br>
<span style=3D"color:#222222;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0</span><span
style=3D"color:#222222;">{</span><br>
<span style=3D"color:#222222;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0</span><span
style=3D"color:#009695;">switch</span><span
style=3D"color:#222222;">=C2=A0</span><span style=3D"color:#222=
222;">(</span><span
style=3D"color:#222222;">menuItem</span><span
style=3D"color:#222222;">.</span><span style=3D"color:#222222;"=
>Label</span><span
style=3D"color:#222222;">.</span><span style=3D"color:#222222;"=
>Replace</span><span
style=3D"color:#222222;">(</span><span style=3D"color:#db7100;"=
>"_"</span><span
style=3D"color:#222222;">,</span><span style=3D"color:#222222;"=
>=C2=A0</span><span
style=3D"color:#009695;">string</span><span
style=3D"color:#222222;">.</span><span style=3D"color:#222222;"=
>Empty</span><span
style=3D"color:#222222;">))</span><br>
<span style=3D"color:#222222;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0</span><span
style=3D"color:#222222;">{</span><br>
<span style=3D"color:#222222;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0</span><span
style=3D"color:#009695;">case</span><span style=3D"color:#22222=
2;">=C2=A0</span><span
style=3D"color:#db7100;">"Insert=C2=A0Emoji"</span><span
style=3D"color:#222222;">:</span><br>
<span style=3D"color:#222222;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0</span><span
style=3D"color:#222222;">menu</span><span style=3D"color:#22222=
2;">.</span><span
style=3D"color:#222222;">Remove</span><span
style=3D"color:#222222;">(</span><span style=3D"color:#222222;"=
>menuItem</span><span
style=3D"color:#222222;">);</span><br>
<span style=3D"color:#222222;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0</span><span
style=3D"color:#009695;">break</span><span
style=3D"color:#222222;">;</span></font></p>
<p><font face=3D"Ubuntu Mono"><span style=3D"color:#222222;"></span><=
br>
</font>
</p>
<div class=3D"moz-cite-prefix">Am 06.02.19 um 00:44 schrieb Mitko
Haralanov:<br>
</div>
<blockquote type=3D"cite"
cite=3D"mid:[email protected]=
l.com">
<pre class=3D"moz-quote-pre" wrap=3D"">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
<a class=3D"moz-txt-link-rfc2396E" href=3D"mailto:wolfgang.mauer@kabelmai=
l.de"><[email protected]></a> wrote:
</pre>
<blockquote type=3D"cite">
<pre class=3D"moz-quote-pre" wrap=3D"">
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 <a class=3D"moz-txt-link=
-rfc2396E" href=3D"mailto:[email protected]"><[email protected]&=
gt;</a> wrote:
Any ideas on this?
Thanks.
On Mon, Oct 15, 2018 at 8:23 AM Mitko Haralanov <a class=3D"moz-txt-link-=
rfc2396E" href=3D"mailto:[email protected]"><[email protected]&g=
t;</a> wrote:
Hi,
I am writing an application that uses GtkSourceView but examines source f=
iles 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 addit=
ion, 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 ite=
ms to the menu.
How would I go about removing items? I'd like to avoid clearing the entir=
e menu as I would like to keep items like "Copy" and "Select All".
Thank you,
Mitko
_______________________________________________
gnome-devtools mailing list
<a class=3D"moz-txt-link-abbreviated" href=3D"mailto:gnome-devtools@gnome=
..org">[email protected]</a>
<a class=3D"moz-txt-link-freetext" href=3D"https://mail.gnome.org/mailman=
/listinfo/gnome-devtools">https://mail.gnome.org/mailman/listinfo/gnome-d=
evtools</a>
</pre>
</blockquote>
</blockquote>
</body>
</html>
--------------DFC9C4379511D3102CA9A6E8--
--===============3749621788235169919==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
gnome-devtools mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/gnome-devtools
--===============3749621788235169919==--