Open gonzaarcr opened 3 years ago
This is a copy paste of my response: Well, I need to say that you do not use the same logic I used to do my implementation. Also, what I did was inefficient for Gtk and it should be improved, but I never found the time to do some experimentation with it and then improve it. In my opinion Gtk is not as good as DBusMenu can be in that regard.
Basic idea of what i did with DBusMenu:
Basic idea of what i did with Gtk:
As I also said I think it's much more productive if this conversation will take place in git, because i think there are people that also can help if they see the issue. So, maybe @rilian-la-te can help us a little here as he is the author of the vala-panel.
One of the few examples that works as it should: “Show sidebar” on Clementine. The app is made with Qt and uses com.canonical.dbusmenu
. When the item is clicked, it sends ItemsPropertiesUpdated
with the following parameters:
updated=dbus.Array([dbus.Struct((dbus.Int32(54), dbus.Dictionary({dbus.String('enabled'): dbus.Boolean(True, variant_level=1), dbus.String('label'): dbus.String('Mostrar barra lateral', variant_level=1), dbus.String('toggle-state'): dbus.Int32(0, variant_level=1), dbus.String('toggle-type'): dbus.String('checkmark', variant_level=1), dbus.String('visible'): dbus.Boolean(True, variant_level=1)}, signature=dbus.Signature('sv'))), signature=None)], signature=dbus.Signature('(ia{sv})')) removed=dbus.Array([], signature=dbus.Signature('(ias)'))
Clean version:
updated=[(54, {'enabled': True, 'label': 'Mostrar barra lateral', 'toggle-state': 0, 'toggle-type': 'checkmark', 'visible': True})]
removed=[]
Basically, it sends the id and the new info. Since Qt programs seems to behave nicely, I should search for one with more complex menus. FreeCAD, mentioned in #79, seems to be a good candidate (it has to be installed with an AppImage, I hope that does not interfere).
This is a feature that I’ve been wanting to add for a long time: the ability to update the menu on demand (without doing a full refresh). Currently, the menu updates only when a switch of application. Both interfaces (
com.canonical.dbusmenu
andorg.gtk.Menus
) provide signals to handle this (ItemsPropertiesUpdated
andChanged
, respectevely, among others), but none seems to work. The signalChanged
fromorg.gtk.Actions
seems to be working, but not all events arrive.I decided to create this issue to find external help because I’ve made no progress for a long time. I already contacted Lester, the author of Gnome Global Appmenu extension and he was the one that proposed to make this discussion public, wich I think is a great idea.
I will try to update this thread with more info and examples when I have time.