Thread: dbus-glib help/banshee-1. Help.

  1. #1
    Registered User
    Join Date
    Feb 2009

    dbus-glib help/banshee-1. Help.

    I am tring to write a Banshee 1.4.3 spammer in c on Linux Debian Lenny using C and dbus-glib.

    But I can't figure out how to grab the track information right. x.x I get an error on compile, stating:
    spammer.c:57: error: dereferencing pointer to incomplete type.

    #include <stdio.h>
    #include <dbus/dbus-glib.h>
    #include <string.h>
    void banshee_get(GHashTable *table, const char *key, char *dest)
           GValue* value = (GValue*) g_hash_table_lookup(table, key);
           if (value != NULL && G_VALUE_HOLDS_STRING(value)) {
                 strncpy(dest, g_value_get_string(value), strlen-1);
    int main (int argc, char **argv)
      DBusGConnection *connection;
      GError *error;
      DBusGProxy *proxy;
      struct TrackInfo *tinfo;
      GHashTable* table;
      g_type_init ();
      error = NULL;
      connection = dbus_g_bus_get (DBUS_BUS_SESSION,
      if (connection == NULL)
          g_printerr ("Failed to open connection to bus: %s\n",
          g_error_free (error);
          exit (1);
      /* Create a proxy object for the "bus driver" (name "org.bansheeproject.Banshee") */
      proxy = dbus_g_proxy_new_for_name (connection,
      /* Call GetCurrentTrack method, wait for reply */
      error = NULL;
      if (!dbus_g_proxy_call (proxy, "GetCurrentTrack", &error, G_TYPE_INVALID,
                               dbus_g_type_get_map("GHashTable", G_TYPE_STRING, G_TYPE_VALUE), &table,
          g_printerr ("Error: %s\n", error->message);
          g_error_free (error);
          exit (1);
      /* Print the results */
      banshee_get(table, "album", tinfo->album);
      g_object_unref (proxy);
      return 0;
    gcc `pkg-config --libs --cflags glib-2.0 dbus-glib-1` spammer.c
    Last edited by Fujitaka; 04-14-2009 at 02:32 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. deploying glib function
    By MK27 in forum C Programming
    Replies: 2
    Last Post: 12-10-2008, 08:18 PM
  2. Problem with a GLIB
    By giladist in forum C Programming
    Replies: 3
    Last Post: 05-26-2007, 11:29 PM
  3. Glib and file manipulation
    By unixOZ in forum Linux Programming
    Replies: 1
    Last Post: 03-22-2004, 09:39 PM