/*************************************************
* Description: Saves the settings
* Author: Rick Caudill
* Date: Thu Mar 18 20:17:32 2004
**************************************************/
void WallpaperChangerSettings::SaveSettings()
{
	ListViewStringRow* pcRow = (ListViewStringRow*)pcDirectoryList->GetRow(pcDirectoryList->GetLastSelected());
	Message* pcMessage = new Message(M_PREFS_SEND_TO_PARENT);
	bRandom = pcRandom->GetValue().AsBool();				
	pcMessage->AddBool("random",bRandom);
	pcMessage->AddInt32("time",pcTimeDrop->GetSelection());
	pcMessage->AddString("currentimage",pcRow->GetString(0));	
	pcParentLooper->PostMessage(pcMessage,pcParentView);
}
Exemple #2
0
int Window::Register()
{
    Message *msg = new Message(REGISTER);

    msg->AddString( "_type", "window" );
    msg->AddInt( "_port", Port() );
    msg->AddString( "_title", m_title );
    msg->AddRect( "_rect", Frame() );
    msg->AddBool( "_visible", false );
    msg->AddInt( "_flags", m_flags );


    Message *reply = Messenger::SendReceiveMessage( "gui_server", 0, msg );
    if ( reply == NULL )
    {
        delete msg;
        return -1;
    }
    delete msg;

    if ( reply->rc() != 0 )
    {
        delete reply;
        return -1;
    }

    // Good reply.. let's get the information.

    int bad = 0;

    if ( reply->FindInt( "_id", &m_wid ) != 0 ) bad = -1;
    if ( reply->FindInt( "_sid", &m_sid ) != 0 ) bad = -1;
    if ( reply->FindInt( "_did", &m_did ) != 0 ) bad = -1;
    if ( reply->FindRect( "_rect", &m_frame ) != 0 ) bad = -1;

    delete reply;


    // Accept the GUI memory and everything.

    int tmp_pages;
    unsigned int tmp_flags;

    if ( smk_request_shmem( m_sid, (void**)&m_buffer, &tmp_pages, &tmp_flags ) != 0 )
        bad = -1;

    // We now have our GUI buffer, size and ID.

    if ( bad != 0 ) return -1;

    // Registered with desktop port =  m_did

    return 0;
}