예제 #1
0
chat_action::chat_action(Glib::PropertyProxy_ReadOnly<Glib::ustring> name,
                           Glib::DateTime time,
                           const Glib::ustring& text):
    m_label(name, time.to_local(), text) {
    utils::debug::scope_log log(DBG_LVL_1("gtox"), {
                                    name.get_value().raw(),
                                    time.format("%c").raw(),
                                    text.raw()
                                });
    m_username.show();
    m_username.get_style_context()->add_class("gtox-action-username");
    m_username.property_valign() = Gtk::ALIGN_START;

    m_username_binding = Glib::Binding::bind_property(
                             name,
                             m_username.property_label(),
                             Glib::BINDING_DEFAULT | Glib::BINDING_SYNC_CREATE);

    show();
    add(m_hbox);
    m_hbox.show();
    m_hbox.add(m_username);
    m_hbox.add(m_label);
    property_reveal_child() = false;
    m_dispatcher.emit([this]() {
        utils::debug::scope_log log(DBG_LVL_1("gtox"), {});
        property_reveal_child() = true;
    });
}
예제 #2
0
파일: arith_test.cpp 프로젝트: rmsk2/rmsk2
unsigned int rotor_machine_proxy::encdec_processor(tlv_entry& params, tlv_stream *out_stream, bool do_enc)
{
    unsigned int result = ERR_OK;
    string data_to_process;
    tlv_entry data_out;
    Glib::ustring out;

    // Has param the proper type?
    if (params.tag != TAG_STRING)
    {
        result = out_stream->write_error_tlv(ERR_SYNTAX_INPUT);
    }
    else
    {
        Glib::ustring in((char *)params.value.c_str());
                   
        if (do_enc)
        {
            machine->get_keyboard()->symbols_typed_encrypt(in, out);
        }
        else
        {
            machine->get_keyboard()->symbols_typed_decrypt(in, out);
        }
        
        data_out.to_string(out.raw());
        // Tell client about processing result and write end of result stream marker.            
        result = out_stream->write_success_tlv(data_out);        
    }
    
    return result;

}
예제 #3
0
bool KeysStoreDialog::onInputValidation(const Glib::ustring key, Glib::ustring& message) {
	const static boost::regex e("([\\da-fA-F][\\da-fA-F]:){5}[\\da-fA-F][\\da-fA-F]");

	if(key == "") {
		message = "Input field is empty.";
		return false;
	}

	if(!boost::regex_match(key.raw(), e)) {
		message = "Input text do not match to the key pattern.";
		return false;
	}

	// Check if key is already in listStore
	Glib::RefPtr<Gtk::TreeModel> model = treeView->get_model();
	Glib::RefPtr<Gtk::ListStore> listStore = Glib::RefPtr<Gtk::ListStore>::cast_static(model);

	for(Gtk::TreeModel::iterator iter = model->children().begin(); iter != model->children().end(); iter++) {
		Gtk::TreeModel::Row row = *iter;

		Glib::ustring text;
		row.get_value<Glib::ustring>(0, text);

		if(text == key) {
			message = "Key is already on the list.";
			return false;
		}
	}

	return true;
}
예제 #4
0
/** \brief A quick function to print out a standard start of extension
           errors in the log.
    \param reason  A string explaining why this failed

    Real simple, just put everything into \c error_file.
*/
void
Extension::printFailure (Glib::ustring reason)
{
    error_file << _("Extension \"") << name << _("\" failed to load because ");
    error_file << reason.raw();
    error_file << std::endl;
    return;
}
예제 #5
0
void OpenPackageBox::onRemoveCallBack(const Gtk::TreeModel::iterator& it)
{
    const Gtk::TreeModel::Row row = *it;

    if (row) {
        Glib::ustring package = row[mColumns.mName];
        utils::Package::package().removePackage(package.raw());
    }
}
예제 #6
0
static bool getDouble(Glib::ustring &str, double *val)
{
    const char *begin = str.raw().c_str();
    char *end;
    double ival = strtod(begin, &end);
    if (str == end)
        return false;
    *val = ival;
    return true;
}
예제 #7
0
static bool getULong(Glib::ustring &str, unsigned long *val)
{
    const char *begin = str.raw().c_str();
    char *end;
    unsigned long ival = strtoul(begin, &end, 10);
    if (str == end)
        return false;
    *val = ival;
    return true;
}
예제 #8
0
파일: timeentry.cpp 프로젝트: ehelms/sunray
bool TimeEntry::isValidTime ( Glib::ustring text )
{
	std::string str(text.raw());

	// make sure we only have digits
	if ( str.find_first_not_of("0123456789") != std::string::npos ) {
		return false;
	}

	return true;
}
예제 #9
0
chat_action::label::label(Glib::PropertyProxy_ReadOnly<Glib::ustring> name,
                           Glib::DateTime time,
                           const Glib::ustring& message):
    widget::label(message),
    m_name(name),
    m_time(time) {
    utils::debug::scope_log log(DBG_LVL_1("gtox"), {
                                    name.get_value().raw(),
                                    time.format("%c").raw(),
                                    message.raw()
                                });
}
예제 #10
0
void ViCommandMode::add_history(const Glib::ustring &cmd)
{
    if (!m_history.empty())
        m_history.pop_front();
    m_history.push_front( cmd.raw() );
    m_history.push_front( "BOGUS" );    // Hack - the front entry is never shown

    if (m_history.size() >= 50)         // TODO: add config option
    {
        m_history.pop_back();
    }

}
예제 #11
0
void SDLConfig::on_option_changed()
{
    Gtk::TreeModel::iterator treeIT = _option_selection->get_selected();
    if (!treeIT)
        return;

    Gtk::TreeModel::Row row = *(treeIT);
    Glib::ustring name = row[_columns.col_name];

    if (name == _cur_name)
        return;
    _cur_name = name;

    Glib::ustring value = row[_columns.col_value];
    _lblOptName->set_text(name);
    ConfigOption opt = _options[name.raw()];

    if (!_opt_menu)
        _opt_menu = Gtk::manage(new Gtk::Menu());

    MenuList items = _opt_menu->items();
    items.erase(items.begin(), items.end());

    _cur_index = -1;
    int i = 0;
    for (StringVector::iterator it = opt.possibleValues.begin(); 
            it != opt.possibleValues.end(); it++)
    {
        if ((*it) == value.raw())
            _cur_index = i;
        else
            i++;

        items.push_back(MenuElem((*it)));
    }

    _optOptValues->set_menu(*_opt_menu);
    _optOptValues->set_history(_cur_index);
}
예제 #12
0
std::vector<std::string> KeysStoreDialog::prepareModel() {
	this->model.clear();

	// Check if key is already in listStore
	Glib::RefPtr<Gtk::TreeModel> model = treeView->get_model();
	Glib::RefPtr<Gtk::ListStore> listStore = Glib::RefPtr<Gtk::ListStore>::cast_static(model);

	for(Gtk::TreeModel::iterator iter = model->children().begin(); iter != model->children().end(); iter++) {
		Gtk::TreeModel::Row row = *iter;

		Glib::ustring text;
		row.get_value<Glib::ustring>(0, text);

		this->model.push_back(text.raw());
	}

	return this->model;
}
예제 #13
0
bool tiny_string::operator!=(const Glib::ustring& u) const
{
	return *this != u.raw();
}
예제 #14
0
static void InsertUText(TextRenderer* rndr, const Glib::ustring& insert_str)
{
    rndr->InsertText(insert_str.raw());
}