From a21d6d7dedf4361e6eabeac14e63e45672e90c0f Mon Sep 17 00:00:00 2001 From: Prashanth Mundkur Date: Thu, 30 Jul 2009 21:17:05 -0700 Subject: [PATCH] [dbus_server] support immutable properties --- common/dbus_server.ml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/common/dbus_server.ml b/common/dbus_server.ml index b02396e..85bbacc 100644 --- a/common/dbus_server.ml +++ b/common/dbus_server.ml @@ -142,6 +142,7 @@ module Property = struct | Set_Double of (float -> bool) * (float -> unit) | Set_String of (string -> bool) * (string -> unit) | Set_ObjectPath of (string -> bool) * (string -> unit) + | Set_Immutable (* common utility predicate *) let true_predicate _ = true @@ -178,6 +179,7 @@ module Property = struct | Set_Double _ -> "double" | Set_String _ -> "string" | Set_ObjectPath _ -> "objectpath" + | Set_Immutable -> "immutable" type t = getter * setter @@ -257,6 +259,10 @@ module Property = struct | Some (Set_ObjectPath (p, f)), DBus.ObjectPath v -> if p v then begin f v; Right [] end else invalid_error + | Some Set_Immutable, _ -> + Left (DBus.ERR_FAILED, "immutable property", + [ DBus.String (Printf.sprintf "Property \"%s\" is immutable" pname) ] + ) | Some g, _ -> Left (DBus.ERR_INVALID_ARGS, "invalid arg(s)", [ DBus.String ( -- 2.39.5