Beispiel #1
0
void GioLister::Init() {
  monitor_.reset_without_add(g_volume_monitor_get());

  // Get existing volumes
  GList* const volumes = g_volume_monitor_get_volumes(monitor_);
  for (GList* p=volumes; p; p=p->next) {
    GVolume* volume = static_cast<GVolume*>(p->data);

    VolumeAdded(volume);
    g_object_unref(volume);
  }
  g_list_free(volumes);

  // Get existing mounts
  GList* const mounts = g_volume_monitor_get_mounts(monitor_);
  for (GList* p=mounts; p; p=p->next) {
    GMount* mount = static_cast<GMount*>(p->data);

    MountAdded(mount);
    g_object_unref(mount);
  }
  g_list_free(mounts);

  // Connect signals from the monitor
  CHECKED_GCONNECT(monitor_, "volume-added", &VolumeAddedCallback, this);
  CHECKED_GCONNECT(monitor_, "volume-removed", &VolumeRemovedCallback, this);
  CHECKED_GCONNECT(monitor_, "mount-added", &MountAddedCallback, this);
  CHECKED_GCONNECT(monitor_, "mount-changed", &MountChangedCallback, this);
  CHECKED_GCONNECT(monitor_, "mount-removed", &MountRemovedCallback, this);
}
void YsShellExt::SearchTable::Attach(const YsShellExt *shl)
{
	CleanUp();
	this->shl=shl;

	YsShellExt::ConstEdgeHandle ceHd=NULL;
	while(YSOK==shl->MoveToNextConstEdge(ceHd))
	{
		ConstEdgeAdded(ceHd);
	}

	plKeyToFgHd.Resize(1+shl->GetNumPolygon()/4);
	YsShellExt::FaceGroupHandle fgHd=NULL;
	while(YSOK==shl->MoveToNextFaceGroup(fgHd))
	{
		FaceGroupAdded(fgHd);
	}

	YsShellExt::VolumeHandle vlHd=NULL;
	while(YSOK==shl->MoveToNextVolume(vlHd))
	{
		VolumeAdded(vlHd);
	}
}