users/desowin/cdemu-tray

changeset 12:fffeb66db077

check daemon interface version
author Tomasz Mon <desowin@gmail.com>
date Sat Dec 27 15:06:29 2008 +0100 (2008-12-27)
parents 03f2deb5ea48
children 1dc745f47628
files cdemu-tray.c
line diff
     1.1 --- a/cdemu-tray.c	Sat Dec 27 11:12:36 2008 +0100
     1.2 +++ b/cdemu-tray.c	Sat Dec 27 15:06:29 2008 +0100
     1.3 @@ -579,18 +579,36 @@
     1.4  
     1.5      gchar *version;
     1.6      err = NULL;
     1.7 -    dbus_g_proxy_call(g_proxy, "GetDaemonVersion", &err,
     1.8 +    dbus_g_proxy_call(g_proxy, "GetLibraryVersion", &err,
     1.9                        G_TYPE_INVALID, G_TYPE_STRING, &version, G_TYPE_INVALID);
    1.10      if (err) {
    1.11 -        printf("Error calling GetDaemonVersion: %s\n", err->message);
    1.12 +        printf("Error calling GetLibraryVersion: %s\n", err->message);
    1.13          g_error_free(err);
    1.14          g_object_unref(g_proxy);
    1.15          dbus_g_connection_unref(connection);
    1.16          return 1;
    1.17      }
    1.18 -    printf("Daemon version: %s\n", version);
    1.19 +    printf("libMirage version used by daemon: %s\n", version);
    1.20      g_free(version);
    1.21  
    1.22 +    gint iface_version;
    1.23 +    err = NULL;
    1.24 +    dbus_g_proxy_call(g_proxy, "GetDaemonInterfaceVersion", &err,
    1.25 +                      G_TYPE_INVALID, G_TYPE_INT, &iface_version, G_TYPE_INVALID);
    1.26 +
    1.27 +    if (err) {
    1.28 +        printf("Error calling GetDaemonInterfaceVersion: %s\n", err->message);
    1.29 +        g_error_free(err);
    1.30 +        g_object_unref(g_proxy);
    1.31 +        dbus_g_connection_unref(connection);
    1.32 +        return 1;
    1.33 +    }
    1.34 +
    1.35 +    if (iface_version != 1) {
    1.36 +        printf("Unknown Daemon interface version (%d)\n", iface_version);
    1.37 +        return 1;
    1.38 +    }
    1.39 +
    1.40      setup_tray();
    1.41      connect_signals();
    1.42      gtk_main();