示例#1
0
Gobby::TabLabel::TabLabel(Folder& folder, SessionView& view,
                          const Glib::ustring& active_icon_name):
	m_folder(folder), m_view(view),
	m_title(view.get_title()), m_changed(false),
	m_active_icon_name(active_icon_name)
{
	set_column_spacing(6);
	m_title.set_halign(Gtk::ALIGN_START);

	update_icon();
	update_color();

	m_icon.show();
	m_title.show();
	m_button.set_halign(Gtk::ALIGN_END);
	m_button.show();

	view.signal_active_user_changed().connect(
		sigc::mem_fun(*this, &TabLabel::on_active_user_changed));

	m_notify_status_handle = g_signal_connect(
		G_OBJECT(view.get_session()), "notify::status",
		G_CALLBACK(on_notify_status_static), this);
	m_notify_subscription_group_handle = g_signal_connect(
		G_OBJECT(view.get_session()),
		"notify::subscription-group",
		G_CALLBACK(on_notify_subscription_group_static), this);

	m_folder.signal_document_changed().connect(
		sigc::mem_fun(*this, &TabLabel::on_folder_document_changed));

	attach(m_icon, 0, 0, 1, 1);
	attach(m_title, 1, 0, 1, 1);
	attach(m_button, 2, 0, 1, 1);
}
示例#2
0
Gobby::TabLabel::TabLabel(Folder& folder, SessionView& view,
                          const Glib::ustring& active_icon_name):
	Gtk::HBox(false, 6), m_folder(folder), m_view(view),
	m_title(view.get_title()), m_changed(false),
	m_active_icon_name(active_icon_name)
{
	m_title.set_alignment(Gtk::ALIGN_START);

	update_icon();
	update_color();

	m_icon.show();
	m_title.show();
	m_extra.show();
	m_button.show();

	view.signal_active_user_changed().connect(
		sigc::mem_fun(*this, &TabLabel::on_active_user_changed));

	m_notify_status_handle = g_signal_connect(
		G_OBJECT(view.get_session()), "notify::status",
		G_CALLBACK(on_notify_status_static), this);
	m_notify_subscription_group_handle = g_signal_connect(
		G_OBJECT(view.get_session()),
		"notify::subscription-group",
		G_CALLBACK(on_notify_subscription_group_static), this);

	m_folder.signal_document_changed().connect(
		sigc::mem_fun(*this, &TabLabel::on_folder_document_changed));

	pack_start(m_icon, Gtk::PACK_SHRINK);
	pack_start(m_title, Gtk::PACK_SHRINK);
	pack_start(m_extra, Gtk::PACK_EXPAND_WIDGET);
	pack_end(m_button, Gtk::PACK_SHRINK);
}
void
Gobby::SynchronizationCommands::on_document_removed(SessionView& view)
{
	InfSession* session = view.get_session();
	SyncMap::iterator iter = m_sync_map.find(session);
	if(iter != m_sync_map.end())
	{
		delete iter->second;
		m_sync_map.erase(iter);
	}
}
void
Gobby::SynchronizationCommands::on_document_added(SessionView& view)
{
	InfSession* session = view.get_session();
	if(inf_session_get_status(session) == INF_SESSION_SYNCHRONIZING)
	{
		InfXmlConnection* connection;
		g_object_get(G_OBJECT(session),
		             "sync-connection", &connection, NULL);
		gdouble percentage = inf_session_get_synchronization_progress(
			session, connection);
		g_object_unref(connection);

		g_assert(m_sync_map.find(session) == m_sync_map.end());
		m_sync_map[session] = new SyncInfo(*this, view);
		set_progress_text(view, percentage);
	}
}