diff options
Diffstat (limited to 'cython/sbservices.pxi')
| -rw-r--r-- | cython/sbservices.pxi | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/cython/sbservices.pxi b/cython/sbservices.pxi index 6eece0a..28aa5a5 100644 --- a/cython/sbservices.pxi +++ b/cython/sbservices.pxi | |||
| @@ -26,19 +26,13 @@ cdef class SpringboardServicesError(BaseError): | |||
| 26 | BaseError.__init__(self, *args, **kwargs) | 26 | BaseError.__init__(self, *args, **kwargs) |
| 27 | 27 | ||
| 28 | cdef class SpringboardServicesClient(Base): | 28 | cdef class SpringboardServicesClient(Base): |
| 29 | __service_name__ = "com.apple.springboardservices" | ||
| 29 | cdef sbservices_client_t _c_client | 30 | cdef sbservices_client_t _c_client |
| 30 | 31 | ||
| 31 | def __cinit__(self, iDevice device not None, LockdownClient lockdown=None, *args, **kwargs): | 32 | def __cinit__(self, iDevice device not None, int port, *args, **kwargs): |
| 32 | cdef: | 33 | cdef: |
| 33 | iDevice dev = device | 34 | iDevice dev = device |
| 34 | LockdownClient lckd | 35 | self.handle_error(sbservices_client_new(dev._c_dev, port, &self._c_client)) |
| 35 | if lockdown is None: | ||
| 36 | lckd = LockdownClient(dev) | ||
| 37 | else: | ||
| 38 | lckd = lockdown | ||
| 39 | port = lckd.start_service("com.apple.springboardservices") | ||
| 40 | err = SpringboardServicesError(sbservices_client_new(dev._c_dev, port, &(self._c_client))) | ||
| 41 | if err: raise err | ||
| 42 | 36 | ||
| 43 | def __dealloc__(self): | 37 | def __dealloc__(self): |
| 44 | if self._c_client is not NULL: | 38 | if self._c_client is not NULL: |
| @@ -52,7 +46,6 @@ cdef class SpringboardServicesClient(Base): | |||
| 52 | def __get__(self): | 46 | def __get__(self): |
| 53 | cdef: | 47 | cdef: |
| 54 | plist.plist_t c_node = NULL | 48 | plist.plist_t c_node = NULL |
| 55 | plist.Node node | ||
| 56 | sbservices_error_t err | 49 | sbservices_error_t err |
| 57 | err = sbservices_get_icon_state(self._c_client, &c_node) | 50 | err = sbservices_get_icon_state(self._c_client, &c_node) |
| 58 | try: | 51 | try: |
| @@ -61,11 +54,9 @@ cdef class SpringboardServicesClient(Base): | |||
| 61 | if c_node != NULL: | 54 | if c_node != NULL: |
| 62 | plist_free(c_node) | 55 | plist_free(c_node) |
| 63 | raise | 56 | raise |
| 64 | node = plist.plist_t_to_node(c_node) | 57 | return plist.plist_t_to_node(c_node) |
| 65 | return node | ||
| 66 | def __set__(self, plist.Node newstate not None): | 58 | def __set__(self, plist.Node newstate not None): |
| 67 | cdef plist.Node node = newstate | 59 | self.handle_error(sbservices_set_icon_state(self._c_client, newstate._c_node)) |
| 68 | self.handle_error(sbservices_set_icon_state(self._c_client, node._c_node)) | ||
| 69 | 60 | ||
| 70 | cpdef bytes get_pngdata(self, bytes bundleId): | 61 | cpdef bytes get_pngdata(self, bytes bundleId): |
| 71 | cdef: | 62 | cdef: |
