static VALUE rg_m_idle_add_priority(VALUE self, VALUE priority) { VALUE func, rb_id; callback_info_t *info; guint id; func = rb_block_proc(); info = ALLOC(callback_info_t); info->callback = func; info->key = id__idle_callbacks__; id = gtk_idle_add_full(NUM2INT(priority), (GtkFunction)gtk_m_function, NULL, (gpointer)info, g_free); info->id = id; rb_id = UINT2NUM(id); G_RELATIVE2(self, func, id__idle_callbacks__, rb_id); return rb_id; }
/* Causes the mainloop to call the given function whenever no events * with higher priority are to be processed. The default priority is * GTK_PRIORITY_DEFAULT, which is rather low. */ int clip_GTK_IDLEADD(ClipMachine * cm) { gint priority = INT_OPTION(cm,1,G_PRIORITY_DEFAULT_IDLE); C_var *c; CHECKOPT(1,NUMERIC_t); CHECKARG2(2,PCODE_t,CCODE_t); if (priority > G_PRIORITY_HIGH) priority = G_PRIORITY_HIGH; c = NEW(C_var); c->cm = cm; //c->cfunc = NEW(ClipVar); _clip_mclone(cm,&c->cfunc, _clip_spar(cm,2)); _clip_retni(cm,gtk_idle_add_full(priority,(GtkFunction)__func,NULL, c,_destroy__func)); return 0; err: return 1; }