Re: gnome desktop integration library



Hi Havoc,

On Tue, 2006-09-05 at 21:16 -0400, Havoc Pennington wrote:
> Hi,
> 
> To be slightly more constructive, I was thinking on the drive home, why 
> wouldn't there be something like:
> 
> interface GdkSession {
>    signal "online-changed"
>    signal "screensaver-changed"
>    signal "idleness-changed"
>    signal "logging-out"
> 
>    /* plus getters for all those states */
> }
> 
> GdkSession* gdk_display_get_session(GdkDisplay *display);
> 
> This seems to cover lots of the issues raised. It would obviously have 
> platform-specific backend, which could be dbus, or anything else that works.

Ideally you'd just wrap the interfaces exported by the Power Manager and
the Screen Saver [1] when running on GNOME. That shouldn't be too hard
provided you don't have to dlopen libdbus.so.*.

Not sure how this fit into the Win32 / Mac OS X / etc. story of GTK+
cross platform - last thing I want is GTK+ trying to abstract the
o.g.PowerManager and o.g.ScreenSaver abstractions. Rather, let's review
said D-BUS interfaces and make sure they work on e.g. Win32 too. 

(Oh, and for the record, both Richard and Jon have proposed these as
freedesktop standards a while back on xdg-list. Not sure where that is
going right now.)

Some history though; the existing interfaces have evolved a bit from
their initial conception - there are (good or bad) reasons they are a
bit more complicated (e.g. cookie passing) than the simple interface you
outlined above, Havoc. 

For example, while it's cute just having the "logging-out" signal it's
racy as hell... if you're interested in the user logging out, it means
you are interested in saving some state or whatever. Thus, you need a
mechanism for delaying (up to a certain amount of time) the logout
procedure. There's also stuff like priorities - you don't want your
per-session VPN connection to go down before your word processor have
saved the document to the corporate file share. Things like that, doing
things correctly without races is just hard. 

Of course, this may be a deliberate decision, a trade off if you want,
to get a simpler API while ignoring potential races. I'm, however, of
the opinion that we need to provide a correct API even though it may be
hard to use. It's a fine line though. I'm not convinced there's a right
answer in general.

Anyway, getting this into GTK+ (or parts of it into some form of GLib as
neither the power manager nor the screen saver (in theory) have hard X
deps) might even be a nice push for getting these interfaces frozen,
1.0, the full shebang, you know. 

How does this sound to the g-p-m, g-s and GTK+ maintainers?

     David


[1] : 

[davidz daxter ~]$ dbus-send --print-reply --session --dest=org.gnome.PowerManager /org/gnome/PowerManager org.freedesktop.DBus.Introspectable.Introspect
method return sender=:1.2 -> dest=:1.25
   string "<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd";>
<node>
  <interface name="org.freedesktop.DBus.Introspectable">
    <method name="Introspect">
      <arg name="data" direction="out" type="s"/>
    </method>
  </interface>
  <interface name="org.freedesktop.DBus.Properties">
    <method name="Get">
      <arg name="interface" direction="in" type="s"/>
      <arg name="propname" direction="in" type="s"/>
      <arg name="value" direction="out" type="v"/>
    </method>
    <method name="Set">
      <arg name="interface" direction="in" type="s"/>
      <arg name="propname" direction="in" type="s"/>
      <arg name="value" direction="in" type="v"/>
    </method>
  </interface>
  <interface name="org.gnome.PowerManager">
    <method name="UnInhibit">
      <arg name="cookie" type="u" direction="in"/>
    </method>
    <method name="Inhibit">
      <arg name="application" type="s" direction="in"/>
      <arg name="reason" type="s" direction="in"/>
      <arg name="cookie" type="u" direction="out"/>
    </method>
    <method name="SetDpmsMode">
      <arg name="mode" type="s" direction="in"/>
    </method>
    <method name="GetDpmsMode">
      <arg name="mode" type="s" direction="out"/>
    </method>
    <method name="Reboot">
    </method>
    <method name="Shutdown">
    </method>
    <method name="Suspend">
    </method>
    <method name="Hibernate">
    </method>
    <method name="AllowedReboot">
      <arg name="can" type="b" direction="out"/>
    </method>
    <method name="AllowedShutdown">
      <arg name="can" type="b" direction="out"/>
    </method>
    <method name="AllowedHibernate">
      <arg name="can" type="b" direction="out"/>
    </method>
    <method name="AllowedSuspend">
      <arg name="can" type="b" direction="out"/>
    </method>
    <method name="GetOnAc">
      <arg name="on_ac" type="b" direction="out"/>
    </method>
    <method name="GetLowPowerMode">
      <arg name="low_power" type="b" direction="out"/>
    </method>
    <signal name="DpmsModeChanged">
      <arg type="s"/>
    </signal>
    <signal name="OnAcChanged">
      <arg type="b"/>
    </signal>
  </interface>
</node>
"
[davidz daxter ~]$ dbus-send --print-reply --session --dest=org.gnome.ScreenSaver /org/gnome/ScreenSaver org.freedesktop.DBus.Introspectable.Introspect
method return sender=:1.11 -> dest=:1.26
   string "<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd";>
<node>
  <interface name="org.freedesktop.DBus.Introspectable">
    <method name="Introspect">
      <arg name="data" direction="out" type="s"/>
    </method>
  </interface>
  <interface name="org.gnome.ScreenSaver">
    <method name="Lock">
    </method>
    <method name="Cycle">
    </method>
    <method name="SimulateUserActivity">
    </method>
    <method name="Inhibit">
      <arg name="application_name" direction="in" type="s"/>
      <arg name="reason" direction="in" type="s"/>
      <arg name="cookie" direction="out" type="u"/>
    </method>
    <method name="UnInhibit">
      <arg name="cookie" direction="in" type="u"/>
    </method>
    <method name="Throttle">
      <arg name="application_name" direction="in" type="s"/>
      <arg name="reason" direction="in" type="s"/>
      <arg name="cookie" direction="out" type="u"/>
    </method>
    <method name="UnThrottle">
      <arg name="cookie" direction="in" type="u"/>
    </method>
    <method name="GetActive">
      <arg name="value" direction="out" type="b"/>
    </method>
    <method name="GetActiveTime">
      <arg name="seconds" direction="out" type="u"/>
    </method>
    <method name="SetActive">
      <arg name="value" direction="in" type="b"/>
    </method>
    <method name="GetSessionIdle">
      <arg name="value" direction="out" type="b"/>
    </method>
    <method name="GetSessionIdleTime">
      <arg name="seconds" direction="out" type="u"/>
    </method>
    <signal name="ActiveChanged">
      <arg name="new_value" type="b"/>
    </signal>
    <signal name="SessionIdleChanged">
      <arg name="new_value" type="b"/>
    </signal>
    <signal name="AuthenticationRequestBegin">
    </signal>
    <signal name="AuthenticationRequestEnd">
    </signal>
  </interface>
</node>
"





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