dbus-glib help/banshee-1. Help.

This is a discussion on dbus-glib help/banshee-1. Help. within the C Programming forums, part of the General Programming Boards category; I am tring to write a Banshee 1.4.3 spammer in c on Linux Debian Lenny using C and dbus-glib. But ...

  1. #1
    Registered User
    Join Date
    Feb 2009
    Posts
    10

    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.




    Code:
    #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,
                                   &error);
      if (connection == NULL)
      {
          g_printerr ("Failed to open connection to bus: %s\n",
                      error->message);
          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,
                                         "org.bansheeproject.Banshee",
                                         "/org/bansheeproject/Banshee/PlayerEngine",
                                         "org.bansheeproject.Banshee.PlayerEngine");
    
      /* 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_TYPE_INVALID))
      {
          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 03: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-27-2007, 12:29 AM
  3. Glib and file manipulation
    By unixOZ in forum Linux Programming
    Replies: 1
    Last Post: 03-22-2004, 09:39 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21