本文整理汇总了C++中prop_subscribe函数的典型用法代码示例。如果您正苦于以下问题:C++ prop_subscribe函数的具体用法?C++ prop_subscribe怎么用?C++ prop_subscribe使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了prop_subscribe函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: audio_mastervol_init
static void
audio_mastervol_init(void)
{
htsmsg_t *m = htsmsg_store_load("audiomixer");
int32_t i32;
prop_t *pa, *mv, *mm;
pa = prop_create(prop_get_global(), "audio");
mv = prop_create(pa, "mastervolume");
mm = prop_create(pa, "mastermute");
prop_set_float_clipping_range(mv, -75, 12);
if(m != NULL && !htsmsg_get_s32(m, "master-volume", &i32))
prop_set_float(mv, (float)i32 / 1000);
prop_set_int(mm, 0);
htsmsg_release(m);
prop_subscribe(PROP_SUB_NO_INITIAL_UPDATE,
PROP_TAG_CALLBACK_FLOAT, save_matervol, NULL,
PROP_TAG_ROOT, mv,
NULL);
prop_subscribe(PROP_SUB_NO_INITIAL_UPDATE,
PROP_TAG_SET_INT, &audio_master_mute,
PROP_TAG_ROOT, mm,
NULL);
}
开发者ID:dreamcat4,项目名称:showtime,代码行数:30,代码来源:audio.c
示例2: nav_page_setup_prop
static void
nav_page_setup_prop(navigator_t *nav, nav_page_t *np, const char *view)
{
np->np_prop_root = prop_create_root("page");
if(view != NULL) {
np->np_view = strdup(view);
prop_set_string(prop_create(np->np_prop_root, "requestedView"), view);
}
// XXX Change this into event-style subscription
np->np_close_sub =
prop_subscribe(0,
PROP_TAG_ROOT, prop_create(np->np_prop_root, "close"),
PROP_TAG_CALLBACK_INT, nav_page_close_set, np,
PROP_TAG_COURIER, nav->nav_pc,
NULL);
prop_set_string(prop_create(np->np_prop_root, "url"), np->np_url);
np->np_direct_close_sub =
prop_subscribe(PROP_SUB_NO_INITIAL_UPDATE,
PROP_TAG_ROOT, prop_create(np->np_prop_root, "directClose"),
PROP_TAG_CALLBACK_INT, nav_page_direct_close_set, np,
PROP_TAG_COURIER, nav->nav_pc,
NULL);
}
开发者ID:CrashSerious,项目名称:showtime,代码行数:26,代码来源:navigator.c
示例3: nav_create
static navigator_t *
nav_create(prop_t *prop)
{
navigator_t *nav = calloc(1, sizeof(navigator_t));
nav->nav_prop_root = prop;
TAILQ_INIT(&nav->nav_pages);
TAILQ_INIT(&nav->nav_history);
nav->nav_prop_pages = prop_create(nav->nav_prop_root, "pages");
nav->nav_prop_curpage = prop_create(nav->nav_prop_root, "currentpage");
nav->nav_prop_can_go_back = prop_create(nav->nav_prop_root, "canGoBack");
nav->nav_prop_can_go_fwd = prop_create(nav->nav_prop_root, "canGoForward");
nav->nav_prop_can_go_home = prop_create(nav->nav_prop_root, "canGoHome");
prop_set_int(nav->nav_prop_can_go_home, 1);
nav->nav_pc = prop_courier_create_thread(NULL, "navigator");
nav->nav_eventsink =
prop_subscribe(0,
PROP_TAG_NAME("nav", "eventsink"),
PROP_TAG_CALLBACK, nav_eventsink, nav,
PROP_TAG_COURIER, nav->nav_pc,
PROP_TAG_ROOT, nav->nav_prop_root,
NULL);
nav->nav_dtor_tracker =
prop_subscribe(PROP_SUB_TRACK_DESTROY,
PROP_TAG_CALLBACK, nav_dtor_tracker, nav,
PROP_TAG_COURIER, nav->nav_pc,
PROP_TAG_ROOT, nav->nav_prop_root,
NULL);
return nav;
}
开发者ID:CrashSerious,项目名称:showtime,代码行数:35,代码来源:navigator.c
示例4: prop_reorder_create
void
prop_reorder_create(prop_t *dst, prop_t *src, int flags, const char *id)
{
prop_reorder_t *pr = calloc(1, sizeof(prop_reorder_t));
pr->pr_order = htsmsg_store_load(id);
if(pr->pr_order == NULL)
pr->pr_order = htsmsg_create_list();
pr->pr_store = strdup(id);
pr->pr_dst = flags & PROP_REORDER_TAKE_DST_OWNERSHIP ?
dst : prop_xref_addref(dst);
hts_mutex_lock(&prop_mutex);
pr->pr_srcsub = prop_subscribe(PROP_SUB_INTERNAL | PROP_SUB_DONTLOCK |
PROP_SUB_TRACK_DESTROY,
PROP_TAG_CALLBACK, src_cb, pr,
PROP_TAG_ROOT, src,
NULL);
pr->pr_dstsub = prop_subscribe(PROP_SUB_INTERNAL | PROP_SUB_DONTLOCK |
PROP_SUB_TRACK_DESTROY,
PROP_TAG_CALLBACK, dst_cb, pr,
PROP_TAG_ROOT, dst,
NULL);
hts_mutex_unlock(&prop_mutex);
}
开发者ID:Bibamaru,项目名称:showtime,代码行数:29,代码来源:prop_reorder.c
示例5: bookmark_add
static void
bookmark_add(const char *title, const char *url, const char *type)
{
bookmark_t *bm = calloc(1, sizeof(bookmark_t));
prop_t *p = prop_create_root(NULL);
prop_t *src = prop_create(p, "model");
prop_set_string(prop_create(src, "type"), "bookmark");
bm->bm_title_sub = bookmark_add_prop(src, "title", title, bm, set_title);
bm->bm_url_sub = bookmark_add_prop(src, "url", url, bm, set_url);
bm->bm_type_sub = bookmark_add_prop(src, "svctype", type, bm, set_type);
bm->bm_service = service_create(title, url, type, NULL, 1, 1);
prop_link(service_get_status_prop(bm->bm_service),
prop_create(src, "status"));
prop_link(service_get_statustxt_prop(bm->bm_service),
prop_create(src, "statustxt"));
prop_subscribe(PROP_SUB_TRACK_DESTROY | PROP_SUB_NO_INITIAL_UPDATE,
PROP_TAG_CALLBACK, bookmark_destroyed, bm,
PROP_TAG_ROOT, p,
PROP_TAG_MUTEX, &bookmark_mutex,
NULL);
if(prop_set_parent(p, prop_create(bookmarks, "nodes")))
abort();
}
开发者ID:MatChung,项目名称:showtime,代码行数:31,代码来源:bookmarks.c
示例6: add_news
prop_t *
add_news(const char *message, const char *location, const char *caption)
{
prop_t *p, *ret = NULL;
prop_t *root = prop_create(prop_get_global(), "news");
hts_mutex_lock(&news_mutex);
if(dismissed_news_out != NULL) {
if(htsmsg_get_u32_or_default(dismissed_news_in, message, 0)) {
dismis_news(message);
} else {
p = prop_create_root(NULL);
prop_set_string(prop_create(p, "message"), message);
prop_set_string(prop_create(p, "location"), location);
prop_set_string(prop_create(p, "caption"), caption);
prop_subscribe(PROP_SUB_TRACK_DESTROY,
PROP_TAG_CALLBACK, news_sink, prop_ref_inc(p),
PROP_TAG_ROOT, prop_create(p, "eventSink"),
PROP_TAG_MUTEX, &news_mutex,
NULL);
ret = prop_ref_inc(p);
if(prop_set_parent(p, root))
prop_destroy(p);
}
}
hts_mutex_unlock(&news_mutex);
return ret;
}
开发者ID:dev-life,项目名称:showtime,代码行数:33,代码来源:notifications.c
示例7: add_header
static void
add_header(prop_courier_t *pc, GtkWidget *parent, prop_t *root)
{
GtkWidget *hbox, *w;
prop_sub_t *s;
hbox = gtk_hbox_new(FALSE, 1);
gtk_box_pack_start(GTK_BOX(parent), hbox, FALSE, TRUE, 0);
/* Artist name */
w = gtk_label_new("");
gtk_misc_set_alignment(GTK_MISC(w), 0, 0);
gtk_label_set_ellipsize(GTK_LABEL(w), PANGO_ELLIPSIZE_END);
gtk_box_pack_start(GTK_BOX(hbox), w, TRUE, TRUE, 0);
s = prop_subscribe(0,
PROP_TAG_NAME("self", "model", "artist_name"),
PROP_TAG_CALLBACK_STRING, gu_subscription_set_label_xl, w,
PROP_TAG_COURIER, pc,
PROP_TAG_NAMED_ROOT, root, "self",
NULL);
gu_unsubscribe_on_destroy(GTK_OBJECT(w), s);
}
开发者ID:Allba,项目名称:showtime,代码行数:27,代码来源:gu_directory_albumcollection.c
示例8: add_albums
static void
add_albums(gu_tab_t *gt, GtkWidget *parent, prop_t *root)
{
GtkWidget *sbox;
albumbrowse_t *ab = calloc(1, sizeof(albumbrowse_t));
ab->gt = gt;
/* Scrolled window */
sbox = gtk_scrolled_window_new(NULL, NULL);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sbox),
GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
gtk_box_pack_start(GTK_BOX(parent), sbox, TRUE, TRUE, 0);
/* vbox for all albums */
ab->vbox = gtk_vbox_new(FALSE, 1);
gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(sbox), ab->vbox);
ab->sub =
prop_subscribe(0,
PROP_TAG_NAME("self", "model", "nodes"),
PROP_TAG_CALLBACK, collection_albums, ab,
PROP_TAG_COURIER, gt->gt_gw->gw_gu->gu_pc,
PROP_TAG_NAMED_ROOT, root, "self",
NULL);
g_signal_connect(sbox, "destroy", G_CALLBACK(ab_destroy), ab);
}
开发者ID:Allba,项目名称:showtime,代码行数:30,代码来源:gu_directory_albumcollection.c
示例9: js_item_onEvent
static JSBool
js_item_onEvent(JSContext *cx, JSObject *obj,
uintN argc, jsval *argv, jsval *rval)
{
js_item_t *ji = JS_GetPrivate(cx, obj);
if(!JS_ObjectIsFunction(cx, JSVAL_TO_OBJECT(argv[1]))) {
JS_ReportError(cx, "Argument is not a function");
return JS_FALSE;
}
if(ji->ji_eventsub == NULL) {
ji->ji_eventsub =
prop_subscribe(PROP_SUB_TRACK_DESTROY,
PROP_TAG_CALLBACK, js_item_eventsub, ji,
PROP_TAG_ROOT, ji->ji_root,
PROP_TAG_COURIER, ji->ji_model->jm_pc,
NULL);
ji->ji_model->jm_subs++;
ji->ji_this = OBJECT_TO_JSVAL(obj);
JS_AddNamedRoot(cx, &ji->ji_this, "item_this");
}
js_event_handler_create(cx, &ji->ji_event_handlers,
JSVAL_IS_STRING(argv[0]) ?
JS_GetStringBytes(JS_ValueToString(cx, argv[0])) :
NULL,
argv[1]);
*rval = JSVAL_VOID;
return JS_TRUE;
}
开发者ID:RedSquirrel87,项目名称:showtime,代码行数:32,代码来源:js_page.c
示例10: backend_prop_make
void
backend_prop_make(prop_t *model, char *url, size_t urllen)
{
proppage_t *pp;
hts_mutex_lock(&pp_mutex);
pp = malloc(sizeof(proppage_t));
pp_tally++;
snprintf(url, urllen, "prop:%d", pp_tally);
pp->pp_url = strdup(url);
pp->pp_model = prop_ref_inc(model);
pp->pp_model_sub =
prop_subscribe(PROP_SUB_TRACK_DESTROY,
PROP_TAG_CALLBACK, pp_cb, pp,
PROP_TAG_MUTEX, &pp_mutex,
PROP_TAG_ROOT, model,
NULL);
LIST_INSERT_HEAD(&proppages, pp, pp_link);
hts_mutex_unlock(&pp_mutex);
}
开发者ID:CrashSerious,项目名称:showtime,代码行数:26,代码来源:backend_prop.c
示例11: bookmarks_init
void
bookmarks_init(void)
{
htsmsg_field_t *f;
htsmsg_t *m, *n, *o;
hts_mutex_init(&bookmark_mutex);
bookmarks = prop_create(settings_add_dir(NULL, "Bookmarks", "bookmark", NULL),
"model");
prop_set_int(prop_create(bookmarks, "mayadd"), 1);
prop_subscribe(0,
PROP_TAG_CALLBACK, bookmarks_callback, NULL,
PROP_TAG_ROOT, prop_create(bookmarks, "nodes"),
PROP_TAG_MUTEX, &bookmark_mutex,
NULL);
if((m = htsmsg_store_load("bookmarks")) != NULL) {
n = htsmsg_get_map(m, "nodes");
HTSMSG_FOREACH(f, n) {
if((o = htsmsg_get_map_by_field(f)) == NULL)
continue;
bookmark_load(o);
}
htsmsg_destroy(m);
}
开发者ID:MatChung,项目名称:showtime,代码行数:29,代码来源:bookmarks.c
示例12: add_news_locked
static prop_t *
add_news_locked(const char *id, const char *message,
const char *location, const char *caption,
const char *action)
{
prop_t *p, *ret = NULL;
prop_t *root = prop_create(prop_get_global(), "news");
if(dismissed_news_out != NULL) {
if(htsmsg_get_u32_or_default(dismissed_news_in, id, 0)) {
dismis_news(id);
} else {
p = prop_create_root(id);
prop_set(p, "message", PROP_SET_STRING, message);
prop_set(p, "id", PROP_SET_STRING, id);
prop_set(p, "location", PROP_SET_STRING, location);
prop_set(p, "caption", PROP_SET_STRING, caption);
prop_set(p, "action", PROP_SET_STRING, action);
prop_subscribe(PROP_SUB_TRACK_DESTROY,
PROP_TAG_CALLBACK, news_sink, prop_ref_inc(p),
PROP_TAG_ROOT, prop_create(p, "eventSink"),
PROP_TAG_MUTEX, &news_mutex,
NULL);
ret = prop_ref_inc(p);
if(prop_set_parent(p, root))
prop_destroy(p);
}
}
return ret;
}
开发者ID:tajmouati,项目名称:showtime,代码行数:33,代码来源:notifications.c
示例13: be_prop_open
static int
be_prop_open(prop_t *page, const char *url)
{
proppage_t *pp;
openpage_t *op;
hts_mutex_lock(&pp_mutex);
LIST_FOREACH(pp, &proppages, pp_link)
if(!strcmp(rstr_get(pp->pp_url), url))
break;
if(pp == NULL) {
hts_mutex_unlock(&pp_mutex);
return 1;
}
op = calloc(1, sizeof(openpage_t));
LIST_INSERT_HEAD(&pp->pp_pages, op, op_link);
op->op_pp = pp;
op->op_root = prop_ref_inc(page);
op->op_page_sub =
prop_subscribe(PROP_SUB_TRACK_DESTROY,
PROP_TAG_CALLBACK, op_cb, op,
PROP_TAG_MUTEX, &pp_mutex,
PROP_TAG_ROOT, page,
NULL);
prop_link(pp->pp_model, prop_create(page, "model"));
hts_mutex_unlock(&pp_mutex);
return 0;
}
开发者ID:Allba,项目名称:showtime,代码行数:33,代码来源:backend_prop.c
示例14: popup_display
event_t *
popup_display(prop_t *p)
{
prop_courier_t *pc = prop_courier_create_waitable();
event_t *e = NULL;
prop_t *r = prop_create(p, "eventSink");
prop_sub_t *s = prop_subscribe(0,
PROP_TAG_CALLBACK, eventsink, &e,
PROP_TAG_ROOT, r,
PROP_TAG_COURIER, pc,
NULL);
/* Will show the popup */
if(prop_set_parent(p, prop_create(prop_get_global(), "popups"))) {
/* popuproot is a zombie, this is an error */
abort();
}
while(e == NULL)
prop_courier_wait_and_dispatch(pc);
prop_unsubscribe(s);
return e;
}
开发者ID:Sinster,项目名称:showtime,代码行数:25,代码来源:notifications.c
示例15: settings_create_bool
setting_t *
settings_create_bool(prop_t *parent, const char *id, prop_t *title,
int initial, htsmsg_t *store,
prop_callback_int_t *cb, void *opaque,
int flags, prop_courier_t *pc,
settings_saver_t *saver, void *saver_opaque)
{
setting_t *s = setting_create_leaf(parent, title, "bool", "value", flags);
prop_sub_t *sub;
s->s_id = strdup(id);
s->s_callback = cb;
s->s_opaque = opaque;
if(store != NULL)
initial = htsmsg_get_u32_or_default(store, id, initial);
prop_set_int(s->s_val, !!initial);
if(flags & SETTINGS_INITIAL_UPDATE)
settings_int_callback(s, !!initial);
sub = prop_subscribe(PROP_SUB_NO_INITIAL_UPDATE,
PROP_TAG_CALLBACK_INT, settings_int_callback, s,
PROP_TAG_ROOT, s->s_val,
PROP_TAG_COURIER, pc,
NULL);
s->s_sub = sub;
s->s_store = store;
s->s_saver = saver;
s->s_saver_opaque = saver_opaque;
return s;
}
开发者ID:Rautz,项目名称:showtime,代码行数:33,代码来源:settings.c
示例16: bind_to_property
static void
bind_to_property(glw_t *w, prop_t *p, const char **pname,
prop_t *view, prop_t *args, prop_t *clone,
prop_t *core)
{
glw_text_bitmap_t *gtb = (void *)w;
gtb_unbind(gtb);
gtb->gtb_sub =
prop_subscribe(PROP_SUB_DIRECT_UPDATE | PROP_SUB_SEND_VALUE_PROP,
PROP_TAG_NAME_VECTOR, pname,
PROP_TAG_CALLBACK, prop_callback, gtb,
PROP_TAG_COURIER, w->glw_root->gr_courier,
PROP_TAG_NAMED_ROOT, p, "self",
PROP_TAG_NAMED_ROOT, view, "view",
PROP_TAG_NAMED_ROOT, args, "args",
PROP_TAG_NAMED_ROOT, clone, "clone",
PROP_TAG_NAMED_ROOT, core, "core",
PROP_TAG_ROOT, w->glw_root->gr_prop_ui,
PROP_TAG_NAMED_ROOT, w->glw_root->gr_prop_nav, "nav",
NULL);
if(w->glw_flags2 & GLW2_AUTOHIDE)
glw_unhide(w);
}
开发者ID:bguerreiro,项目名称:movian,代码行数:25,代码来源:glw_text_bitmap.c
示例17: audio_mastervol_init
void
audio_mastervol_init(void)
{
htsmsg_t *m = htsmsg_store_load("audiomixer");
int32_t i32;
prop_t *prop_audio;
prop_audio = prop_create(prop_get_global(), "audio");
prop_mastervol = prop_create(prop_audio, "mastervolume");
prop_mastermute = prop_create(prop_audio, "mastermute");
prop_set_float_clipping_range(prop_mastervol, -75, 0);
prop_set_int(prop_mastermute, 0);
if(m != NULL && !htsmsg_get_s32(m, "master-volume", &i32))
prop_set_float(prop_mastervol, (float)i32 / 1000);
htsmsg_destroy(m);
prop_subscribe(PROP_SUB_NO_INITIAL_UPDATE,
PROP_TAG_CALLBACK_FLOAT, save_matervol, NULL,
PROP_TAG_ROOT, prop_mastervol,
NULL);
}
开发者ID:Allba,项目名称:showtime,代码行数:25,代码来源:audio.c
示例18: makesub
static jni_subscription_t *
makesub(JNIEnv *env,
prop_callback_t *cb,
jint j_propid,
jstring j_path,
jobject j_cbif)
{
jni_subscription_t *js = malloc(sizeof(jni_subscription_t));
const char *path = (*env)->GetStringUTFChars(env, j_path, 0);
js->js_cbif = (*env)->NewGlobalRef(env, j_cbif);
prop_t *p = j_propid ? (prop_t *)j_propid : prop_get_global();
js->js_id = ++jni_sub_tally;
if(RB_INSERT_SORTED(&jni_subscriptions, js, js_link, js_cmp))
abort();
js->js_sub = prop_subscribe(PROP_SUB_ALT_PATH,
PROP_TAG_NAMESTR, path,
PROP_TAG_CALLBACK, cb, js,
PROP_TAG_ROOT, p,
PROP_TAG_COURIER, jni_courier,
NULL);
(*env)->ReleaseStringUTFChars(env, j_path, path);
return js;
}
开发者ID:Cy-4AH,项目名称:showtime,代码行数:29,代码来源:prop_jni.c
示例19: backend_prop_make
rstr_t *
backend_prop_make(prop_t *model, const char *suggest)
{
proppage_t *pp;
rstr_t *r;
hts_mutex_lock(&pp_mutex);
pp = calloc(1, sizeof(proppage_t));
if(suggest == NULL) {
char url[50];
pp_tally++;
snprintf(url, sizeof(url), "prop:%d", pp_tally);
r = rstr_alloc(url);
} else {
r = rstr_alloc(suggest);
}
pp->pp_url = rstr_dup(r);
pp->pp_model = prop_ref_inc(model);
pp->pp_model_sub =
prop_subscribe(PROP_SUB_TRACK_DESTROY,
PROP_TAG_CALLBACK, pp_cb, pp,
PROP_TAG_MUTEX, &pp_mutex,
PROP_TAG_ROOT, model,
NULL);
LIST_INSERT_HEAD(&proppages, pp, pp_link);
hts_mutex_unlock(&pp_mutex);
return r;
}
开发者ID:Allba,项目名称:showtime,代码行数:32,代码来源:backend_prop.c
示例20: opts_clicked
static void
opts_clicked(GtkToolButton *toolbutton, gpointer user_data)
{
int event_time = gtk_get_current_event_time();
gu_tab_t *gt = user_data;
gtk_ui_t *gu = gt->gt_gw->gw_gu;
dyn_menu_t *dm = calloc(1, sizeof(dyn_menu_t));
dm->dm_menu = gtk_menu_new();
gtk_widget_show_all(dm->dm_menu);
gtk_menu_attach_to_widget(GTK_MENU(dm->dm_menu), GTK_WIDGET(toolbutton), NULL);
gtk_menu_popup(GTK_MENU(dm->dm_menu), NULL, NULL, NULL, NULL,
0, event_time);
gu_cloner_init(&dm->dm_nodes, dm, dyn_menu_item_add, dyn_menu_item_del,
sizeof(dyn_menu_item_t), gu, GU_CLONER_TRACK_POSITION);
dm->dm_node_sub =
prop_subscribe(0,
PROP_TAG_NAME("nav", "currentpage", "model", "options"),
PROP_TAG_CALLBACK, gu_cloner_subscription, &dm->dm_nodes,
PROP_TAG_NAMED_ROOT, gt->gt_nav, "nav",
PROP_TAG_COURIER, gu->gu_pc,
NULL);
g_signal_connect(dm->dm_menu, "destroy", G_CALLBACK(dyn_menu_destroyed), dm);
}
开发者ID:Allba,项目名称:showtime,代码行数:30,代码来源:gu_toolbar.c
注:本文中的prop_subscribe函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论