~ubuntu-branches/ubuntu/oneiric/dbus-glib/oneiric-updates

« back to all changes in this revision

Viewing changes to test/interfaces/test-client.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastian Dröge
  • Date: 2006-11-01 10:51:01 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20061101105101-2dbr969h8k05n1b2
Tags: 0.72-0ubuntu1
* Sync with pkg-utopia SVN. This is infact 0.72-1 which sits in NEW
* New upstream release
* debian/control:
  + Require libdbus-1-dev (>= 0.94) and libglib2.0-dev (>= 2.6)
  + Add build dependency on gtk-doc-tools (>= 1.4)
* debian/control,
  debian/libdbus-glib-1-doc.install:
  + Add libdbus-glib-1-doc package

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <stdlib.h>
 
2
#include "test-song-bindings.h"
 
3
#include "test-hello-bindings.h"
 
4
#include "test-goodbye-bindings.h"
 
5
 
 
6
#define TEST_NAMESPACE "org.freedesktop.DBus.GLib.Test.Interfaces"
 
7
#define TEST_OBJECT_PATH "/org/freedesktop/DBus/GLib/Test/Interfaces"
 
8
 
 
9
int
 
10
main (int    argc,
 
11
      char **argv)
 
12
{
 
13
  DBusGConnection *connection;
 
14
  DBusGProxy *proxy;
 
15
  GError *error = NULL;
 
16
  gchar *str;
 
17
  gboolean success;
 
18
 
 
19
  g_type_init ();
 
20
 
 
21
  connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
 
22
  if (connection == NULL)
 
23
    {
 
24
      g_error ("Failed to make connection to session bus: %s", error->message);
 
25
      g_error_free (error);
 
26
      exit(1);
 
27
    }
 
28
 
 
29
  proxy = dbus_g_proxy_new_for_name (connection, TEST_NAMESPACE, TEST_OBJECT_PATH,
 
30
                                     "org.freedesktop.DBus.GLib.Test.Interfaces.Song");
 
31
  success = org_freedesktop_DBus_GLib_Test_Interfaces_Song_get_title (proxy, &str, &error);
 
32
  g_object_unref (proxy);
 
33
 
 
34
  if (!success)
 
35
    {
 
36
      g_print ("Error while calling Parent object method: %s\n", error->message);
 
37
      g_error_free (error);
 
38
      exit(1);
 
39
    }
 
40
  else
 
41
    {
 
42
      g_free (str);
 
43
      g_print ("Called Parent object method with success\n");
 
44
    }
 
45
 
 
46
  proxy = dbus_g_proxy_new_for_name (connection, TEST_NAMESPACE, TEST_OBJECT_PATH,
 
47
                                     "org.freedesktop.DBus.GLib.Test.Interfaces.Hello");
 
48
  g_assert (proxy != NULL);
 
49
  success = org_freedesktop_DBus_GLib_Test_Interfaces_Hello_say_hello (proxy, &str, &error);
 
50
  g_object_unref (proxy);
 
51
 
 
52
  if (!success)
 
53
    {
 
54
      g_print ("Error while calling Parent Interface object method: %s\n", error->message);
 
55
      g_error_free (error);
 
56
      exit(1);
 
57
    }
 
58
  else
 
59
    {
 
60
      g_free (str);
 
61
      g_print ("Called Parent Interface object method with success\n");
 
62
    }
 
63
 
 
64
  proxy = dbus_g_proxy_new_for_name (connection, TEST_NAMESPACE, TEST_OBJECT_PATH,
 
65
                                     "org.freedesktop.DBus.GLib.Test.Interfaces.Goodbye");
 
66
  success = org_freedesktop_DBus_GLib_Test_Interfaces_Goodbye_say_goodbye (proxy, &str, &error);
 
67
  g_object_unref (proxy);
 
68
 
 
69
  if (!success)
 
70
    {
 
71
      g_print ("Error while calling Object Interface object method: %s\n", error->message);
 
72
      g_error_free (error);
 
73
      exit(1);
 
74
    }
 
75
  else
 
76
    {
 
77
      g_free (str);
 
78
      g_print ("Called Object Interface object method with success\n");
 
79
    }
 
80
 
 
81
  exit(0);
 
82
}
 
83
 
 
84
/* ex:ts=2:et: */
 
85