Changeset 4320:024275201dee in roaraudio


Ignore:
Timestamp:
09/07/10 15:55:11 (14 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

support global notify core

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • include/libroar/notify.h

    r4317 r4320  
    6767#define roar_notify_core_free(x) roar_notify_core_unref((x)) 
    6868 
     69int roar_notify_core_new_global(ssize_t lists); 
     70 
    6971int roar_notify_core_register_proxy(struct roar_notify_core * core, void (*cb)(struct roar_notify_core * core, struct roar_event * event, void * userdata), void * userdata); 
    7072 
  • libroar/notify.c

    r4316 r4320  
    5858}; 
    5959 
    60 #define _CKRCORE(ret) if ( core == NULL ) { roar_errno = ROAR_ERROR_INVAL; return (ret); } 
     60static struct roar_notify_core * _libroar_notify_core = NULL; 
     61 
     62#define _CKRCORE(ret) if ( core == NULL ) { if ( _libroar_notify_core == NULL ) { roar_errno = ROAR_ERROR_INVAL; return (ret); } else { core = _libroar_notify_core; } } 
    6163#define _CKICORE() _CKRCORE(-1) 
    6264 
     
    163165} 
    164166 
     167int roar_notify_core_new_global(ssize_t lists) { 
     168 if ( _libroar_notify_core != NULL ) { 
     169  roar_errno = ROAR_ERROR_INVAL; 
     170  return -1; 
     171 } 
     172 
     173 if ( (_libroar_notify_core = roar_notify_core_new(lists)) == NULL ) 
     174  return -1; 
     175 
     176 return 0; 
     177} 
     178 
    165179int roar_notify_core_register_proxy(struct roar_notify_core * core, void (*cb)(struct roar_notify_core * core, struct roar_event * event, void * userdata), void * userdata) { 
    166180 _CKICORE(); 
Note: See TracChangeset for help on using the changeset viewer.