Re: org.gnome.Application DBus Interface



On Thu, 2007-08-16 at 15:07 +0200, Rodrigo Moya wrote:
> On Thu, 2007-08-16 at 14:33 +0200, Xavier Bestel wrote:
> > 
> > The problem with that is you're one more step away from the canonical
> > "object.property = value".
> > If you're adding an indirection level to the DBus mechanism with
> > InvokeAction(), then why not adding one more level and call
> > org.gnome.Application.InvokeAction("CallFunction", "OpenDocument", "file:///mydoc.txt") ?
> > 
> > IMHO the simplest and cleanest, the better.
> > 
> > > Although I'm thinking that we might need also a ListActions method, to
> > > retrieve the list of actions supported by the application.
> > 
> > That means you'll add another mechanism for introspection (that's what
> > your "ListAction" will derive into, after others will notice you'll need
> > to add parameters types and return types maybe).
> > 
> > Basically you're nearly implementing yet another object system into
> > DBus.
> > 
> well, that's not what I mean. We are talking about providing an easy way
> for apps to call actions on other apps, right? For complex interfaces,
> you need a proper DBus interface, but what if my app just has a
> DoWhatever action? Should I create a new DBus interface just for that?

Yes!

> Should apps willing to use my DoWhatever action get the interface's
> introspection files, generate bindings for that, and use a new, specific
> object just for calling that method? And what about apps that use lots
> of apps' interfaces (Atomato, for instance, which is what I would like
> this for), should those use dozens of introspection files, generate
> dozens of bindings just for using 1 or 2 methods on each app?
> 
> If we go that way, nobody would want to use my DoWhatever action,
> because we would be making a very simple task ("call an action on this
> app") a PITA for the developer.

I don't think so! You don't need to generate bindings for every D-Bus
interface you want to use, you know. I don't use the GLib bindings
myself but I *think* it goes something like this:

media_player_proxy = dbus_g_proxy_new_for_name (connection,
	"org.gnome.Rhythmbox",
        "/org/gnome/Rhythmbox,
	"org.gnome.MediaPlayer"); // Any random interface here

error = NULL;
dbus_g_proxy_call (proxy, "Pause", &error, G_TYPE_INVALID, G_TYPE_INVALID);

In python:

rhythmbox_obj = bus.get_object("org.gnome.Rhythmbox", "/org/gnome/Rhythmbox")
rhythmbox_media_player = dbus.Interface(rhythmbox_obj, "org.gnome.MediaPlayer")
rhythmbox_media_player.Pause()

Ya see?




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]