After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 665314 - Document app menu things in sufficient detail
Document app menu things in sufficient detail
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Class: GtkApplication
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks: 665312
 
 
Reported: 2011-12-01 18:04 UTC by Matthias Clasen
Modified: 2011-12-20 17:10 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Matthias Clasen 2011-12-01 18:04:54 UTC
We need to document how menus and actions are tied together and (maybe) where things are exported.
Comment 1 Matthias Clasen 2011-12-01 18:06:05 UTC
We could have a 'D-Bus specifics' section in the GApplication docs that explains some details of D-Bus use in GApplication.
Comment 2 Matthias Clasen 2011-12-16 16:02:23 UTC
Things we probably want to document:

_DBUS_APPLICATION_ID(UTF8_STRING) = "org.gtk.Test.bloatpad"
_DBUS_UNIQUE_NAME(UTF8_STRING) = ":1.120"
_DBUS_OBJECT_PATH(UTF8_STRING) = "/org/gtk/Test/bloatpad/windows/0"

What do these X properties mean ?

/org/gtk/Test/bloatpad
/org/gtk/Test/bloatpad/menus/AppMenu
/org/gtk/Test/bloatpad/menus/MenuBar
/org/gtk/Test/bloatpad/windows/0

What can I do with any of these paths ? (Answer: for the first/last is
g_dbus_action_group_get, for the middle ones is g_dbus_menu_model_get)

What does one use the application id (well-known name) for ?
What should one better use the unique name for ?
Comment 3 Matthias Clasen 2011-12-16 16:24:12 UTC
How does this look ? Doesn't cover the X properties (that would go into GtkApplication docs). Needs some text about well-known name vs unique name.

--

D-Bus implementation details

The details in this section are really only interesting for implementors of
'desktop shells'. Note that all the D-Bus interfaces mentioned in this
section are not considered stable API, and are subject to change. Use them at your own risk !

On platforms where D-Bus is used for GApplication, it claims the application id
as a well-known name on the users session bus. It exports an application object at the path that is created by converting the application id into an object path 'in the obvious way'. E.g. an appication with id

org.gtk.Test.bloatpad

will export its application object at

/org/gtk/Test/bloatpad

The object implements the org.gtk.Application interface, which is used by remote GApplication instances to implement 'activate', 'open', and 'commandline'. It also implements the org.gtk.Actions interface to export the application actions, and you can create a GDBusActionGroup to access these actions remotely by passing the object path to the constructor:

g_dbus_action_group_get (bus, "org.gtk.Test.bloatpad", "/org/gtk/Test/bloatpad")

When you use g_application_set_app_menu() or g_application_set_menubar(), GApplication also exports these menu models as objects on the bus, at the following paths (continuing the earlier example):

/org/gtk/Test/bloatpad/menus/AppMenu
/org/gtk/Test/bloatpad/menus/MenuBar

The objects implement the org.gtk.Menus interface. You can create a GDBusMenuModel to access these objects remotely by passing  the object paths to the constructor:

g_dbus_menu_model_get (bus, "org.gtk.Test.bloatpad", "/org/gtk/Test/bloatpad/menus/AppMenu");

When using GtkApplication together with GtkApplicationWindow, the window-specific actions are also exported on the bus, at paths like

/org/gtk/Test/bloatpad/windows/0
Comment 4 Allison Karlitskaya (desrt) 2011-12-18 02:13:44 UTC
I think that this sort of documentation isn't really suitable to include in the gtk reference documentation.

Ideally, I'd like to see us uncommitted to D-Bus API for a cycle or two and then progress to a stage where we feel comfortable with standardising this stuff (possibly under the freedesktop.org banner).  Until then, I think we should maintain something that looks vaguely like what could become the standards document.  The wiki is probably a better place for that...
Comment 5 Matthias Clasen 2011-12-18 07:02:39 UTC
There you go:

https://live.gnome.org/GTK%2B/GApplication-dbus-apis

to be continued...
Comment 6 Matthias Clasen 2011-12-20 17:10:49 UTC
I'll add references to the wiki page in some appropriate places in the api docs.
Closing this.