Ejemplo n.º 1
0
void Gobby::TextTabLabel::update_dots()
{
	if (m_changed_by.empty())
	{
		m_dots.hide();
	}
	else
	{
		Glib::ustring markup;
		for(UserWatcherList::iterator iter = m_changed_by.begin();
		    iter != m_changed_by.end(); ++iter)
		{
			double hue = inf_text_user_get_hue(iter->get_user());

			Gdk::Color c;
			c.set_hsv(360.0 * hue, 0.6, 0.6);

			// We are using the C API here since
			// gdk_color_to_string is available since GTK 2.12,
			// but Gdk::Color::to_string only since gtkmm 2.14,
			// and we want to require nothing more recent than
			// 2.12 for now. See also bug #447.
			gchar* color_str = gdk_color_to_string(c.gobj());
			Glib::ustring cpp_color_str(color_str);
			g_free(color_str);

			markup += "<span color=\"" + cpp_color_str + "\">" +
			          m_dot_char + "</span>";
		}
		m_dots.set_markup(markup);
		m_dots.show();
	}
}
Ejemplo n.º 2
0
void Gobby::HueButton::set_hue(double hue)
{
	Gdk::Color color;
	color.set_hsv(hue * 360.0, m_saturation, m_value);
	set_color(color);
}