xfdesktop trash troubles

Brian J. Tarricone bjt23 at cornell.edu
Wed Aug 23 10:04:56 CEST 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hey Benny (or anyone),

I'm trying to use dbus directly to handle the trash stuff in xfdesktop,
and I can't seem to get it to work properly.  I'm probably just doing
something wrong (and the dbus-glib docs are rather sparse), but can you
help?

With the following code, The 'QueryTrash' call works as expected, but
the 'DisplayTrash' call returns "No reply within specified time" in the
GError.

- From the cmdline, running:
dbus-send --print-reply --dest=org.xfce.FileManager \
    /org/xfce/FileManager org.xfce.Trash.DisplayTrash string:':0'
does indeed work as expected.

Any ideas?  I've tried setting display_name to "", ":0", and ":0.0" for
the hell of it; no luck.

	-brian

- -------------- cut here --------------
/* compile with:
 * gcc -o dbus-test dbus-test.c `pkg-config glib-2.0 dbus-glib-1 \
       --cflags --libs`
 */

#include <glib.h>
#define DBUS_API_SUBJECT_TO_CHANGE
#include <dbus/dbus-glib.h>

int
main(int argc,
     char **argv)
{
    DBusGConnection *dgconn;
    DBusGProxy *dbus_proxy;
    gboolean ret, trash_full;
    GError *error = NULL;
    const gchar *display_name = g_getenv("DISPLAY");

    g_type_init();

    dgconn = dbus_g_bus_get(DBUS_BUS_SESSION, NULL);
    dbus_proxy = dbus_g_proxy_new_for_name(dgconn,
                                           "org.xfce.FileManager",
                                           "/org/xfce/FileManager",
                                           "org.xfce.Trash");

    /* this works */
    ret = dbus_g_proxy_call(dbus_proxy, "QueryTrash", &error,
                            G_TYPE_INVALID,
                            G_TYPE_BOOLEAN, &trash_full,
                            G_TYPE_INVALID);
    if(ret)
        g_print("Trash is %sfull\n", trash_full ? "" : "not ");
    else {
        g_printerr("QueryTrash failed: %s", error->message);
        error = NULL;
    }

    /* this does not */
    ret = dbus_g_proxy_call(dbus_proxy, "DisplayTrash", &error,
                            G_TYPE_STRING, &display_name,
                            G_TYPE_INVALID, G_TYPE_INVALID);

    if(!ret)
        g_printerr("DisplayTrash failed: %s\n", error->message);

    return 0;
}
- -------------- cut here --------------

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.4 (GNU/Linux)

iD8DBQFE7Awo6XyW6VEeAnsRAoBuAKCybIXjz7iRRb9mG02Sdk6smYQBCQCgoeRx
NjU5uJ6Ynd6Wy0RbjH7AuTo=
=C27F
-----END PGP SIGNATURE-----



More information about the Xfce4-dev mailing list