static void save_yourself_done_callback (SmsConn conn, SmPointer manager_data, Bool success) { GsmXSMPClient *client = manager_data; g_debug ("GsmXSMPClient: Client '%s' received SaveYourselfDone(success = %s)", client->priv->description, success ? "True" : "False"); if (client->priv->current_save_yourself != -1) { SmsSaveComplete (client->priv->conn); client->priv->current_save_yourself = -1; } /* If success is false then the application couldn't save data. Nothing * the session manager can do about, though. FIXME: we could display a * dialog about this, I guess. */ gsm_client_end_session_response (GSM_CLIENT (client), TRUE, FALSE, FALSE, NULL); if (client->priv->next_save_yourself) { int save_type = client->priv->next_save_yourself; gboolean allow_interact = client->priv->next_save_yourself_allow_interact; client->priv->next_save_yourself = -1; client->priv->next_save_yourself_allow_interact = -1; do_save_yourself (client, save_type, allow_interact); } }
void KSMServer::completeShutdownOrCheckpoint() { if ( state != Shutdown && state != Checkpoint ) return; for ( KSMClient* c = clients.first(); c; c = clients.next() ) { if ( !c->saveYourselfDone && !c->waitForPhase2 ) return; // not done yet } // do phase 2 bool waitForPhase2 = false; for ( KSMClient* c = clients.first(); c; c = clients.next() ) { if ( !c->saveYourselfDone && c->waitForPhase2 ) { c->waitForPhase2 = false; SmsSaveYourselfPhase2( c->connection() ); waitForPhase2 = true; } } if ( waitForPhase2 ) return; if ( saveSession ) storeSession(); else discardSession(); if ( state == Shutdown ) { bool waitForKNotify = true; if( !kapp->dcopClient()->connectDCOPSignal( "knotify", "", "notifySignal(QString,QString,QString,QString,QString,int,int,int,int)", "ksmserver", "notifySlot(QString,QString,QString,QString,QString,int,int,int,int)", false )) { waitForKNotify = false; } if( !kapp->dcopClient()->connectDCOPSignal( "knotify", "", "playingFinished(int,int)", "ksmserver", "logoutSoundFinished(int,int)", false )) { waitForKNotify = false; } // event() can return -1 if KNotifyClient short-circuits and avoids KNotify logoutSoundEvent = KNotifyClient::event( 0, "exitkde" ); // KDE says good bye if( logoutSoundEvent <= 0 ) waitForKNotify = false; if( waitForKNotify ) { state = WaitingForKNotify; knotifyTimeoutTimer.start( 20000, true ); return; } startKilling(); } else if ( state == Checkpoint ) { for ( KSMClient* c = clients.first(); c; c = clients.next() ) { SmsSaveComplete( c->connection()); } state = Idle; } }
void KSMClient::registerClient( const char* previousId ) { id = previousId; if ( !id ) id = safeSmsGenerateClientID( smsConn ); SmsRegisterClientReply( smsConn, (char*) id ); SmsSaveYourself( smsConn, SmSaveLocal, false, SmInteractStyleNone, false ); SmsSaveComplete( smsConn ); KSMServer::self()->clientRegistered( previousId ); }
static void SaveYourselfDoneProc(SmsConn smsConn, SmPointer managerData, Bool success) { ClientRec *client = (ClientRec *) managerData; if (verbose) { printf("Client Id = %s, received SAVE YOURSELF DONE [Success = %s]\n", client->clientId, success ? "True" : "False"); } if (!ListSearchAndFreeOne (WaitForSaveDoneList, (char *) client)) { if (ListSearchAndFreeOne (InitialSaveList, (char *) client)) SmsSaveComplete (client->smsConn); return; } if (!success) { ListAddLast (FailedSaveList, (char *) client); } if (ListCount (WaitForSaveDoneList) == 0) { if (ListCount (FailedSaveList) > 0 && !checkpoint_from_signal) PopupBadSave (); else FinishUpSave (); } else if (ListCount (WaitForInteractList) > 0 && OkToEnterInteractPhase ()) { LetClientInteract (ListFirst (WaitForInteractList)); } else if (ListCount (WaitForPhase2List) > 0 && OkToEnterPhase2 ()) { StartPhase2 (); } }
void KSMSaveYourselfRequestProc ( SmsConn smsConn , SmPointer /* managerData */, int saveType, Bool shutdown, int interactStyle, Bool fast, Bool global ) { if ( shutdown ) { the_server->shutdown( fast ? KWorkSpace::ShutdownConfirmNo : KWorkSpace::ShutdownConfirmDefault, KWorkSpace::ShutdownTypeDefault, KWorkSpace::ShutdownModeDefault ); } else if ( !global ) { SmsSaveYourself( smsConn, saveType, false, interactStyle, fast ); SmsSaveComplete( smsConn ); } // else checkpoint only, ksmserver does not yet support this // mode. Will come for KDE 3.1 }