void Process_Quit( void ) { extern int ttMark; extern int tt_tmpfile_fd; DialogFlag = QUIT; if (Dirty) DoQueryDialog( GETSTR(16,16, "The current icon has not been saved.\nYour changes will be lost.") ); else { #ifdef __TOOLTALK edit_notifier(NULL, 0, 1); ttdt_session_quit( 0, 0, 1 ); ttdt_close( 0, 0, 1 ); tt_release( ttMark ); if (tt_tmpfile_fd != -1) { unlink(last_fname); if (fileFormat != FORMAT_XPM ) { unlink(dummy); } /* if */ } /* if */ #endif exit(0); } /* else */ }
void FinalizeToolTalkSession( ) { Tt_status ttRc; int i; for (i = 0; i < view_count; i++) { if (view_set[i]->msg != 0) { if (view_set[i]->pats != 0) { ttdt_file_quit( view_set[i]->pats, 0 ); view_set[i]->pats = 0; } tt_message_reply( view_set[i]->msg ); tttk_message_destroy( view_set[i]->msg ); view_set[i]->msg = 0; } } if( FileManagerToolTalkPattern && tt_ptr_error( FileManagerToolTalkPattern ) == TT_OK ) { ttRc = ttdt_session_quit( NULL, FileManagerToolTalkPattern, 1 ); if( ProcessToolTalkInputId ) XtRemoveInput( ProcessToolTalkInputId ); } ttRc = ttdt_close( NULL, NULL, sendStopped ); }
DtMail::Session::~Session(void) { if (_object_signature != SessionSignature) { // Been here, did that! return; } { MutexLock lock_scope(_obj_mutex); _object_signature = 0; ttdt_close(_tt_channel, NULL, 1); DtMailEnv b_error; // Close off the dynamic libraries and free the impl table. for (int tbl = 0; tbl < _num_impls; tbl++) { free(_impls[tbl].impl_name); DynamicLib * dl = (DynamicLib *)_impls[tbl].impl_lib; delete dl; } free(_impls); lock_scope.unlock_and_destroy(); delete _mail_rc; close(_event_fd[0]); close(_event_fd[1]); } }
int InitializeToolTalkSession( Widget topLevel, int ttFd ) { Tt_status ttstat; ttstat = ttmedia_ptype_declare( "DT_File_Manager", 0, MediaCallback, (void *) 0, 0); if (ttstat == TT_OK) ttstat = ttmedia_ptype_declare( "DT_File_Manager", 1000, MediaCallback, (void *) 0, 1); tt_ptype_opnum_callback_add( "DT_File_Manager", 0, HandleTtRequest ); if (ttstat == TT_OK) { /* * If we were started by a message, the following call to * tttk_Xt_input_handler will process it. Otherwise, * tttk_Xt_input_handler will just return. */ tttk_Xt_input_handler( NULL, 0, 0 ); FileManagerToolTalkPattern = ttdt_session_join( tt_default_session( ), SessionCallback, topLevel, NULL, 1 ); if( tt_is_err( tt_ptr_error( FileManagerToolTalkPattern ))) { ttdt_close( NULL, NULL, sendStopped ); return( 0 ); } } else { ttdt_close( NULL, NULL, sendStopped ); return( 0 ); } return( TT_OK ); }
Tt_status InitializeToolTalkProcid( int *ttFd, Widget topLevel, Boolean sendStarted ) { char * procId; Tt_status ttstat; #ifdef DT_PERFORMANCE printf(" InitializeToolTalkProcid\n"); gettimeofday(&update_time_s, NULL); #endif sendStopped = sendStarted; procId = ttdt_open( ttFd, DTFILE_CLASS_NAME, VENDOR, VERSION, sendStarted ); #ifdef DT_PERFORMANCE gettimeofday(&update_time_f, NULL); if (update_time_s.tv_usec > update_time_f.tv_usec) { update_time_f.tv_usec += 1000000; update_time_f.tv_sec--; } printf(" done InitializeToolTalkProcid, time: %ld.%ld\n\n", update_time_f.tv_sec - update_time_s.tv_sec, update_time_f.tv_usec - update_time_s .tv_usec); #endif if( (ttstat = tt_ptr_error( procId )) == TT_OK ) { ProcessToolTalkInputId = XtAppAddInput( XtWidgetToApplicationContext( toplevel ), *ttFd, (XtPointer)XtInputReadMask, tttk_Xt_input_handler, procId ); return( TT_OK ); } else { ttdt_close( NULL, NULL, sendStopped ); return( ttstat ); } }
void Process_Query_OK( void ) { extern int ttMark; extern int tt_tmpfile_fd; switch (DialogFlag) { case QUIT : #ifdef __TOOLTALK edit_notifier(NULL, 0, 1); ttdt_session_quit( 0, 0, 1 ); ttdt_close( 0, 0, 1 ); tt_release( ttMark ); if (tt_tmpfile_fd != -1) { unlink(last_fname); if (fileFormat != FORMAT_XPM ) { unlink(dummy);} } #endif exit(0); break; case NEW : Process_Resize(); DialogFlag= NONE; break; case OPEN : XtManageChild(fileIODialog); SetFileIODialogInfo(); break; case SAVE_AS : SaveMeNot = False; Do_FileIO(NULL, NULL, NULL); break; case GRAB : Do_GrabOp(); break; case DROP : Do_DropOp(); break; } /* switch */ XSync(dpy, 0); }