[MPlayer-dev-eng] [PATCH] Add support for GNOME screensaver
Dominik 'Rathann' Mierzejewski
dominik at rangers.eu.org
Fri Apr 28 22:35:17 CEST 2006
On Friday, 28 April 2006 at 20:42, Piotr Kaczuba wrote:
> Attached is the sixth revision of the patch. It should now use the GNOME
> screensaver 2.15 API first and if this fails, revert to 2.14 API.
>
> Piotr
> +
> + /* First call the GNOME screensaver 2.15 API method */
> + error = NULL;
> + ret =
> + dbus_g_proxy_call(proxy, "UnInhibit", &error, G_TYPE_UINT, cookie,
> + G_TYPE_INVALID);
> +
> + /* If this fails, try the GNOME screensaver 2.14 API */
> + if (!ret && error->domain == DBUS_GERROR
> + && error->code == DBUS_GERROR_UNKNOWN_METHOD) {
> + mp_msg(MSGT_VO, MSGL_V,
> + "%s: GNOME screensaver 2.15 API failed, trying 2.14 API\n",
> + funcname);
> + error = NULL;
> + ret =
> + dbus_g_proxy_call(proxy, "AllowActivation", &error,
> + G_TYPE_INVALID, G_TYPE_INVALID);
> + }
A static variable remembering which API should be used could be in order
here.
[...]
> + /* First call the GNOME screensaver 2.15 API method */
> + error = NULL;
> + ret =
> + dbus_g_proxy_call(proxy, "Inhibit", &error, G_TYPE_STRING,
> + GS_APPLICATION_NAME, G_TYPE_STRING,
> + GS_REASON_FOR_INHIBIT, G_TYPE_INVALID,
> + G_TYPE_UINT, cookie, G_TYPE_INVALID);
> +
> + /* If this fails, try the GNOME screensaver 2.14 API */
> + if (!ret && error->domain == DBUS_GERROR
> + && error->code == DBUS_GERROR_UNKNOWN_METHOD) {
> + mp_msg(MSGT_VO, MSGL_V,
> + "%s: GNOME screensaver 2.15 API failed, trying 2.14 API\n",
> + funcname);
> + error = NULL;
> + ret =
> + dbus_g_proxy_call(proxy, "InhibitActivation", &error,
> + G_TYPE_STRING, GS_REASON_FOR_INHIBIT,
> + G_TYPE_INVALID, G_TYPE_INVALID);
> + }
You could use it here then, eliminating half of the function calls.
Regards,
R.
--
MPlayer developer and RPMs maintainer: http://rpm.greysector.net/mplayer/
There should be a science of discontent. People need hard times and
oppression to develop psychic muscles.
-- from "Collected Sayings of Muad'Dib" by the Princess Irulan
More information about the MPlayer-dev-eng
mailing list