Beispiel #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;
    });
}
std::string StringUtils::dateToString(const Glib::DateTime& date){
	/* Recibe una fecha y hora tipo Glib::DateTime y devuelve una cadena formateada "dd/mm/aa-hh:mm" */
	std::stringstream s;
	std::string ss;
	s << date.format("%d/%m/%Y-%H:%M");
	s >> ss;
	return ss;
}
Beispiel #3
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()
                                });
}