GNOME Bugzilla – Bug 697601
reduce GMenuModel D-Bus traffic
Last modified: 2018-05-24 15:09:55 UTC
Here are two fixes that should help to reduce the amount of traffic sent over D-Bus when applications change their menus. The first is a patch to group changes into one signal sent from an idle (along with a testcase to make sure it's working). The next is a new API: g_menu_remove_all(). This prevents one from having to repeatedly call g_menu_remove() with each possible index.
Created attachment 241008 [details] [review] GMenuModel exporter: group change signals The GMenuModel D-Bus protocol has always supported grouping of change signals. We originally wanted to avoid potentially sending change signals for menus and actions out of sync with each other in order to avoid the case of menuitem being created for an action that did not yet exist on the remote side. We considered some rather exotic methods of dealing with this out-of-order issue including "reservations" on GDBusConnections for who would send the next message, but they all fell through. For this reason, the grouping feature of the protocol was never used: we were always sending one event per signal. As it turns out, the order in which menuitems and actions show up on the remote is not very important so we don't have to worry about this problem anymore. This patch implements the grouping (which is fairly easy because the code was specifically designed for this possibility).
Created attachment 241009 [details] [review] GMenu: add g_menu_remove_all() API Removes all of the items from a GMenu. The keyboard indicator wants to do this as part of refreshing the layout list, as an example.
Review of attachment 241008 [details] [review]: Looks reasonable - does it break the shell or unity ?
Review of attachment 241009 [details] [review]: Yes. Just add it to the docs too, please
Comment on attachment 241009 [details] [review] GMenu: add g_menu_remove_all() API Attachment 241009 [details] pushed as 1de0625 - GMenu: add g_menu_remove_all() API
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/glib/issues/687.