aboutsummaryrefslogtreecommitdiffstats
path: root/libfsoresource
diff options
context:
space:
mode:
authorMichael 'Mickey' Lauer <mickey@vanille-media.de>2010-10-31 13:54:40 +0100
committerMichael 'Mickey' Lauer <mickey@vanille-media.de>2010-12-20 21:16:57 +0100
commitb4fb91423da647a50e3975677a6c8c34c7f42c08 (patch)
treeb94d5022e93c537d682cdd1807df53eee6ffb6f8 /libfsoresource
parentb6ae4786d2862a61ae1d338a930d690b728fbec2 (diff)
downloadcornucopia-b4fb91423da647a50e3975677a6c8c34c7f42c08.tar.gz
cornucopia-b4fb91423da647a50e3975677a6c8c34c7f42c08.tar.bz2
cornucopia-b4fb91423da647a50e3975677a6c8c34c7f42c08.zip
libfsoresource: (gdbus) switch to gdbus
Diffstat (limited to 'libfsoresource')
-rw-r--r--libfsoresource/configure.ac4
-rw-r--r--libfsoresource/fsoresource/dbusresource.vala61
2 files changed, 32 insertions, 33 deletions
diff --git a/libfsoresource/configure.ac b/libfsoresource/configure.ac
index bd007825..2d767ad6 100644
--- a/libfsoresource/configure.ac
+++ b/libfsoresource/configure.ac
@@ -16,8 +16,8 @@ AC_SUBST(LDFLAGS)
# pkg-config requirements
PKG_PROG_PKG_CONFIG
-VALA_REQUIRED=0.9.7
-GLIB_REQUIRED=2.18.0
+VALA_REQUIRED=0.9.11
+GLIB_REQUIRED=2.26.0
FSO_BASICS_REQUIRED=0.8.9.9
FSO_FRAMEWORK_REQUIRED=0.2.3.1
FSO_GLIB_REQUIRED=2010.05.11.2
diff --git a/libfsoresource/fsoresource/dbusresource.vala b/libfsoresource/fsoresource/dbusresource.vala
index b413a5a6..1cbd2233 100644
--- a/libfsoresource/fsoresource/dbusresource.vala
+++ b/libfsoresource/fsoresource/dbusresource.vala
@@ -27,21 +27,24 @@ namespace FsoFramework {
public abstract class AbstractDBusResource : FreeSmartphone.Resource, FsoFramework.AbstractObject
{
private FsoFramework.DBusSubsystem subsystem;
- private dynamic DBus.Object usage; /* needs to be dynamic for async */
+ private FreeSmartphone.Usage usage;
private string name;
- private DBus.ObjectPath path;
+ private ObjectPath path;
public AbstractDBusResource( string name, FsoFramework.Subsystem subsystem )
{
this.name = name;
this.subsystem = subsystem as FsoFramework.DBusSubsystem;
- this.path = new DBus.ObjectPath( "%s/%s".printf( FsoFramework.Resource.ServicePathPrefix, name ) );
+ this.path = new ObjectPath( "%s/%s".printf( FsoFramework.Resource.ServicePathPrefix, name ) );
var conn = this.subsystem.dbusConnection();
//FIXME: try/catch
- conn.register_object( this.path, this );
+ //FIXME: Why is this not using the subsystem API?
+ conn.register_object<FreeSmartphone.Resource>( this.path, this );
- Idle.add( registerWithUsage );
+ Idle.add( () => {
+ registerWithUsage();
+ } );
}
public override string repr()
@@ -49,37 +52,33 @@ public abstract class AbstractDBusResource : FreeSmartphone.Resource, FsoFramewo
return @"<$name>";
}
- public bool registerWithUsage()
+ public async void registerWithUsage()
{
#if DEBUG
message( "registering..." );
#endif
- if (usage == null)
+ if ( usage == null )
{
var conn = subsystem.dbusConnection();
- usage = conn.get_object( FsoFramework.Usage.ServiceDBusName,
- FsoFramework.Usage.ServicePathPrefix,
- FsoFramework.Usage.ServiceFacePrefix ); /* dynamic for async */
- usage.register_resource( name, path, onRegisterResourceReply );
+ // sync not working here !?
+ usage = conn.get_proxy_sync<FreeSmartphone.Usage>( FsoFramework.Usage.ServiceDBusName, FsoFramework.Usage.ServicePathPrefix );
+
+ //usage = yield conn.get_proxy<FreeSmartphone.Usage>( FsoFramework.Usage.ServiceDBusName, FsoFramework.Usage.ServicePathPrefix );
+
+ try
+ {
+ yield usage.register_resource( name, path );
+ logger.info( "Ok. Registered with org.freesmartphone.ousaged" );
+ }
+ catch ( GLib.Error e )
+ {
+ logger.error( @"$(e.message): Can't register resource with fsousaged, enabling unconditionally..." );
+ enableResource();
+ }
}
#if DEBUG
message( "...OK" );
#endif
- return false; // MainLoop: don't call me again
- }
-
- public void onRegisterResourceReply( GLib.Error e )
- {
- if ( e != null )
- {
- logger.error( @"$(e.message): Can't register resource with fsousaged, enabling unconditionally..." );
- enableResource();
- return;
- }
- else
- {
- logger.info( "Ok. Registered with org.freesmartphone.ousaged" );
- }
}
/**
@@ -105,31 +104,31 @@ public abstract class AbstractDBusResource : FreeSmartphone.Resource, FsoFramewo
//
// DBUS API
//
- public async void disable() throws FreeSmartphone.ResourceError, DBus.Error
+ public async void disable() throws FreeSmartphone.ResourceError, DBusError, IOError
{
assert( logger.debug( @"Disabling resource $classname..." ) );
yield disableResource();
}
- public async void enable() throws FreeSmartphone.ResourceError, DBus.Error
+ public async void enable() throws FreeSmartphone.ResourceError, DBusError, IOError
{
assert( logger.debug( @"Enabling resource $classname..." ) );
yield enableResource();
}
- public async void resume() throws FreeSmartphone.ResourceError, DBus.Error
+ public async void resume() throws FreeSmartphone.ResourceError, DBusError, IOError
{
assert( logger.debug( @"Resuming resource $classname..." ) );
yield resumeResource();
}
- public async void suspend() throws FreeSmartphone.ResourceError, DBus.Error
+ public async void suspend() throws FreeSmartphone.ResourceError, DBusError, IOError
{
assert( logger.debug( @"Suspending resource $classname..." ) );
yield suspendResource();
}
- public async GLib.HashTable<string,GLib.Value?> get_dependencies() throws DBus.Error
+ public async GLib.HashTable<string,GLib.Value?> get_dependencies() throws DBusError, IOError
{
assert( logger.debug( @"Inquiring dependencies for $classname..." ) );
var result = yield dependencies();