static void apply_config(void) { char buff[1024]; if (show_title) { Epplet_gadget_move(in_label, 3, 13); Epplet_gadget_move(out_label, 3, 30); Epplet_gadget_move(in_bar, 3, 22); Epplet_gadget_move(out_bar, 3, 39); Epplet_gadget_show(title); } else { Epplet_gadget_move(in_label, 4, 4); Epplet_gadget_move(out_label, 4, 24); Epplet_gadget_move(in_bar, 4, 14); Epplet_gadget_move(out_bar, 4, 36); Epplet_gadget_hide(title); } Epplet_modify_config("title", (show_title ? "1" : "0")); strcpy(buff, NONULL(Epplet_textbox_contents(cfg_tb_dev))); if (strcmp(buff, device_string)) { Epplet_modify_config("dev", buff); device_string = Epplet_query_config("dev"); last_in = last_out = 0; } timer_cb(NULL); }
int main(int argc, char **argv) { int prio; atexit(Epplet_cleanup); prio = getpriority(PRIO_PROCESS, getpid()); setpriority(PRIO_PROCESS, getpid(), prio + 10); Epplet_Init("E-Sys", "0.1", "Enlightenment Uptime Epplet", 3, 3, argc, argv, 0); close_button = Epplet_create_button(NULL, NULL, 34, 2, 0, 0, "CLOSE", 0, NULL, close_cb, NULL); label1 = Epplet_create_label(4, 4, "Uptime", 1); label2 = Epplet_create_label(4, 16, "", 1); label3 = Epplet_create_label(4, 26, "", 1); label4 = Epplet_create_label(4, 36, "", 1); Epplet_gadget_show(label1); Epplet_gadget_show(label2); Epplet_gadget_show(label3); Epplet_gadget_show(label4); Epplet_show(); Epplet_register_focus_in_handler(in_cb, NULL); Epplet_register_focus_out_handler(out_cb, NULL); timer_cb(NULL); /* Set everything up */ Epplet_Loop(); return 0; }
/* Update the event timer after curl_multi library calls */ int multi_timer_cb(CURLM *multi, long timeout_ms, Context* c) { TRACE("multi_timer_cb"); /* cancel running timer */ c->timer_.cancel(); #ifndef NDEBUG // For some reason, libcurl often calls this function with a timeout of 1 millsecond. // When this happens, we set the timer and wait like normal, but every call to the timer // callback gets boost::asio::error::operation_aborted. Shouldn't at least one call // be a success?! Is this a bug in asio? if (timeout_ms == 1) TRACE_MSG("*****timount_ms == 1*****"); #endif if ( timeout_ms > 1 ) { TRACE_MSG("updating timer to expire in " << timeout_ms << " milliseconds"); /* update timer */ c->timer_.expires_from_now(boost::posix_time::millisec(timeout_ms)); c->timer_.async_wait(c->strand_.wrap(boost::bind(&timer_cb, _1, c))); } else { TRACE_MSG("call timeout"); /* call timeout function immediately */ boost::system::error_code error; /*success*/ timer_cb(error, c); } return 0; }
int main(int argc, char **argv) { atexit(Epplet_cleanup); Epplet_Init("E-LoadMeter", "0.1", "Enlightenment CPU Load Epplet", 3, 3, argc, argv, 0); close_button = Epplet_create_std_button("CLOSE", 2, 2, close_cb, NULL); Epplet_gadget_show(Epplet_create_label(4, 4, "CPU Load", 1)); Epplet_gadget_show(label1 = Epplet_create_label(3, 15, "", 1)); Epplet_gadget_show(label2 = Epplet_create_label(3, 26, "", 1)); Epplet_gadget_show(label3 = Epplet_create_label(3, 36, "", 1)); Epplet_gadget_show(vbar1 = Epplet_create_vbar(31, 15, 5, 30, 1, &one)); Epplet_gadget_show(vbar2 = Epplet_create_vbar(36, 15, 5, 30, 1, &five)); Epplet_gadget_show(vbar3 = Epplet_create_vbar(41, 15, 5, 30, 1, &fifteen)); Epplet_register_focus_in_handler(in_cb, NULL); Epplet_register_focus_out_handler(out_cb, NULL); Epplet_register_delete_event_handler(delete_cb, NULL); Epplet_show(); timer_cb(NULL); Epplet_Loop(); return 0; }
int main(int argc, char **argv) { atexit(Epplet_cleanup); Epplet_Init("E-Time", "0.1", "Enlightenment Digital Clock Epplet", 3, 3, argc, argv, 0); Epplet_load_config(); parse_config(); close_button = Epplet_create_std_button("CLOSE", 2, 2, close_cb, NULL); cfg_button = Epplet_create_std_button("CONFIGURE", 33, 2, config_cb, NULL); Epplet_gadget_show(label1 = Epplet_create_label(4 * just, 4, "", 1)); Epplet_gadget_show(label2 = Epplet_create_label(4 * just, 15, "", 1)); Epplet_gadget_show(label3 = Epplet_create_label(4 * just, 26, "", 1)); Epplet_gadget_show(label4 = Epplet_create_label(4 * just, 36, "", 1)); Epplet_register_focus_in_handler(in_cb, NULL); Epplet_register_focus_out_handler(out_cb, NULL); Epplet_register_delete_event_handler(delete_cb, NULL); Epplet_show(); timer_cb(NULL); Epplet_Loop(); return 0; }
static void timer_check(void) { if (timer_time > 0 && time(NULL) >= timer_time) { timer_time = 0; timer_cb(timer_ptr); } }
/* Update the event timer after curl_multi library calls */ static int multi_timer_cb(CURLM *multi, long timeout_ms, GlobalInfo *g) { DPRINT("%s %li\n", __PRETTY_FUNCTION__, timeout_ms); ev_timer_stop(g->loop, &g->timer_event); if (timeout_ms > 0) { double t = timeout_ms / 1000; ev_timer_init(&g->timer_event, timer_cb, t, 0.); ev_timer_start(g->loop, &g->timer_event); }else timer_cb(g->loop, &g->timer_event, 0); return 0; }
/* Update the event timer after curl_multi library calls */ static int multi_timer_cb(CURLM *multi, long timeout_ms) { g_debug("%s %li", __PRETTY_FUNCTION__, timeout_ms); ev_timer_stop(g_dionaea->loop, &curl_runtime.timer_event); if( timeout_ms > 0 ) { double t = timeout_ms / 1000; ev_timer_init(&curl_runtime.timer_event, timer_cb, t, 0.); ev_timer_start(g_dionaea->loop, &curl_runtime.timer_event); } else timer_cb(g_dionaea->loop, &curl_runtime.timer_event, 0); return 0; }
int main(int argc, char **argv) { int prio; prio = getpriority(PRIO_PROCESS, getpid()); setpriority(PRIO_PROCESS, getpid(), prio + 10); atexit(Epplet_cleanup); Epplet_Init("E-Bandwidth", "0.2", "Enlightenment Network I/O Monitor Epplet", 3, 3, argc, argv, 0); Epplet_load_config(); parse_conf(); title = Epplet_create_label(3, 3, "Net I/O", 1); if (show_title) { /* New arrangement */ in_label = Epplet_create_label(3, 13, "I: 0 b/s", 1); out_label = Epplet_create_label(3, 30, "O: 0 b/s", 1); in_bar = Epplet_create_hbar(3, 22, 42, 7, 0, &in_val); out_bar = Epplet_create_hbar(3, 39, 42, 7, 0, &out_val); Epplet_gadget_show(title); } else { /* Old arrangement */ in_label = Epplet_create_label(4, 4, "I: 0 b/s", 1); out_label = Epplet_create_label(4, 24, "O: 0 b/s", 1); in_bar = Epplet_create_hbar(4, 14, 40, 8, 0, &in_val); out_bar = Epplet_create_hbar(4, 36, 40, 8, 0, &out_val); } close_button = Epplet_create_button(NULL, NULL, 2, 2, 0, 0, "CLOSE", 0, NULL, close_cb, NULL); cfg_button = Epplet_create_button(NULL, NULL, 33, 2, 0, 0, "CONFIGURE", 0, NULL, config_cb, NULL); Epplet_gadget_show(in_label); Epplet_gadget_show(in_bar); Epplet_gadget_show(out_label); Epplet_gadget_show(out_bar); Epplet_show(); Epplet_register_focus_in_handler(in_cb, NULL); Epplet_register_focus_out_handler(out_cb, NULL); timer_cb(NULL); /* Set everything up */ Epplet_Loop(); return 0; }
/* Update the event timer after curl_multi library calls */ int http_client::multi_timer_cb(CURLM* multi, long timeout_ms) { BOOST_LOG_TRIVIAL(trace) << this << ", " << BOOST_CURRENT_FUNCTION << ", timeout_ms: " << timeout_ms; /* cancel running timer */ _timer.cancel(); if(timeout_ms > 0) { _timer.expires_from_now(boost::chrono::milliseconds(timeout_ms)); _timer.async_wait(boost::bind(&http_client::timer_cb, this, _1)); } else { /* call timeout function immediately */ boost::system::error_code error; /*success*/ timer_cb(error); } return 0; }
/* Update the event timer after curl_multi library calls */ static int multi_timer_cb(CURLM *multi, long timeout_ms, GlobalInfo *g) { std::cout << std::endl << __PRETTY_FUNCTION__ << " called" << std::endl; fprintf(MSG_OUT, "\nmulti_timer_cb: timeout_ms %ld", timeout_ms); /* cancel running timer */ timer.cancel(); if (timeout_ms > 0) { /* update timer */ timer.expires_from_now(boost::posix_time::millisec(timeout_ms)); timer.async_wait(boost::bind(&timer_cb, _1, g)); } else { /* call timeout function immediately */ boost::system::error_code error; /*success*/ timer_cb(error, g); } return 0; }
static void apply_config(void) { char buff[1024]; int tmp; tmp = (cfg_just ? -1 : 1); if (just != tmp) { just = tmp; Epplet_gadget_move(label1, 4 * just, 4); Epplet_gadget_move(label2, 4 * just, 15); Epplet_gadget_move(label3, 4 * just, 26); Epplet_gadget_move(label4, 4 * just, 36); Esnprintf(buff, sizeof(buff), "%d", just); Epplet_modify_config("just", buff); } strcpy(buff, NONULL(Epplet_textbox_contents(cfg_tb_line1))); Epplet_modify_config("line1", buff); line1 = Epplet_query_config("line1"); strcpy(buff, NONULL(Epplet_textbox_contents(cfg_tb_line2))); Epplet_modify_config("line2", buff); line2 = Epplet_query_config("line2"); strcpy(buff, NONULL(Epplet_textbox_contents(cfg_tb_line3))); Epplet_modify_config("line3", buff); line3 = Epplet_query_config("line3"); strcpy(buff, NONULL(Epplet_textbox_contents(cfg_tb_line4))); Epplet_modify_config("line4", buff); line4 = Epplet_query_config("line4"); strcpy(buff, NONULL(Epplet_textbox_contents(cfg_tb_tz))); Epplet_modify_config("timezone", buff); timezone_str = Epplet_query_config("timezone"); timer_cb(NULL); }