Exemplo n.º 1
0
OSStatus
CSecondPage::StopBrowse()
{
	OSStatus err;

	err = StopOperation( m_pdlBrowser );
	require_noerr( err, exit );

	err = StopOperation( m_lprBrowser );
	require_noerr( err, exit );

	err = StopOperation( m_ippBrowser );
	require_noerr( err, exit );

	while ( m_printers.size() > 0 )
	{
		Printer * printer = m_printers.front();

		m_printers.pop_front();

		if ( printer->resolving )
		{
			StopResolve( printer );
		}

		delete printer;
	}

exit:

	return err;
}
Exemplo n.º 2
0
void	ExplorerBarWindow::OnDestroy( void ) 
{
	// Stop any resolves that may still be pending (shouldn't be any).
	
	StopResolve();
	
	// Clean up the extant browses
	while (m_serviceRefs.size() > 0)
	{
		//
		// take the head of the list
		//
		DNSServiceRef ref = m_serviceRefs.front();

		//
		// Stop will remove it from the list
		//
		Stop( ref );
	}

	// Clean up the service handlers.
	
	int		i;
	int		n;
	
	n = (int) mServiceHandlers.GetSize();
	for( i = 0; i < n; ++i )
	{
		delete mServiceHandlers[ i ];
	}
	
	CWnd::OnDestroy();
}
Exemplo n.º 3
0
OSStatus
CSecondPage::StopResolve(Printer * printer)
{
	OSStatus err = kNoErr;

	check( printer );

	Services::iterator it;

	for ( it = printer->services.begin(); it != printer->services.end(); it++ )
	{
		if ( (*it)->serviceRef )
		{
			err = StopResolve( *it );
			require_noerr( err, exit );
		}
	}

exit:

	return err;
}
Exemplo n.º 4
0
OSStatus
CPrinterSetupWizardSheet::OnRemoveService( Service * service )
{
	OSStatus err = kNoErr;

	if ( service && ( --service->refs == 0 ) )
	{
		if ( service->serviceRef != NULL )
		{
			err = StopResolve( service );
			require_noerr( err, exit );
		}

		service->printer->services.remove( service );

		delete service;
	}

exit:

	return err;	
}
Exemplo n.º 5
0
OSStatus	ExplorerBarWindow::StartResolve( ServiceInfo *inService )
{
	OSStatus		err;
	
	check( inService );
	
	// Stop any current resolve that may be in progress.
	
	StopResolve();
	
	// Resolve the service.
	err = DNSServiceResolve( &mResolveServiceRef, 0, 0, 
		inService->name, inService->type, inService->domain, (DNSServiceResolveReply) ResolveCallBack, inService->handler );
	require_noerr( err, exit );

	err = WSAAsyncSelect((SOCKET) DNSServiceRefSockFD(mResolveServiceRef), m_hWnd, WM_PRIVATE_SERVICE_EVENT, FD_READ|FD_CLOSE);
	require_noerr( err, exit );
	
	m_serviceRefs.push_back(mResolveServiceRef);

exit:
	return( err );
}
Exemplo n.º 6
0
OSStatus
CSecondPage::OnRemovePrinter(
				const char *	inName,	
				const char *	inType,	
				const char *	inDomain,
				bool			moreComing)
{
	DEBUG_UNUSED( inDomain );
	DEBUG_UNUSED( inType );

	Printer	*	printer;
	OSStatus	err = kNoErr;

	check( IsWindow( m_hWnd ) );

	m_browseList.SetRedraw(FALSE);

	printer = Lookup( inName );

	if ( printer )
	{
		Service * service;

		service = printer->LookupService( inType );

		if ( service && ( --service->refs == 0 ) )
		{
			if ( service->serviceRef != NULL )
			{
				err = StopResolve( service );
				require_noerr( err, exit );
			}

			printer->services.remove( service );

			delete service;
		}

		if ( printer->services.size() == 0 )
		{
			//
			// check to make sure if we're the only item in the control...i.e.
			// the list size is 1.
			//
			if (m_browseList.GetCount() > 1)
			{
				//
				// if we're not the only thing in the list, then
				// simply remove it from the list
				//
				m_browseList.DeleteItem( printer->item );
			}
			else
			{
				//
				// if we're the only thing in the list, then redisplay
				// it with the no rendezvous printers message
				//
				InitBrowseList();
			}

			m_printers.remove( printer );

			if ( m_selected == printer )
			{
				m_selected		= NULL;
				m_selectedName	= "";
			}

			delete printer;
		}
	}

exit:

	if (!moreComing)
	{
		m_browseList.SetRedraw(TRUE);
		m_browseList.Invalidate();
	}

	return err;
}