Re: [Vala] Allowable to add user data to callback?



On Sat, Aug 20, 2011 at 04:25:17PM -0700, bsquared wrote:
void pa_state_cb(pa_context *c, void *userdata) {
      pa_context_state_t state;
      int *pa_ready = userdata;

      state = pa_context_get_state(c);
      switch  (state) {
              // There are just here for reference
              case PA_CONTEXT_UNCONNECTED:
              case PA_CONTEXT_CONNECTING:
              case PA_CONTEXT_AUTHORIZING:
              case PA_CONTEXT_SETTING_NAME:
              default:
                      break;
              case PA_CONTEXT_FAILED:
              case PA_CONTEXT_TERMINATED:
                      *pa_ready = 2;
                      break;
              case PA_CONTEXT_READY:
                      *pa_ready = 1;
                      break;
      }
}

Something like the_method (() => { pa_state_cb (ctx, pa_ready); });

-- 
http://www.debian.org - The Universal Operating System



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]