gboolean sw_is_online (void) { online_init (); return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)); }
gboolean sw_is_online (void) { if (!online_init ()) return TRUE; return current_state; }
// Init BSP-core int core_init() { if (!core_settings.initialized) { init_core_setting(); } if (core_settings.is_daemonize) { proc_daemonize(); } fd_init(0); log_init(); load_runtime_setting(); status_op_core(STATUS_OP_INSTANCE_ID, (size_t) core_settings.instance_id); thread_init(); save_pid(); signal_init(); socket_init(); memdb_init(); online_init(); // Load modules BSP_VALUE *val = object_get_hash_str(runtime_settings, "modules"); BSP_OBJECT *vobj = value_get_object(val); BSP_STRING *vstr = NULL; if (vobj && OBJECT_TYPE_ARRAY == vobj->type) { size_t varr_size = object_size(vobj), i; if (varr_size > MAX_MODULES) { varr_size = MAX_MODULES; } reset_object(vobj); for (i = 0; i < varr_size; i ++) { val = object_get_array(vobj, i); vstr = value_get_string(val); if (vstr) { script_load_module(vstr, 1); } } } return BSP_RTN_SUCCESS; }
void sw_online_add_notify (SwOnlineNotify callback, gpointer user_data) { ListenerData *data; if (!online_init ()) return; data = g_slice_new (ListenerData); data->callback = callback; data->user_data = user_data; listeners = g_list_prepend (listeners, data); }
gboolean sw_is_online (void) { NMState state = NM_STATE_UNKNOWN; if (!online_init ()) return TRUE; g_object_get (G_OBJECT (client), NM_CLIENT_STATE, &state, NULL); switch (state) { case NM_STATE_CONNECTED: return TRUE; case NM_STATE_CONNECTING: case NM_STATE_ASLEEP: case NM_STATE_DISCONNECTED: case NM_STATE_UNKNOWN: default: return FALSE; } }